diff options
| author | bernard <[email protected]> | 2026-11-03 00:08:16 +0800 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2026-11-03 09:04:56 +0800 |
| commit | 9e29e3246b1db1a73b52d2581dc63247fc052d42 (patch) | |
| tree | e9e0f110f163a990985f4fa84097c5c98b4f460f /src/utest/messagequeue_tc.c | |
| parent | 2c88a3b69877b8b1ccb88b08829e989715e5233b (diff) | |
[components][lwp] harden sys_getaddrinfo user pointer handling
sys_getaddrinfo() validated the top-level res buffer, then wrote the
resolved socket address through res->ai_addr, a user-controlled nested
pointer that was never checked. On Smart/MMU builds a user program could
therefore turn getaddrinfo() into an arbitrary kernel write. The hints
fields were also read directly from user memory after the access check,
leaving a TOCTOU window.
Copy res and hints into kernel temporaries with lwp_get_from_user() so
all nested pointers come from one validated snapshot. Write the nested
sockaddr and the outer addrinfo back with lwp_put_to_user(), which
validates the destination range and never dereferences an unchecked user
pointer in kernel context.
Also fix the servname copy check (a size_t result can never be < 0),
allocate the kernel addrinfo with sizeof(*k_hints), and release k_res on
the new error paths.
Co-Authored-By: Claude Code <[email protected]>
Diffstat (limited to 'src/utest/messagequeue_tc.c')
0 files changed, 0 insertions, 0 deletions
