From: Tycho Andersen <tycho@tycho.pizza>
To: Sargun Dhillon <sargun@sargun.me>
Cc: Giuseppe Scrivano <gscrivan@redhat.com>,
Will Drewry <wad@chromium.org>, Kees Cook <keescook@chromium.org>,
Linux Containers <containers@lists.linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Andy Lutomirski <luto@amacapital.net>,
Alban Crequy <alban@kinvolk.io>,
Christian Brauner <christian.brauner@ubuntu.com>
Subject: Re: [PATCH RESEND 3/5] selftests/seccomp: Add test for wait killable notifier
Date: Mon, 26 Apr 2021 12:51:38 -0600 [thread overview]
Message-ID: <20210426185138.GA1605795@cisco> (raw)
In-Reply-To: <20210426180610.2363-4-sargun@sargun.me>
On Mon, Apr 26, 2021 at 11:06:08AM -0700, Sargun Dhillon wrote:
> +TEST(user_notification_signal_wait_killable)
> +{
> + pid_t pid;
> + long ret;
> + int status, listener, sk_pair[2];
> + struct seccomp_notif req = {
> + .flags = SECCOMP_USER_NOTIF_FLAG_WAIT_KILLABLE,
> + };
> + struct seccomp_notif_resp resp = {};
> + char c;
> +
> + ret = prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);
> + ASSERT_EQ(0, ret) {
> + TH_LOG("Kernel does not support PR_SET_NO_NEW_PRIVS!");
> + }
> +
> + ASSERT_EQ(socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, sk_pair), 0);
> + ASSERT_EQ(fcntl(sk_pair[0], F_SETFL, O_NONBLOCK), 0);
> +
> + listener = user_notif_syscall(__NR_gettid,
> + SECCOMP_FILTER_FLAG_NEW_LISTENER);
> + ASSERT_GE(listener, 0);
> +
> + pid = fork();
> + ASSERT_GE(pid, 0);
> +
> + if (pid == 0) {
> + close(sk_pair[0]);
> + handled = sk_pair[1];
> + if (signal(SIGUSR1, signal_handler) == SIG_ERR) {
I think here you want a write(handled, "x", 1), right?
Tycho
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/containers
WARNING: multiple messages have this Message-ID (diff)
From: Tycho Andersen <tycho@tycho.pizza>
To: Sargun Dhillon <sargun@sargun.me>
Cc: "Kees Cook" <keescook@chromium.org>,
LKML <linux-kernel@vger.kernel.org>,
"Linux Containers" <containers@lists.linux-foundation.org>,
"Rodrigo Campos" <rodrigo@kinvolk.io>,
"Christian Brauner" <christian.brauner@ubuntu.com>,
"Mauricio Vásquez Bernal" <mauricio@kinvolk.io>,
"Giuseppe Scrivano" <gscrivan@redhat.com>,
"Andy Lutomirski" <luto@amacapital.net>,
"Will Drewry" <wad@chromium.org>,
"Alban Crequy" <alban@kinvolk.io>
Subject: Re: [PATCH RESEND 3/5] selftests/seccomp: Add test for wait killable notifier
Date: Mon, 26 Apr 2021 12:51:38 -0600 [thread overview]
Message-ID: <20210426185138.GA1605795@cisco> (raw)
In-Reply-To: <20210426180610.2363-4-sargun@sargun.me>
On Mon, Apr 26, 2021 at 11:06:08AM -0700, Sargun Dhillon wrote:
> +TEST(user_notification_signal_wait_killable)
> +{
> + pid_t pid;
> + long ret;
> + int status, listener, sk_pair[2];
> + struct seccomp_notif req = {
> + .flags = SECCOMP_USER_NOTIF_FLAG_WAIT_KILLABLE,
> + };
> + struct seccomp_notif_resp resp = {};
> + char c;
> +
> + ret = prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);
> + ASSERT_EQ(0, ret) {
> + TH_LOG("Kernel does not support PR_SET_NO_NEW_PRIVS!");
> + }
> +
> + ASSERT_EQ(socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, sk_pair), 0);
> + ASSERT_EQ(fcntl(sk_pair[0], F_SETFL, O_NONBLOCK), 0);
> +
> + listener = user_notif_syscall(__NR_gettid,
> + SECCOMP_FILTER_FLAG_NEW_LISTENER);
> + ASSERT_GE(listener, 0);
> +
> + pid = fork();
> + ASSERT_GE(pid, 0);
> +
> + if (pid == 0) {
> + close(sk_pair[0]);
> + handled = sk_pair[1];
> + if (signal(SIGUSR1, signal_handler) == SIG_ERR) {
I think here you want a write(handled, "x", 1), right?
Tycho
next prev parent reply other threads:[~2021-04-26 19:01 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-26 18:06 [PATCH RESEND 0/5] Handle seccomp notification preemption Sargun Dhillon
2021-04-26 18:06 ` Sargun Dhillon
2021-04-26 18:06 ` [PATCH RESEND 1/5] seccomp: Refactor notification handler to prepare for new semantics Sargun Dhillon
2021-04-26 18:06 ` Sargun Dhillon
2021-04-26 18:06 ` [PATCH RESEND 2/5] seccomp: Add wait_killable semantic to seccomp user notifier Sargun Dhillon
2021-04-26 18:06 ` Sargun Dhillon
2021-04-26 19:02 ` Tycho Andersen
2021-04-26 19:02 ` Tycho Andersen
2021-04-26 22:15 ` Sargun Dhillon
2021-04-26 22:15 ` Sargun Dhillon
2021-04-27 13:48 ` Tycho Andersen
2021-04-27 13:48 ` Tycho Andersen
2021-04-27 16:23 ` Andy Lutomirski
2021-04-27 16:23 ` Andy Lutomirski
2021-04-27 17:07 ` Tycho Andersen
2021-04-27 17:07 ` Tycho Andersen
2021-04-27 22:10 ` Sargun Dhillon
2021-04-27 22:10 ` Sargun Dhillon
2021-04-27 23:19 ` Andy Lutomirski
2021-04-27 23:19 ` Andy Lutomirski
2021-04-28 0:22 ` Tycho Andersen
2021-04-28 0:22 ` Tycho Andersen
2021-04-28 11:10 ` Rodrigo Campos
2021-04-28 11:10 ` Rodrigo Campos
2021-04-28 13:20 ` Rodrigo Campos
2021-04-28 13:20 ` Rodrigo Campos
2021-04-28 14:08 ` Tycho Andersen
2021-04-28 14:08 ` Tycho Andersen
2021-04-28 17:13 ` Sargun Dhillon
2021-04-28 17:13 ` Sargun Dhillon
2021-04-28 3:20 ` Sargun Dhillon
2021-04-28 3:20 ` Sargun Dhillon
2021-04-27 16:34 ` Sargun Dhillon
2021-04-27 16:34 ` Sargun Dhillon
2021-04-26 18:06 ` [PATCH RESEND 3/5] selftests/seccomp: Add test for wait killable notifier Sargun Dhillon
2021-04-26 18:06 ` Sargun Dhillon
2021-04-26 18:51 ` Tycho Andersen [this message]
2021-04-26 18:51 ` Tycho Andersen
2021-04-26 18:06 ` [PATCH RESEND 4/5] seccomp: Support atomic "addfd + send reply" Sargun Dhillon
2021-04-26 18:06 ` Sargun Dhillon
2021-04-26 18:06 ` [PATCH RESEND 5/5] selftests/seccomp: Add test for atomic addfd+send Sargun Dhillon
2021-04-26 18:06 ` Sargun Dhillon
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=20210426185138.GA1605795@cisco \
--to=tycho@tycho.pizza \
--cc=alban@kinvolk.io \
--cc=christian.brauner@ubuntu.com \
--cc=containers@lists.linux-foundation.org \
--cc=gscrivan@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=sargun@sargun.me \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.