Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4732451pxj; Wed, 12 May 2021 11:57:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKUpOBuDgYJutSxAMuOUt40bCnm+sBaWIK8AxJLI5D4DLi+2RCE3EQtyI8xP/mgl795rPz X-Received: by 2002:a05:6402:2215:: with SMTP id cq21mr2490638edb.28.1620845879767; Wed, 12 May 2021 11:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620845879; cv=none; d=google.com; s=arc-20160816; b=rO9fYmwJXaEVeo3JMW/L+EJ7Emvqb9J4L1GQ5PFy1f+6CqqU/wLRu4KTcN8YipH3Ao WpBoh7MKvNQujvzRybIEGjD2/BHyxtIN/BGsdEaFkR+7SaXnabUKlul7JW/b1rZI5p6n V/PCe3rm3/63JHfWrDZFVRY9Zzb6FCbo//HqTK/ZOW6d5A6GCP0+bKTVTjMdl2FFdDO1 K/I00+5OB5wvA97eMKHz9lI9ZfoKqvO6JTNhKehqRw7bFbuQAwZLfOFcOAP5rAqw1K// NUAIav5cHYn2vyF+Ey6kpP1W8I4BDX/oOukNxqYZKidlpITp+BYIHLX3CRzSb7IeJMSg 5swg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=r+Pgw2JMPDpoYew4GEl/ZApya04IPY5hZrjYFT96tj0=; b=Y8DNAWFd8DImMSvAO43HYj2AsheYQ6lVbMhYOijKujhjY50lkAZ5IAZr8Ca8GxTIsA zYcgZ9ly2wdI11LWFxkkf0Bm0BE9e7H5FQozbF6AGflc95QxBXk8yzFfS0zpzN96Zhv9 ZMNdPTINFQoVpsod8y0upeC5CU4qrYmjOCD06RinWeU/JqUFx0fi8yDAvMqnDjpdyKf6 QPldWw236IGrKTT9UnLviY7NfeX9lWB0GSmH6c1zLlSsPEQsxYfFondD5MsCaR5kPeLJ zNUimFfxgWB7a8/Lq5ps92rUhNYMPrW5utCA7Bsy1I3ZlooExHcxgaxTfXWzUUAIIDN3 zutQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uwYHIVM3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d16si660284ejr.667.2021.05.12.11.57.36; Wed, 12 May 2021 11:57:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uwYHIVM3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358853AbhELSum (ORCPT + 99 others); Wed, 12 May 2021 14:50:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:35912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243783AbhELQmE (ORCPT ); Wed, 12 May 2021 12:42:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7B4E561492; Wed, 12 May 2021 16:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620835617; bh=2hmU/K97aWCxtPtWnmzimhMDLMZndpsROIC7w6g7Y9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uwYHIVM3GFECA+ink/8QCTIDnbcXbIyr34jiuoeapLEw1yjZrzasGyq/P/wahZ9s2 MWTl2/wRW3ypUVT/AGZEoFaS1qr4p3d4kUO2sU4+8/3sJPqDxXOa3LPLCFy2Qmvj3f vvH2FjQ2s4jThI5o7YLGbxVFz243n7SJ+XK+KAZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kenta Tada , Kees Cook , Sasha Levin Subject: [PATCH 5.12 381/677] seccomp: Fix CONFIG tests for Seccomp_filters Date: Wed, 12 May 2021 16:47:07 +0200 Message-Id: <20210512144849.995701021@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144837.204217980@linuxfoundation.org> References: <20210512144837.204217980@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kenta.Tada@sony.com [ Upstream commit 64bdc0244054f7d4bb621c8b4455e292f4e421bc ] Strictly speaking, seccomp filters are only used when CONFIG_SECCOMP_FILTER. This patch fixes the condition to enable "Seccomp_filters" in /proc/$pid/status. Signed-off-by: Kenta Tada Fixes: c818c03b661c ("seccomp: Report number of loaded filters in /proc/$pid/status") Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/OSBPR01MB26772D245E2CF4F26B76A989F5669@OSBPR01MB2677.jpnprd01.prod.outlook.com Signed-off-by: Sasha Levin --- fs/proc/array.c | 2 ++ init/init_task.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/proc/array.c b/fs/proc/array.c index bb87e4d89cd8..7ec59171f197 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c @@ -342,8 +342,10 @@ static inline void task_seccomp(struct seq_file *m, struct task_struct *p) seq_put_decimal_ull(m, "NoNewPrivs:\t", task_no_new_privs(p)); #ifdef CONFIG_SECCOMP seq_put_decimal_ull(m, "\nSeccomp:\t", p->seccomp.mode); +#ifdef CONFIG_SECCOMP_FILTER seq_put_decimal_ull(m, "\nSeccomp_filters:\t", atomic_read(&p->seccomp.filter_count)); +#endif #endif seq_puts(m, "\nSpeculation_Store_Bypass:\t"); switch (arch_prctl_spec_ctrl_get(p, PR_SPEC_STORE_BYPASS)) { diff --git a/init/init_task.c b/init/init_task.c index 3711cdaafed2..8b08c2e19cbb 100644 --- a/init/init_task.c +++ b/init/init_task.c @@ -210,7 +210,7 @@ struct task_struct init_task #ifdef CONFIG_SECURITY .security = NULL, #endif -#ifdef CONFIG_SECCOMP +#ifdef CONFIG_SECCOMP_FILTER .seccomp = { .filter_count = ATOMIC_INIT(0) }, #endif }; -- 2.30.2