From: Tom Hromatka <tom.hromatka@oracle.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Kees Cook <kees@kernel.org>,
Andy Lutomirski <luto@amacapital.net>,
Will Drewry <wad@chromium.org>, Sargun Dhillon <sargun@sargun.me>,
Jonathan Corbet <corbet@lwn.net>, Shuah Khan <shuah@kernel.org>,
Christian Brauner <brauner@kernel.org>,
"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>, bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH] seccomp: Add SECCOMP_CLONE_FILTER operation
Date: Thu, 4 Sep 2025 12:10:32 -0600 [thread overview]
Message-ID: <831c2cad-c929-4190-8c79-da8192124a9c@oracle.com> (raw)
In-Reply-To: <20250904145420.GP39973@ZenIV>
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
next prev parent reply other threads:[~2025-09-04 18:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 20:38 Tom Hromatka
2025-09-03 20:45 ` Alexei Starovoitov
2025-09-03 20:51 ` Tom Hromatka
2025-09-03 22:44 ` Alexei Starovoitov
2025-09-04 12:08 ` Tom Hromatka
2025-09-04 14:26 ` Tom Hromatka
2025-09-04 14:54 ` Al Viro
2025-09-04 18:10 ` Tom Hromatka [this message]
2025-09-04 11:53 ` kernel test robot
2025-09-04 16:26 ` Kees Cook
2025-09-04 18:19 ` Tom Hromatka
2025-09-04 17:51 ` Al Viro
2025-09-05 21:03 ` YiFei Zhu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=831c2cad-c929-4190-8c79-da8192124a9c@oracle.com \
--to=tom.hromatka@oracle.com \
--cc=alexei.starovoitov@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=corbet@lwn.net \
--cc=kees@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=sargun@sargun.me \
--cc=shuah@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=wad@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®