Page MenuHomeFreeBSD

nanosleep: plug a kernel memory disclosure
ClosedPublic

Authored by vangyzen on Mar 18 2017, 1:48 PM.
Tags
None
Referenced Files
F152830212: D10044.id26396.diff
Fri, Apr 17, 9:44 AM
F152822294: D10044.id26396.diff
Fri, Apr 17, 8:21 AM
Unknown Object (File)
Thu, Apr 16, 9:32 AM
Unknown Object (File)
Tue, Apr 14, 9:17 AM
Unknown Object (File)
Mon, Apr 13, 10:10 PM
Unknown Object (File)
Wed, Apr 8, 12:32 AM
Unknown Object (File)
Tue, Apr 7, 5:26 PM
Unknown Object (File)
Mon, Apr 6, 8:56 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

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.