Re: [RFC PATCH 2/3] futex: Add basic infrastructure for local task local hash.

From: Peter Zijlstra
Date: Mon Oct 28 2024 - 06:46:51 EST


On Mon, Oct 28, 2024 at 11:24:08AM +0100, Sebastian Andrzej Siewior wrote:
> On 2024-10-28 11:16:33 [+0100], Peter Zijlstra wrote:
> > On Sun, Oct 27, 2024 at 12:34:51AM +0200, Sebastian Andrzej Siewior wrote:
> >
> > > Introduce a task local hash map. The hashmap can be allocated via
> > > prctl(PR_FUTEX_HASH, PR_FUTEX_HASH_ALLOCATE, 0)
> >
> > Per process, per task is useless and will make things malfunction.
> >
> > Things missing in this patch are CLONE_THREAD / CLONE_VM, and create
> > must be absolutely forbidden once mm_users != 1.
>
> I moved this to struct signal_struct and limited it for now to the
> group leader.

That works I suppose.

'process' is a really dodgy thing in Linux anyway :/

So CLONE_THREAD implies CLONE_SIGHAND, and CLONE_SIGHAND in turn implies
CLONE_VM -- however, you can do CLONE_VM without either SIGHAND or
THREAD, (or SIGHAND|VM without THREAD).

And it all quickly becomes a real mess.

'Sane' userspace doesn't play such games, and insane userspace gets to
keep the pieces I suppose.