<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rt-thread.git/components/libc/posix/libdl, branch copilot/create-dfs2-documentation</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<id>http://cgit.235523.xyz/rt-thread.git/atom/components/libc/posix/libdl?h=copilot%2Fcreate-dfs2-documentation</id>
<link rel='self' href='http://cgit.235523.xyz/rt-thread.git/atom/components/libc/posix/libdl?h=copilot%2Fcreate-dfs2-documentation'/>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/'/>
<updated>2025-02-22T19:16:00Z</updated>
<entry>
<title>components: libc: fix pointer-to-integer cast warnings and address truncation</title>
<updated>2025-02-22T19:16:00Z</updated>
<author>
<name>kenneth.liu</name>
<email>kenneth.liu@sophgo.com</email>
</author>
<published>2025-02-22T05:20:11Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=4940bb10515316791f1940a59bfeaeebee35ec87'/>
<id>urn:sha1:4940bb10515316791f1940a59bfeaeebee35ec87</id>
<content type='text'>
[Problem Description]
1. When enabling RT_USING_MODULE=y, compilation warnings occur:
   dlelf.c:386:27: warning: cast from pointer to integer of different size
   dlelf.c:398:25: warning: cast from pointer to integer of different size
   dlelf.c:408:24: warning: cast from pointer to integer of different size

2. On RV64 architectures (e.g. Sophgo SG2042 with RISC-V Sv39 and 40-bit physical addressing),
   dlsym may fail when accessing addresses beyond 32-bit range.

[Root Cause]
In dlmodule_load_relocated_object() and dlmodule_symbol_find(),
pointer is cast to rt_uint32_t which truncates:
| rt_ubase_t rodata_addr = (rt_uint32_t)ptr;
This causes:
- Warnings on 64-bit systems (pointer width &gt; 32-bit)
- Actual address truncation on RV64 when physical address exceeds 32-bit

[Solution]
Replace rt_uint32_t with architecture-adaptive rt_ubase_t:
| rt_ubase_t rodata_addr = (rt_ubase_t)ptr;
The rt_ubase_t is defined in include/rttypes.h as:
| #ifdef ARCH_CPU_64BIT
|   typedef rt_uint64_t rt_ubase_t;
| #else
|   typedef rt_uint32_t rt_ubase_t;
| #endif
This ensures correct width casting for both 32/64-bit architectures.

Signed-off-by: Liu Gui &lt;kenneth.liu@sophgo.com&gt;
</content>
</entry>
<entry>
<title>components: libc: fix array overflow in rt_object name assignment</title>
<updated>2025-02-21T03:38:06Z</updated>
<author>
<name>kenneth.liu</name>
<email>kenneth.liu@sophgo.com</email>
</author>
<published>2025-02-20T12:25:30Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=a5b26bb588303f7b503156d634e05d21d873a245'/>
<id>urn:sha1:a5b26bb588303f7b503156d634e05d21d873a245</id>
<content type='text'>
[Problem Description]
When assigning name to rt_object, strncpy() uses size equal to RT_NAME_MAX,
which causes missing null-terminator and overflows into adjacent 'type' field.
This corruption leads to unexpected system behavior.

[Problem Analysis]
The rt_object structure defines:
| char name[RT_NAME_MAX] | -&gt; buffer
| rt_uint8_t type        | -&gt; adjacent field

Original code calculates size as:
size = end - first + 1;
if (size &gt; RT_NAME_MAX) size = RT_NAME_MAX;

When size equals RT_NAME_MAX, strncpy() will copy exactly RT_NAME_MAX bytes
without adding terminating '\0', causing two issues:
1. name buffer is not null-terminated
2. The implicit null-byte writes beyond name[] into type field

[Solution]
Change boundary check from:
if (size &gt; RT_NAME_MAX) size = RT_NAME_MAX;
to:
if (size &gt;= RT_NAME_MAX) size = RT_NAME_MAX - 1;

This ensures:
1. Always leaves space for null-terminator
2. Prevents overflow into type field
3. Maintains maximum valid name length (RT_NAME_MAX-1 + '\0')

