On Tue, 17 Mar 2026 at 09:52, Sun Haoyu <[email protected]> wrote: > > Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3343 > > Linux kernel writes back the remaining timeout when raw ppoll/pselect6 > syscalls are interrupted by signals (-EINTR). > > However, QEMU keeps the original timeout and loses the remaining time. > > Both do_ppoll() and do_pselect6() now write back the timeout on -EINTR > to match the kernel. > > Tested with the issue reproducer.
Hi; thanks for sending in this patch. I have a couple of thoughts: (1) if you look at the Linux kernel code for select/pselect/etc, it doesn't actually make the "update the timespec" handling specific to "operation succeeded or hit EINTR", it just does it unconditionally: https://elixir.bootlin.com/linux/v6.19.8/source/fs/select.c#L295 So I think we could do that too. (There are some early-exit error cases where the host kernel doesn't get as far as calling poll_select_finish(), but for those the timespec struct won't have been changed by the host kernel. So it will be harmless that we round-tripped it through the target_to_host_foo and host_to_target_foo conversions.) (2) this patch handles pselect6() and ppoll(), but do we also need to do this in do_select() ? thanks -- PMM
