Page MenuHomeFreeBSD

nanosleep: plug a kernel memory disclosure
ClosedPublic

Authored by vangyzen on Mar 18 2017, 1:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 15 2024, 4:01 PM
Unknown Object (File)
Oct 10 2024, 6:54 AM
Unknown Object (File)
Oct 10 2024, 3:12 AM
Unknown Object (File)
Sep 30 2024, 1:03 AM
Unknown Object (File)
Sep 30 2024, 1:03 AM
Unknown Object (File)
Sep 30 2024, 1:03 AM
Unknown Object (File)
Sep 30 2024, 12:52 AM
Unknown Object (File)
Sep 24 2024, 7:05 AM
Subscribers

Details

Summary

nanosleep() updates rmtp on EINVAL. In that case, kern_nanosleep()
has not updated rmt, so sys_nanosleep() updates the user-space rmtp
by copying garbage from its stack frame. This is a kernel memory
disclosure. It's also not POSIX-compliant. Fix it to update rmtp
only on EINTR.

I found this while working on D10020, and I made it public before
realizing the possible security implications.
The Security Officer suggested that I go ahead and commit the fix.

Diff Detail

Event Timeline

Thankfully, this is likely not a severe disclosure.

For linuxulator this does not make sense now as we check timespec values in linux_to_native_timespec before calling kern_nanosleep()

This revision is now accepted and ready to land.Mar 18 2017, 2:01 PM

For linuxulator this does not make sense now as we check timespec values in linux_to_native_timespec before calling kern_nanosleep()

kern_nanosleep checks for negative nanoseconds, but I don't see where linux_to_native_timespec checks for that.

For linuxulator this does not make sense now as we check timespec values in linux_to_native_timespec before calling kern_nanosleep()

kern_nanosleep checks for negative nanoseconds, but I don't see where linux_to_native_timespec checks for that.

yes, this is error, linux timespec_valid() function casts tv_usec to unsigned before comparison. I'll fix

This revision was automatically updated to reflect the committed changes.