summaryrefslogtreecommitdiff
path: root/include/rttypes.h
diff options
context:
space:
mode:
authorbernard <[email protected]>2026-11-03 00:08:16 +0800
committerRbb666 <[email protected]>2026-11-03 09:04:56 +0800
commit9e29e3246b1db1a73b52d2581dc63247fc052d42 (patch)
treee9e0f110f163a990985f4fa84097c5c98b4f460f /include/rttypes.h
parent2c88a3b69877b8b1ccb88b08829e989715e5233b (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 'include/rttypes.h')
0 files changed, 0 insertions, 0 deletions