Re: [PATCH v2 0/3] futex: Create set_robust_list2

From: Peter Zijlstra
Date: Mon Nov 04 2024 - 06:35:17 EST


On Sat, Nov 02, 2024 at 10:58:42PM +0100, Florian Weimer wrote:

> QEMU hints towards further problems (in linux-user/syscall.c):
>
> case TARGET_NR_set_robust_list:
> case TARGET_NR_get_robust_list:
> /* The ABI for supporting robust futexes has userspace pass
> * the kernel a pointer to a linked list which is updated by
> * userspace after the syscall; the list is walked by the kernel
> * when the thread exits. Since the linked list in QEMU guest
> * memory isn't a valid linked list for the host and we have
> * no way to reliably intercept the thread-death event, we can't
> * support these. Silently return ENOSYS so that guest userspace
> * falls back to a non-robust futex implementation (which should
> * be OK except in the corner case of the guest crashing while
> * holding a mutex that is shared with another process via
> * shared memory).
> */
> return -TARGET_ENOSYS;

I don't think we can sanely fix that. Can't QEMU track the robust thing
itself and use waitpid() to discover the thread is gone and fudge things
from there?