LKML Archive on lore.kernel.org
 help / Atom feed
* [PATCH] selftests/seccomp: Remove SIGSTOP si_pid check
@ 2018-12-06 23:50 Kees Cook
  2018-12-12  0:43 ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2018-12-06 23:50 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Tycho Andersen, Eric W. Biederman, linux-kernel, linux-kselftest

Commit f149b3155744 ("signal: Never allocate siginfo for SIGKILL or SIGSTOP")
means that the seccomp selftest cannot check si_pid under SIGSTOP anymore.
Since it's believed[1] there are no other userspace things depending on the
old behavior, this removes the behavioral check in the selftest, since it's
more a "extra" sanity check (which turns out, maybe, not to have been
useful to test).

[1] https://lkml.kernel.org/r/CAGXu5jJaZAOzP1qFz66tYrtbuywqb+UN2SOA1VLHpCCOiYvYeg@mail.gmail.com

Reported-by: Tycho Andersen <tycho@tycho.ws>
Suggested-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
Shuah, can you make sure that Linus gets this before v4.20 is released? Thanks!
---
 tools/testing/selftests/seccomp/seccomp_bpf.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index e1473234968d..c9a2abf8be1b 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -2731,9 +2731,14 @@ TEST(syscall_restart)
 	ASSERT_EQ(child_pid, waitpid(child_pid, &status, 0));
 	ASSERT_EQ(true, WIFSTOPPED(status));
 	ASSERT_EQ(SIGSTOP, WSTOPSIG(status));
-	/* Verify signal delivery came from parent now. */
 	ASSERT_EQ(0, ptrace(PTRACE_GETSIGINFO, child_pid, NULL, &info));
-	EXPECT_EQ(getpid(), info.si_pid);
+	/*
+	 * There is no siginfo on SIGSTOP any more, so we can't verify
+	 * signal delivery came from parent now (getpid() == info.si_pid).
+	 * https://lkml.kernel.org/r/CAGXu5jJaZAOzP1qFz66tYrtbuywqb+UN2SOA1VLHpCCOiYvYeg@mail.gmail.com
+	 * At least verify the SIGSTOP via PTRACE_GETSIGINFO.
+	 */
+	EXPECT_EQ(SIGSTOP, info.si_signo);
 
 	/* Restart nanosleep with SIGCONT, which triggers restart_syscall. */
 	ASSERT_EQ(0, kill(child_pid, SIGCONT));
-- 
2.17.1


-- 
Kees Cook

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/seccomp: Remove SIGSTOP si_pid check
  2018-12-06 23:50 [PATCH] selftests/seccomp: Remove SIGSTOP si_pid check Kees Cook
@ 2018-12-12  0:43 ` Kees Cook
  2018-12-12  0:54   ` shuah
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2018-12-12  0:43 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Tycho Andersen, Eric W. Biederman, LKML,
	open list:KERNEL SELFTEST FRAMEWORK

On Thu, Dec 6, 2018 at 3:50 PM Kees Cook <keescook@chromium.org> wrote:
>
> Commit f149b3155744 ("signal: Never allocate siginfo for SIGKILL or SIGSTOP")
> means that the seccomp selftest cannot check si_pid under SIGSTOP anymore.
> Since it's believed[1] there are no other userspace things depending on the
> old behavior, this removes the behavioral check in the selftest, since it's
> more a "extra" sanity check (which turns out, maybe, not to have been
> useful to test).
>
> [1] https://lkml.kernel.org/r/CAGXu5jJaZAOzP1qFz66tYrtbuywqb+UN2SOA1VLHpCCOiYvYeg@mail.gmail.com
>
> Reported-by: Tycho Andersen <tycho@tycho.ws>
> Suggested-by: Eric W. Biederman <ebiederm@xmission.com>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> Shuah, can you make sure that Linus gets this before v4.20 is released? Thanks!

Ping. Shuah, can you get this to Linus (or should I send it directly?)

Thanks!

-Kees


> ---
>  tools/testing/selftests/seccomp/seccomp_bpf.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
> index e1473234968d..c9a2abf8be1b 100644
> --- a/tools/testing/selftests/seccomp/seccomp_bpf.c
> +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
> @@ -2731,9 +2731,14 @@ TEST(syscall_restart)
>         ASSERT_EQ(child_pid, waitpid(child_pid, &status, 0));
>         ASSERT_EQ(true, WIFSTOPPED(status));
>         ASSERT_EQ(SIGSTOP, WSTOPSIG(status));
> -       /* Verify signal delivery came from parent now. */
>         ASSERT_EQ(0, ptrace(PTRACE_GETSIGINFO, child_pid, NULL, &info));
> -       EXPECT_EQ(getpid(), info.si_pid);
> +       /*
> +        * There is no siginfo on SIGSTOP any more, so we can't verify
> +        * signal delivery came from parent now (getpid() == info.si_pid).
> +        * https://lkml.kernel.org/r/CAGXu5jJaZAOzP1qFz66tYrtbuywqb+UN2SOA1VLHpCCOiYvYeg@mail.gmail.com
> +        * At least verify the SIGSTOP via PTRACE_GETSIGINFO.
> +        */
> +       EXPECT_EQ(SIGSTOP, info.si_signo);
>
>         /* Restart nanosleep with SIGCONT, which triggers restart_syscall. */
>         ASSERT_EQ(0, kill(child_pid, SIGCONT));
> --
> 2.17.1
>
>
> --
> Kees Cook



-- 
Kees Cook

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/seccomp: Remove SIGSTOP si_pid check
  2018-12-12  0:43 ` Kees Cook
@ 2018-12-12  0:54   ` shuah
  0 siblings, 0 replies; 3+ messages in thread
From: shuah @ 2018-12-12  0:54 UTC (permalink / raw)
  To: Kees Cook
  Cc: Tycho Andersen, Eric W. Biederman, LKML,
	open list:KERNEL SELFTEST FRAMEWORK, shuah

On 12/11/18 5:43 PM, Kees Cook wrote:
> On Thu, Dec 6, 2018 at 3:50 PM Kees Cook <keescook@chromium.org> wrote:
>>
>> Commit f149b3155744 ("signal: Never allocate siginfo for SIGKILL or SIGSTOP")
>> means that the seccomp selftest cannot check si_pid under SIGSTOP anymore.
>> Since it's believed[1] there are no other userspace things depending on the
>> old behavior, this removes the behavioral check in the selftest, since it's
>> more a "extra" sanity check (which turns out, maybe, not to have been
>> useful to test).
>>
>> [1] https://lkml.kernel.org/r/CAGXu5jJaZAOzP1qFz66tYrtbuywqb+UN2SOA1VLHpCCOiYvYeg@mail.gmail.com
>>
>> Reported-by: Tycho Andersen <tycho@tycho.ws>
>> Suggested-by: Eric W. Biederman <ebiederm@xmission.com>
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>> ---
>> Shuah, can you make sure that Linus gets this before v4.20 is released? Thanks!
> 
> Ping. Shuah, can you get this to Linus (or should I send it directly?)
> 

I will send this. Thanks for the ping.

-- Shuah


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06 23:50 [PATCH] selftests/seccomp: Remove SIGSTOP si_pid check Kees Cook
2018-12-12  0:43 ` Kees Cook
2018-12-12  0:54   ` shuah

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox