[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241028131041.GT33184@noisy.programming.kicks-ass.net>
Date: Mon, 28 Oct 2024 14:10:41 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: linux-kernel@...r.kernel.org,
André Almeida <andrealmeid@...lia.com>,
Darren Hart <dvhart@...radead.org>,
Davidlohr Bueso <dave@...olabs.net>, Ingo Molnar <mingo@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>,
Valentin Schneider <vschneid@...hat.com>,
Waiman Long <longman@...hat.com>
Subject: Re: [RFC PATCH 2/3] futex: Add basic infrastructure for local task
local hash.
On Mon, Oct 28, 2024 at 11:46:39AM +0100, Peter Zijlstra wrote:
> 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.
Bah, I now remember there used to be (or maybe there still are, who
knows) a JVM that used a 'naked' CLONE_VM. And JVMs are also known to
use futex.
That would suggest putting the hash in mm_struct *or* make sure to
disallow / warn about these private hash when !CLONE_THREAD.
Powered by blists - more mailing lists