News for hackers. Stuff that matters.
Re:Tracking Trust with Rust in the Kernel by cyphar on Friday September 19, 2025 @06:44AM (#45300119)
The kernel doesn't give you SIGSEGV in that case -- you will usually just get -EFAULT. All user pointer accesses are scoped with user_access_begin() and user_access_end() (or something equivalent) which stops the block of data from being unmapped by another thread -- of course, if this mechanism didn't exist then you would get a kernel oops if there was a concurrent munmap(2).
Re:Tracking Trust with Rust in the Kernel by cyphar on Saturday September 20, 2025 @04:20AM (#45311484)
I looked at it again and the story is more complicated -- user_access_begin() is actually just a memory barrier on x86 and so doesn't take mmap_sem like I thought. It looks like each get_user() independently checks that the pointer is valid and access_ok() is actually just a fast path. You will still get -EFAULT in the unmapped case though.