Page MenuHomeFreeBSD

nanosleep: plug a kernel memory disclosure
ClosedPublic

Authored by vangyzen on Mar 18 2017, 1:48 PM.
Tags
None
Referenced Files
F144443407: D10044.id26386.diff
Sun, Feb 8, 11:32 AM
F144407817: D10044.id26396.diff
Sun, Feb 8, 7:07 AM
Unknown Object (File)
Sun, Feb 1, 6:15 AM
Unknown Object (File)
Sat, Jan 31, 7:21 AM
Unknown Object (File)
Tue, Jan 27, 8:16 PM
Unknown Object (File)
Mon, Jan 26, 10:58 PM
Unknown Object (File)
Sat, Jan 24, 4:39 PM
Unknown Object (File)
Dec 31 2025, 9:34 PM
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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.