Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2536564imm; Thu, 27 Sep 2018 14:42:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV61pHmBLAygRArRZ+CFcnPBDJcwn4PxkEkY5rs9RZmTcsQ5ouWLvLlvo1prWx2WQN1Hb9quu X-Received: by 2002:a17:902:7142:: with SMTP id u2-v6mr13276488plm.154.1538084559916; Thu, 27 Sep 2018 14:42:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538084559; cv=none; d=google.com; s=arc-20160816; b=MjVlBm6IGIbwluk/Usa1ezV75rven4yCc5gGuUrHNV43OQlQC+Yqev0KV/29U3sU0c 4OmcCZ0CUQvmO8yFG5FUEM41QuZzt1Lj0ow6AAIHB7dvEmKC/tOyEfl7S28LoCUB+Y0L apzi5FbkNllSutJF2SCKMUGwvkhtYowY0OmAs/4+Kqf8o1RoSENChtVDMIKNvX1uK5Qv aNHmOrujW4JJU3+vUfb5rNbbOpeS84xsCZuve3D4RA8xbeP74SlqIXqW3tVfVGlYXDyD 68JTKDU43d31E7ltGXaFG+CNuQmt+kySEecUGpRM76ZJhOiveLU4szmr8kgxbWwmzsr8 gJSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=DthDTGdMLTcGhr9eBo4H5+DKllqHMisL3jYtwX7sWUk=; b=Uc/Kn2aV2VQPthRiSS209csBeoqvYOHqIIA2t1Px9zSJBR57aNfh3+7hYyhnMunzs5 oJILKIzBFduPZ9D1d/BxDrEMzQIwfCcL840uQ/YP9vJ8T9qHfUCEcJ49gZwy8642dSPC NR7QFdewAGD/zcK60zuZ2O0THMZoe5934I3UNuu6MnEVmIl4EoaA6+g3Q/dC4O6IdIJB D5w4u7geSYkfVigJUaxJ5lMG2eHFulS0R6tydKve1IHOvEPO9S1nZ0qcn6/2QChBBWIx 74lVnzmFfSqD1PXVQUFLJs6hWsswTfexw7srJ/xouXGNgPReRFY8C9+MirpR+suvV1Nc fXig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OpuENIgJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i64-v6si2965813pge.391.2018.09.27.14.42.23; Thu, 27 Sep 2018 14:42:39 -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=@chromium.org header.s=google header.b=OpuENIgJ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726130AbeI1EC0 (ORCPT + 99 others); Fri, 28 Sep 2018 00:02:26 -0400 Received: from mail-yb1-f195.google.com ([209.85.219.195]:39397 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725727AbeI1EC0 (ORCPT ); Fri, 28 Sep 2018 00:02:26 -0400 Received: by mail-yb1-f195.google.com with SMTP id c4-v6so1781171ybl.6 for ; Thu, 27 Sep 2018 14:42:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=DthDTGdMLTcGhr9eBo4H5+DKllqHMisL3jYtwX7sWUk=; b=OpuENIgJhpy1iC0U2Ws/eK6ttY9NoZU8/aQ04C4CSt2qZ0bmHn3m2A2Ogc1ER3Mu9P KAUvs9n6nN3Q45IqRz6ZtHSLdKCkDzXlMGBYFm4BzW6eW/qPeQmxL3jlwyenmwZ2xCYH 16BLZCnQpQ/WbiYKTTvacCRiHs6mugbgTmCG4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=DthDTGdMLTcGhr9eBo4H5+DKllqHMisL3jYtwX7sWUk=; b=dsUv6h2X5PEHOBcp2pkQgAkojMnr4l2UnsqTl2pk9yRLeAn1EvM6S+G3JLcIH1fTfu SaBiUY9jkFDV4fvU/u6fpDHjOjRrSURlCnlRBx6BPpUO5Jt+1ZyXbNH3TFFDTw4HtGct qSg9X2Miltfyd4ECFJyCzlG18sz0UrVp+a/7KkY9KgR8L9Ea5u5+9AWKUVAOqGJuRBni LoX13TTf0QR8ZTkFwOf/ztMo7Qqsgijd7KI3phhRiQq6MsiV6D5p9e+RDzsJa/tFtKnA FNJQ4y5bV0qOpL5n9BBUyIXnKG/3+GZD6kSV17s4Ip2w3Yvg98bNSH+cmfwiDQvMdXkv x85A== X-Gm-Message-State: ABuFfojPrpXagQ4F26fsOusqM/cEvfMBdofNTx/8gxeMaILLq3ZbQgEy gJsWYUEJUsiJc/8OXSZSNk4Q3bgNGpE= X-Received: by 2002:a25:e90b:: with SMTP id n11-v6mr6848461ybd.456.1538084526397; Thu, 27 Sep 2018 14:42:06 -0700 (PDT) Received: from mail-yw1-f42.google.com (mail-yw1-f42.google.com. [209.85.161.42]) by smtp.gmail.com with ESMTPSA id p190-v6sm1192878ywe.83.2018.09.27.14.42.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Sep 2018 14:42:03 -0700 (PDT) Received: by mail-yw1-f42.google.com with SMTP id y14-v6so1758675ywa.4 for ; Thu, 27 Sep 2018 14:42:03 -0700 (PDT) X-Received: by 2002:a81:2288:: with SMTP id i130-v6mr7145484ywi.288.1538084522922; Thu, 27 Sep 2018 14:42:02 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:d116:0:0:0:0:0 with HTTP; Thu, 27 Sep 2018 14:42:02 -0700 (PDT) In-Reply-To: <20180927151119.9989-3-tycho@tycho.ws> References: <20180927151119.9989-1-tycho@tycho.ws> <20180927151119.9989-3-tycho@tycho.ws> From: Kees Cook Date: Thu, 27 Sep 2018 14:42:02 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v7 2/6] seccomp: make get_nth_filter available outside of CHECKPOINT_RESTORE To: Tycho Andersen Cc: LKML , Linux Containers , Linux API , Andy Lutomirski , Oleg Nesterov , "Eric W . Biederman" , "Serge E . Hallyn" , Christian Brauner , Tyler Hicks , Akihiro Suda , Jann Horn , "linux-fsdevel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 27, 2018 at 8:11 AM, Tycho Andersen wrote: > 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 in the > USER_NOTIFICATION case as well. > > v2: new in v2 > v3: no changes > v4: no changes > v5: switch to CHECKPOINT_RESTORE || USER_NOTIFICATION to avoid warning when > only CONFIG_SECCOMP_FILTER is enabled. > v7: drop USER_NOTIFICATION bits > > 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 fa6fe9756c80..44a31ac8373a 100644 > --- a/kernel/seccomp.c > +++ b/kernel/seccomp.c > @@ -1158,7 +1158,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) > { > @@ -1205,6 +1205,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) > { > @@ -1277,7 +1278,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 Yup, looks fine. -Kees -- Kees Cook Pixel Security