Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2667530ybk; Mon, 18 May 2020 05:09:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyerl+F0b8FldXHS/3iE7yhc2RInZB6AFyarNVzUENIvTBvQIoAaZoWz76wzPQ3/Twn3fdz X-Received: by 2002:a05:6402:154b:: with SMTP id p11mr13374706edx.355.1589803766477; Mon, 18 May 2020 05:09:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589803766; cv=none; d=google.com; s=arc-20160816; b=NbzWOokAE8aAMTo34KSThE0w+Kw/JBusRmTSNV9/ixAw40Aw6XF7vIT9hAO2bE0OFv PMrejE7qCr042xq9AEHQu/dNnYST5LdqOk3Dk5ctIDYnUzV+fu54n42PrsdUjhwQDKxC F5x93+hC1KPWR3vAzZwbPZsXOHxTzjMcCqCgzEwUJ0rY10Ra2Gfy6ItRQe3u/nKscRJa eFNcfEHbuoY4a+JFtO17NH9gx96fxvuGXTd8IDl4s33vS4wSxYMlhPm3n1QK4Vi2v03e Tb/K54dm+8gjWrcm3W+7Caeai5YI8xtBDRYhHeOZdMczAaIC32k8dCV70CWcqAJ1bWvj 0a8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=iA+7gsw8mqNwbcIrqxgQe4LmX6jsvww3c+zpknnQfJ8=; b=M5iqOn65DCPHfT0lTUb39soh6AvTBtQ79AhE491ma7LFU8kN0wC4XllsVrbd4ipSYN yivNrD142ZMrFXToFnfT0iG6TDZFA4kJRWnoMzEtQSFc5uc81ABiJzATwIPpWp4qZEls CNxULZkG/i6bHuvT8BlMsL8DxwmMwUhvtXRwfzVHzhwxkin3qaSCx1vEVHuJxMUQPGxI +sh075+k4CQzo2khqaDiwhdPxVkIX7MPGmlxp9tRtuy92HCf86IDbmgSz1JLQ67YUegy GKWO4x++LQhmhDB87skuHeLw5H6L5EYaRcjUzBPhv3sEw4XiZH9WLNFgQeoZ5EMSyf5g dN5Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t26si6114254edf.183.2020.05.18.05.09.02; Mon, 18 May 2020 05:09:26 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726957AbgERMFt (ORCPT + 99 others); Mon, 18 May 2020 08:05:49 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:58287 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726448AbgERMFt (ORCPT ); Mon, 18 May 2020 08:05:49 -0400 Received: from ip5f5af183.dynamic.kabel-deutschland.de ([95.90.241.131] helo=wittgenstein) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jaeWg-0001cL-9J; Mon, 18 May 2020 12:05:46 +0000 Date: Mon, 18 May 2020 14:05:45 +0200 From: Christian Brauner To: Kees Cook Cc: Tycho Andersen , Aleksa Sarai , linux-api@vger.kernel.org, containers@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] seccomp: Add group_leader pid to seccomp_notif Message-ID: <20200518120545.w7fgyq56gwzzcdrf@wittgenstein> References: <20200515234005.32370-1-sargun@sargun.me> <202005162344.74A02C2D@keescook> <20200517104701.bbn2d2rqaplwchdw@wittgenstein> <20200517112156.cphs2h33hx2wfcs4@yavin.dot.cyphar.com> <20200517142316.GA1996744@cisco> <20200517143311.fmxaf3pnopuaezl4@wittgenstein> <20200517144603.GD1996744@cisco> <20200517150215.GE1996744@cisco> <202005171428.68F30AA0@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <202005171428.68F30AA0@keescook> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 17, 2020 at 02:30:57PM -0700, Kees Cook wrote: > On Sun, May 17, 2020 at 09:02:15AM -0600, Tycho Andersen wrote: > > On Sun, May 17, 2020 at 08:46:03AM -0600, Tycho Andersen wrote: > > > On Sun, May 17, 2020 at 04:33:11PM +0200, Christian Brauner wrote: > > > > struct seccomp_notif2 { > > > > __u32 notif_size; > > > > __u64 id; > > > > __u32 pid; > > > > __u32 flags; > > > > struct seccomp_data data; > > > > __u32 data_size; > > > > }; > > > > > > I guess you need to put data_size before data, otherwise old userspace > > > with a smaller struct seccomp_data will look in the wrong place. > > > > > > But yes, that'll work if you put two sizes in, which is probably > > > reasonable since we're talking about two structs. > > > > Well, no, it doesn't either. Suppose we add a new field first to > > struct seccomp_notif2: > > > > struct seccomp_notif2 { > > __u32 notif_size; > > __u64 id; > > __u32 pid; > > __u32 flags; > > struct seccomp_data data; > > __u32 data_size; > > __u32 new_field; > > }; > > > > And next we add a new field to struct secccomp_data. When a userspace > > compiled with just the new seccomp_notif2 field does: > > > > seccomp_notif2.new_field = ...; > > > > the compiler will put it in the wrong place for the kernel with the > > new seccomp_data field too. > > > > Sort of feels like we should do: > > > > struct seccomp_notif2 { > > struct seccomp_notif *notif; > > struct seccomp_data *data; > > }; > > I'm going read this thread more carefully tomorrow, but I just wanted to > mention that I'd *like* to extend seccomp_data for doing deep argument > inspection of the new syscalls. I think it's the least bad of many > designs, and I'll write that up in more detail. (I would *really* like > to avoid extending seccomp's BPF language, and instead allow probing > into the struct copied from userspace, etc.) It's great to hear that you're on this. I haven't had time to work on this since our kernel summit session. :/ And so far, I really like what I hear. I had the same general thought that not extending seccomp's bpf is what we want. And to stress this again before the mails come flooding in: we really need this in seccomp itself not in any current or future LSM. :) > > Anyway, it's very related to this, so, yeah, probably we need a v2 of the > notif API, but I'll try to get all the ideas here collected in one place. Cool, I was kinda worried that people would think that's a crazy idea but I really think we're better off with a redesign. And I think that's totally ok and cleaner than hacking around it. Christian