From patchwork Thu Aug 20 09:19:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 265355 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92E01C433E1 for ; Thu, 20 Aug 2020 13:05:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 67168207DE for ; Thu, 20 Aug 2020 13:05:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597928717; bh=hxnkYDokfMdzD7JcjugJExZde+jyPY1bN80LzIM4ZMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=KcLI2tX1tZVwIzNawFsFrFw+LOH+S33WO8ZSxwAdhD2InP6+XT756N5wgkGFrfTU/ psLIyaIO3mYvp5/GCZE6HDLOsTBvzQbYUq3Trr/ELrSFGuvfHlpnCOTZHLTWYKyj7m RI1VWVO/jKM+T5i7MC+phQKoh3pvOM7hrU1snUZ0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728944AbgHTNFJ (ORCPT ); Thu, 20 Aug 2020 09:05:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:57774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728934AbgHTJjG (ORCPT ); Thu, 20 Aug 2020 05:39:06 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1CC15207DE; Thu, 20 Aug 2020 09:39:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597916346; bh=hxnkYDokfMdzD7JcjugJExZde+jyPY1bN80LzIM4ZMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GRkWixXCdgpsKk3HiNQW0dT0JAvfdC6wg5gowj+Lv56DSml6T8yEhvmqI3PhZU7so VoUDtbhl4zxNjXwDosXKYYy75whvcrnnaV5/hFRXMCFTRPDy/u8xvdVNFS9CQHAUWB PF1sy0JHecwG28yG67QFO9sZEf7y4TGNImZ//QDI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tycho Andersen , Kees Cook Subject: [PATCH 5.7 057/204] selftests/seccomp: Set NNP for TSYNC ESRCH flag test Date: Thu, 20 Aug 2020 11:19:14 +0200 Message-Id: <20200820091609.117503211@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091606.194320503@linuxfoundation.org> References: <20200820091606.194320503@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kees Cook commit e4d05028a07f505a08802a6d1b11674c149df2b3 upstream. The TSYNC ESRCH flag test will fail for regular users because NNP was not set yet. Add NNP setting. Fixes: 51891498f2da ("seccomp: allow TSYNC and USER_NOTIF together") Cc: stable@vger.kernel.org Reviewed-by: Tycho Andersen Signed-off-by: Kees Cook Signed-off-by: Greg Kroah-Hartman --- tools/testing/selftests/seccomp/seccomp_bpf.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -3257,6 +3257,11 @@ TEST(user_notification_with_tsync) int ret; unsigned int flags; + 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!"); + } + /* these were exclusive */ flags = SECCOMP_FILTER_FLAG_NEW_LISTENER | SECCOMP_FILTER_FLAG_TSYNC;