Signed-off-by: Liu Gui &lt;kenneth.liu@sophgo.com&gt;
</content>
</entry>
<entry>
<title>[libc] add comments for libdl APIs.</title>
<updated>2024-11-12T23:58:34Z</updated>
<author>
<name>ligr</name>
<email>liguorui1213@163.com</email>
</author>
<published>2024-11-12T07:38:28Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=f0934630c46a3111cf06ab2777e368fc04050292'/>
<id>urn:sha1:f0934630c46a3111cf06ab2777e368fc04050292</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fix Compilation error in "driver.c", "completion_up.c", "syslog.c" and "dlmodule.c". (#9093)</title>
<updated>2024-06-26T15:25:23Z</updated>
<author>
<name>Rui</name>
<email>1413577909@qq.com</email>
</author>
<published>2024-06-26T15:25:23Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=3b1d4e9222f5a7f3f3d65f90d7fe8de4a9abaf4e'/>
<id>urn:sha1:3b1d4e9222f5a7f3f3d65f90d7fe8de4a9abaf4e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>[kernel] add rt_thread_close()</title>
<updated>2024-05-01T04:49:09Z</updated>
<author>
<name>Shell</name>
<email>smokewood@qq.com</email>
</author>
<published>2024-05-01T04:49:09Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=2c9b7c10b9ff6b4509945376bb4e25dd18c1ce25'/>
<id>urn:sha1:2c9b7c10b9ff6b4509945376bb4e25dd18c1ce25</id>
<content type='text'>
* [thread] Add rt_thread_close()

This patch introduces a new function `rt_thread_close()` to enhances the
usability and maintainability by providing a dedicated mechanism for
closing threads.

- A new function `rt_thread_close()` is added to the API, providing a
  standardized approach for closing threads.
- The `rt_thread_close()` function removes a thread from the thread
  queue, updates its status to indicate closure, and performs the thread
  timer detaching which is a embedded timer in thread object.
- Additionally, the `rt_thread_detach()` function is modified to utilize
  `rt_thread_close()` internally, streamlining the thread detachment
  process.

Signed-off-by: Shell &lt;smokewood@qq.com&gt;</content>
</entry>
<entry>
<title>🎯 Sync smart &amp; scheduler codes (#8537)</title>
<updated>2024-02-23T09:49:15Z</updated>
<author>
<name>Shell</name>
<email>smokewood@qq.com</email>
</author>
<published>2024-02-23T09:49:15Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=71560bafb5735220696ca24a42ba4a668b55949b'/>
<id>urn:sha1:71560bafb5735220696ca24a42ba4a668b55949b</id>
<content type='text'>
Signed-off-by: Shell &lt;smokewood@qq.com&gt;
Co-authored-by: xqyjlj &lt;xqyjlj@126.com&gt;</content>
</entry>
<entry>
<title>[debug] remove RT_DEBUG_xxx</title>
<updated>2023-07-09T04:19:29Z</updated>
<author>
<name>Meco Man</name>
<email>920369182@qq.com</email>
</author>
<published>2023-07-08T23:09:51Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=237bbfd9688b4ea0329047a85165323b99961345'/>
<id>urn:sha1:237bbfd9688b4ea0329047a85165323b99961345</id>
<content type='text'>
remove RT_DEBUG_THREAD RT_DEBUG_SCHEDULER RT_DEBUG_IPC RT_DEBUG_TIMER RT_DEBUG_IRQ RT_DEBUG_MEM RT_DEBUG_SLAB RT_DEBUG_MEMHEAP
</content>
</entry>
<entry>
<title>[include][dbg]update: no longer use RT_DEBUG_LOG in rtdebug.h (#7750)</title>
<updated>2023-06-29T15:24:25Z</updated>
<author>
<name>Shicheng Chu</name>
<email>1468559561@qq.com</email>
</author>
<published>2023-06-29T15:24:25Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=e2c031643c8dec7c9ea1581216e19bf19c8f73f0'/>
<id>urn:sha1:e2c031643c8dec7c9ea1581216e19bf19c8f73f0</id>
<content type='text'>
</content>
</entry>
<entry>
<title>[kernel] 将rt_thread结构体改为显式继承rt_object (#7131)</title>
<updated>2023-04-04T13:06:27Z</updated>
<author>
<name>Shicheng Chu</name>
<email>1468559561@qq.com</email>
</author>
<published>2023-04-04T13:06:27Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=93f3cb30e48d5de341bda09fa806120e2bc3f3ad'/>
<id>urn:sha1:93f3cb30e48d5de341bda09fa806120e2bc3f3ad</id>
<content type='text'>
</content>
</entry>
<entry>
<title>[Scons] 将GCC判断条件改为列表方式，方便后续增加新的编译工具链</title>
<updated>2022-06-08T23:01:59Z</updated>
<author>
<name>Meco Man</name>
<email>920369182@qq.com</email>
</author>
<published>2022-05-30T22:04:05Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=50f041f5c2fb69b06283f54ce4619a08751d9367'/>
<id>urn:sha1:50f041f5c2fb69b06283f54ce4619a08751d9367</id>
<content type='text'>
</content>
</entry>
</feed>
