Page MenuHomeFreeBSD

linux/futex: Don't load a timeout when try-locking a mutex
ClosedPublic

Authored by markj on Mon, Jul 6, 5:20 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jul 15, 7:29 AM
Unknown Object (File)
Wed, Jul 15, 7:29 AM
Unknown Object (File)
Tue, Jul 14, 8:21 PM
Unknown Object (File)
Mon, Jul 13, 10:03 PM
Unknown Object (File)
Mon, Jul 13, 8:32 PM
Unknown Object (File)
Mon, Jul 13, 2:20 PM
Unknown Object (File)
Mon, Jul 13, 11:53 AM
Unknown Object (File)
Sun, Jul 12, 11:16 PM
Subscribers

Details

Summary

linux_sys_futex() does not copyin a timespec for the timeout if the
operation is LINUX_FUTEX_TRYLOCK_PI, presumably because it doesn't make
sense to specify a timeout for a try-lock operation. However, this
means that we pass a userspace timespec pointer to
linux_umtx_abs_timeout_init().

Modify linux_futex_lock_pi() to not initialize the timeout if we're
try-locking.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Mon, Jul 6, 5:20 PM
sys/compat/linux/linux_futex.c
372–373

the if (try) return EBUSY; below should avoid the use of uninitialized timo, but are all compilers smart enough to follow the control flow?
It took some time to understand that.

If we introduce a pointer to timo, and set it to NULL in the try || ts == NULL case, then we can remove the conditional from the line 549.

markj marked an inline comment as done.

Apply kib's suggestion

This revision is now accepted and ready to land.Tue, Jul 7, 2:49 PM