<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rt-thread.git/components/libc/posix, branch v5.2.0-beta</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?h=v5.2.0-beta</id>
<link rel='self' href='http://cgit.235523.xyz/rt-thread.git/atom/components/libc/posix?h=v5.2.0-beta'/>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/'/>
<updated>2025-03-17T08:39:43Z</updated>
<entry>
<title>fix dangling pointer in component pthread and dfs_elm (#9976)</title>
<updated>2025-03-17T08:39:43Z</updated>
<author>
<name>lingfengPeng</name>
<email>uint8_t@163.com</email>
</author>
<published>2025-03-11T02:48:29Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=a978ab49fd65c258084c805d37a4de6367b45612'/>
<id>urn:sha1:a978ab49fd65c258084c805d37a4de6367b45612</id>
<content type='text'>
* [components/libc/posix][pthreads]fix the risk of dangling pointer

* [components][dfs][dfs_elm]:fix risk of dangling pointer, unmount the temp driver then free the temp FATFS in dfs_elm_mkfs.</content>
</entry>
<entry>
<title>components: libc: fix pointer-to-integer cast warnings and address truncation</title>
<updated>2025-03-10T14:44:18Z</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=e0e489a90596ad046f3959e1676608bafb171d42'/>
<id>urn:sha1:e0e489a90596ad046f3959e1676608bafb171d42</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-03-10T14:43: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=6a1e17498abe995ae1f186d9503bdf11b1484594'/>
<id>urn:sha1:6a1e17498abe995ae1f186d9503bdf11b1484594</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>[components][libc/io]add comments for timer fd APIs.</title>
<updated>2024-12-19T02:07:42Z</updated>
<author>
<name>ligr</name>
<email>liguorui1213@163.com</email>
</author>
<published>2024-12-19T00:41:57Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=1499dbda00b4dc6520fed01e5e81ef5b628e3cff'/>
<id>urn:sha1:1499dbda00b4dc6520fed01e5e81ef5b628e3cff</id>
<content type='text'>
</content>
</entry>
<entry>
<title>[components/libc/posix]add comments for thread local storage APIs.</title>
<updated>2024-11-22T02:46:47Z</updated>
<author>
<name>ligr</name>
<email>liguorui1213@163.com</email>
</author>
<published>2024-11-22T02:15:59Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=dd709c1cea4289d841dda413c60e90dbc5ec6193'/>
<id>urn:sha1:dd709c1cea4289d841dda413c60e90dbc5ec6193</id>
<content type='text'>
</content>
</entry>
<entry>
<title>[components/libc/posix]fix the problem that it doesn't check if barrier still in use and dosen't destory the mutex either.</title>
<updated>2024-11-22T00:22:44Z</updated>
<author>
<name>ligr</name>
<email>liguorui1213@163.com</email>
</author>
<published>2024-11-21T03:16:21Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=bb0a1ea45350986d14e985b1ba0de9c1ec7a650d'/>
<id>urn:sha1:bb0a1ea45350986d14e985b1ba0de9c1ec7a650d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>[components/libc/posix]fix the errors that assigning an integer to a pointer and always return EINVAL.</title>
<updated>2024-11-22T00:22:44Z</updated>
<author>
<name>ligr</name>
<email>liguorui1213@163.com</email>
</author>
<published>2024-11-21T02:54:52Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=0bac8c4f90ebefc16decc8b1c4e96c9802a79a9c'/>
<id>urn:sha1:0bac8c4f90ebefc16decc8b1c4e96c9802a79a9c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>[components/libc/posix]add comments for barrier APIs.</title>
<updated>2024-11-22T00:22:44Z</updated>
<author>
<name>ligr</name>
<email>liguorui1213@163.com</email>
</author>
<published>2024-11-21T02:50:29Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=79324c0b4c9be600f12bb9ad214f766779a9ae02'/>
<id>urn:sha1:79324c0b4c9be600f12bb9ad214f766779a9ae02</id>
<content type='text'>
</content>
</entry>
<entry>
<title>[components/libc/posix]add comments for rwlock APIs.</title>
<updated>2024-11-19T23:26:16Z</updated>
<author>
<name>ligr</name>
<email>liguorui1213@163.com</email>
</author>
<published>2024-11-19T12:27:26Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=b023c15256de4d768f1d58fd967405749c472702'/>
<id>urn:sha1:b023c15256de4d768f1d58fd967405749c472702</id>
<content type='text'>
</content>
</entry>
<entry>
<title>[components/libc/posix]add comments for condition variable APIs.</title>
<updated>2024-11-19T23:26:16Z</updated>
<author>
<name>ligr</name>
<email>liguorui1213@163.com</email>
</author>
<published>2024-11-19T12:26:31Z</published>
<link rel='alternate' type='text/html' href='http://cgit.235523.xyz/rt-thread.git/commit/?id=c1c7959bdb9a1ad0cbf956b6b1998928477e1dee'/>
<id>urn:sha1:c1c7959bdb9a1ad0cbf956b6b1998928477e1dee</id>
<content type='text'>
</content>
</entry>
</feed>
