From patchwork Thu Dec 6 23:50:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10717269 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6831314E2 for ; Thu, 6 Dec 2018 23:50:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5649B2EB25 for ; Thu, 6 Dec 2018 23:50:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4A9A52EB2B; Thu, 6 Dec 2018 23:50:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 030132EB2F for ; Thu, 6 Dec 2018 23:50:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726173AbeLFXuq (ORCPT ); Thu, 6 Dec 2018 18:50:46 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:33910 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726230AbeLFXum (ORCPT ); Thu, 6 Dec 2018 18:50:42 -0500 Received: by mail-pg1-f194.google.com with SMTP id 17so863016pgg.1 for ; Thu, 06 Dec 2018 15:50:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=54Wo/joBzUQUfmFU3PrU1d49R3TsSQp+xuxFIuUaM1U=; b=Cx1MqXyyODo4wGJHo0sk02bm5nrcactfILNHxLmDryNNiqmoYnFwRPOY3YM2Uis7Cr qfGtKuSJqlgYULBCpV46DAqAlxDKjbfgoj/HqRVdcGswT+XXNcB+fqGxTcjCWI+Ev/Ks q/4fAusI4IleV4MCRTcTO3C+88T7X5JO6m2+I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=54Wo/joBzUQUfmFU3PrU1d49R3TsSQp+xuxFIuUaM1U=; b=JsJjF+kH0JNJDA5In4bUDjQqhjWsUEgVgzriQxaoL9DlYSjhd0Ri6cTCcWmCLn9KXT +fssvJdCfnh4FOMPcSTC+8b6NPRWUqwvHPukv+2FHsCJkkDpkOao5ERjaPQZC+AUiDVT NAu/zJlw+SvZubiRKEA48dYp1P7XQ4yYn1B8o9rhCN6ztKyK+l/wccHwl+yNx0hS7yDo iL36cOCawpwZp4mw4Ve1Asz2dR+WjamEOFrh5XRN38GKU/AbNHYVjXzmKe+J1eGoE4tk 26wKUOjdirbiNYsBQYJQ01bwHvG1hyTTqm6ISuSYizsuAdOFNRBxV/yAJtZjTULaECFU SMww== X-Gm-Message-State: AA+aEWbmT9dWolLSj3ovKSGTqbQz3Qh6RQKLatPlD3V4xs63xMyB6TlV NeE7mLFYPt3uT+nLqhT5n40wWw== X-Google-Smtp-Source: AFSGD/ULZCvdfEx3FRYVbDUIabGbXrqkGz1oduwFsSUxo1vfz1ImyWoPUChPDSUnULab+A664EELbg== X-Received: by 2002:a63:9c1a:: with SMTP id f26mr7376328pge.381.1544140241108; Thu, 06 Dec 2018 15:50:41 -0800 (PST) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id r130sm2503337pfr.48.2018.12.06.15.50.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Dec 2018 15:50:39 -0800 (PST) Date: Thu, 6 Dec 2018 15:50:38 -0800 From: Kees Cook To: Shuah Khan Cc: Tycho Andersen , "Eric W. Biederman" , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH] selftests/seccomp: Remove SIGSTOP si_pid check Message-ID: <20181206235038.GA18273@beast> MIME-Version: 1.0 Content-Disposition: inline Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Suggested-by: Eric W. Biederman Signed-off-by: Kees Cook --- 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));