[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <831c2cad-c929-4190-8c79-da8192124a9c@oracle.com>
Date: Thu, 4 Sep 2025 12:10:32 -0600
From: Tom Hromatka <tom.hromatka@...cle.com>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>,
Kees Cook <kees@...nel.org>, Andy Lutomirski <luto@...capital.net>,
Will Drewry <wad@...omium.org>, Sargun Dhillon <sargun@...gun.me>,
Jonathan Corbet <corbet@....net>, Shuah Khan <shuah@...nel.org>,
Christian Brauner <brauner@...nel.org>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK" <linux-kselftest@...r.kernel.org>,
bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH] seccomp: Add SECCOMP_CLONE_FILTER operation
On 9/4/25 8:54 AM, Al Viro wrote:
> On Thu, Sep 04, 2025 at 08:26:30AM -0600, Tom Hromatka wrote:
>
>> This snippet addresses the double irq issue. I also added a
>> check to make sure that task != current. (A user shouldn't
>> do that but who knows what they'll actually do.)
>>
>> if (task == current) {
>> put_task_struct(task);
>> return -EINVAL;
>> }
>>
>> spin_lock_irq(¤t->sighand->siglock);
>> spin_lock(&task->sighand->siglock);
>
> What do you expect to happen if two tasks do that to each other
> at the same time?
As written, they'll deadlock sooner or later :(.
But that should be easy to fix by adding two checks prior to
grabbing locks:
1. Check that the source has 1 or more seccomp filters
2. Check that the target has 0 seccomp filters.
This would ensure that for the same two processes, there's
only one way the locks could be grabbed.
> Or, for that matter, if task has been spawned
> by current with CLONE_VM | CLONE_SIGHAND?
Don't know right off hand. I'll look into it.
Thanks for the help!
Tom
Powered by blists - more mailing lists