libfaketime icon indicating copy to clipboard operation
libfaketime copied to clipboard

select shim does not rescale the values returned in timespec

Open RobertHenry6bev opened this issue 3 years ago • 1 comments

The man(2) page for select says: On Linux, select() modifies timeout to reflect the amount of time not slept; most other implementations do not do this. (POSIX.1 permits either behavior.)

The shim for select does not modify its timespec argument on return. The real call to select is given a pointer to a local holding scaled time values, but that local is ignored when select() shim returns. I think the "time not slept" held in the local should be inversely scaled and used to modify the argument to the shim.

The pselect shim takes a const timespec argument, but then the path through glibc and the true syscall into the kernel becomes convoluted. pselect6 syscall will modify its timespec argument (if I read the man page correctly) but glibc wrapper ignores those mods, and so pselect doesn't return any indication of how much time is left.

RobertHenry6bev avatar Apr 01 '22 21:04 RobertHenry6bev

has this fix been tested (and released)?

RobertHenry6bev avatar Nov 13 '22 05:11 RobertHenry6bev