Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp120796imm; Thu, 21 Jun 2018 15:06:00 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJL/i2nkwCBNTU/4fBHnvA/KE/SgNNJaw+8Q314Kfk/20h8JAqhJ/zXLxn1PlXWHysh7WhA X-Received: by 2002:a62:3a59:: with SMTP id h86-v6mr29280853pfa.209.1529618760391; Thu, 21 Jun 2018 15:06:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529618760; cv=none; d=google.com; s=arc-20160816; b=X/uq3PJ2Y5VhzvxPekItv9TF9vrXcNjnQsyyLPnVHpowAL34j5kVKqSXZB9PG67gtF 2/F2rv63rHoms4aHo0qxtXeLGANjrzELayRvpBGomWL1aGQYBFldN7hIh2BVRtLvmIEZ NFaYAwhBFUrfZ1yhSD7ToQ7skN58ZNmV1T+ObJbV+4jsL80jr0jHQrnfYOvPuICa2rcu 6FxeFyiuVQzRsXvbqvSoMOtFgws8VzU1tYReg5agKoozYRbvWp1YoDya2eY7vZRQX2sA xQa6894p+96Fxhc2b5ld+WpSNdkVBk5BCoMcGog3AuQA5xjqW6tXEP3kMklffeK8VonJ svMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=PsmeKqHoGCAX8hCCZKW5Vb0YycjOyzLqBbvuDEprP7A=; b=HQFZywok1v9A53Al5MNxKN6mZyfvbyGVfprppC1vIpXDQFQjIjFZtqX5pamcvkYSwu H87EW7ItlmDtTmMkMpyQ1OB9I1NUyskR9qTyxHMkxuVdDgD5aG0L2phxX5WC87wVu5wC 5QfIGp00cIrmvHvi1SXAt4LE91c5yaR6AJMD4+1/MY8oBKiOIp08Np6Ey//Rs0zSdU5n G6JpN7Ga40//9ayxPRyoK/jclvBYszIUsDQ2zj1pCHso81tlpZzBWUEbmn4ZTfGvIWNR gV34NMKdjOhoejdMokJliZwHxH315iXfqxS69Z4CPbNvIewQmLCQmYAYmUYqGCHIoFU8 8vxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=JUmYgiMw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l65-v6si5673302pfl.155.2018.06.21.15.05.45; Thu, 21 Jun 2018 15:06:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=JUmYgiMw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933908AbeFUWEy (ORCPT + 99 others); Thu, 21 Jun 2018 18:04:54 -0400 Received: from mail-qk0-f194.google.com ([209.85.220.194]:35251 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933854AbeFUWEq (ORCPT ); Thu, 21 Jun 2018 18:04:46 -0400 Received: by mail-qk0-f194.google.com with SMTP id d130-v6so2681005qkc.2 for ; Thu, 21 Jun 2018 15:04:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho-ws.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PsmeKqHoGCAX8hCCZKW5Vb0YycjOyzLqBbvuDEprP7A=; b=JUmYgiMwrxsr4f5ASogusQ4Z8gE/eSkXqxdXni/GmJ4orVIbomiQGpzqUF0W5UWmLo hwChL4m/v/Hd/rrZnJVE569OAn7D9O7GRk8afpatO3GbYLzvAY1D9urie0MdGJOnPlpt /oj/GAZJgoECRotd1LHtWsvJ+j6fF0c5aSOQ7fwkA1yJFARtpZYuibC7GBM6ToKLDzCw Mw+srCzHYTJsKi/NZq6muhVRKD1qEJ1pu0Jb82eydiX67fv0jIKfSuCTIkoawgtw+B03 IFMgsqY+/KHVeX7g+QuJ5gYhWviKwqb8VlFhlhnE9T9wnMPvZtLD4tY/ZdFYzU3ZUkL+ pxzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PsmeKqHoGCAX8hCCZKW5Vb0YycjOyzLqBbvuDEprP7A=; b=ietPHHnI1m47l0pz0fDiGHNKBV5SFivjFpLUWAM8ibc/sehEwx/6L2WNWFFDQk3vTl X6DMNM7jM6nGBjDVGM7TujeG3Gjd1LJowYfWvqLcz4U1vAbCHOu4TlJqo3YMuFAMJyM5 jGO3NBFl6F+mxr4owP9/1B1ueHO9f6s2j0CfJimyvrGnytcmzaYYaMV3wS+tkMfEWwhx Vo5XUJ0f/Qx5msMdP2EmXFzcEn9sAACCYkaEBbK3LMEDSAbBMmzEyXwfJYoU6fB3GzPB 0rfDlWduXJ7ivZ+5sRmaU536qFeDrj0aITemOTEIQb+MRx2vXyomLJaiHk7Ryhtj7h+M gbfA== X-Gm-Message-State: APt69E35x80Xc4eIk6+xD3bwEF94DGTq288Pwl3gUNXhc3l7TfaA5r0q bT0+v573eh8iQOiIWHnQHzTCO4Khr9w= X-Received: by 2002:a37:15aa:: with SMTP id 42-v6mr3344405qkv.428.1529618685788; Thu, 21 Jun 2018 15:04:45 -0700 (PDT) Received: from localhost.localdomain ([173.38.117.67]) by smtp.gmail.com with ESMTPSA id l73-v6sm6668473qkl.78.2018.06.21.15.04.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jun 2018 15:04:44 -0700 (PDT) From: Tycho Andersen To: Kees Cook Cc: linux-kernel@vger.kernel.org, containers@lists.linux-foundation.org, linux-api@vger.kernel.org, Andy Lutomirski , Oleg Nesterov , "Eric W . Biederman" , "Serge E . Hallyn" , Christian Brauner , Tyler Hicks , Akihiro Suda , "Tobin C . Harding" , Tycho Andersen Subject: [PATCH v4 2/4] seccomp: make get_nth_filter available outside of CHECKPOINT_RESTORE Date: Thu, 21 Jun 2018 16:04:14 -0600 Message-Id: <20180621220416.5412-3-tycho@tycho.ws> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180621220416.5412-1-tycho@tycho.ws> References: <20180621220416.5412-1-tycho@tycho.ws> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the next commit we'll use this same mnemonic to get a listener for the nth filter, so we need it available outside of CHECKPOINT_RESTORE. This is slightly looser than necessary, because it really could be CHECKPOINT_RESTORE || USER_NOTIFICATION, but it's declared static and this complicates the code less, so hopefully it's ok. v2: new in v2 v3: no changes Signed-off-by: Tycho Andersen CC: Kees Cook CC: Andy Lutomirski CC: Oleg Nesterov CC: Eric W. Biederman CC: "Serge E. Hallyn" CC: Christian Brauner CC: Tyler Hicks CC: Akihiro Suda --- kernel/seccomp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/seccomp.c b/kernel/seccomp.c index 24949478a812..bbc24938c51d 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c @@ -1184,7 +1184,7 @@ long prctl_set_seccomp(unsigned long seccomp_mode, char __user *filter) return do_seccomp(op, 0, uargs); } -#if defined(CONFIG_SECCOMP_FILTER) && defined(CONFIG_CHECKPOINT_RESTORE) +#if defined(CONFIG_SECCOMP_FILTER) static struct seccomp_filter *get_nth_filter(struct task_struct *task, unsigned long filter_off) { @@ -1231,6 +1231,7 @@ static struct seccomp_filter *get_nth_filter(struct task_struct *task, return filter; } +#if defined(CONFIG_CHECKPOINT_RESTORE) long seccomp_get_filter(struct task_struct *task, unsigned long filter_off, void __user *data) { @@ -1303,7 +1304,8 @@ long seccomp_get_metadata(struct task_struct *task, __put_seccomp_filter(filter); return ret; } -#endif +#endif /* CONFIG_CHECKPOINT_RESTORE */ +#endif /* CONFIG_SECCOMP_FILTER */ #ifdef CONFIG_SYSCTL -- 2.17.1