Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2719731ybk; Mon, 18 May 2020 06:26:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwM45AGe6cD1PcuIkKyUdVXZcqcxmtcE9RMkMoRmHbXkUfTxoLN70DO5PGr9Hl+yAbHGzfw X-Received: by 2002:aa7:cad3:: with SMTP id l19mr14163518edt.335.1589808377948; Mon, 18 May 2020 06:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589808377; cv=none; d=google.com; s=arc-20160816; b=hZC+p1Q/asIHuTWaFaR6Q4ROjasD2MC/zHCmtgxAdxa/DyMSFDinJ/BKaDcat+q1MD vzDeHOqcq1da83lLXTWs12qFK8PSGL8U7WHj/M47wsfwiK6hcrIon10dDN1GhVUmaB+B SI0ZPG7ICsIg1cvWLpTVG186DonJ72JheS4phqc6Vbzt5F4s1Lhkd++C8CSznrSp+3rZ SIRoU+P7USUgUlrqJlemcle/PtZOC5M3gS4TNqUXm8PVrE7WQiERLnqEvO6kMFYvlyrs hMCuun/UE/qhgn1FR9ejXyvPFW9VQf6GKasN3ebNSbX4ZRPo4Sh/VBwOshUIyzahHN5J 5dPw== 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 :dkim-signature; bh=fgpdOynF6cHr+f7BfLRTcoqsZLiHJjSZb3oyMsov/Ak=; b=y9Faz1yJlIeIOz0GXa4pkegiAvApi8u85ulFJQnUjisZIfzqcw5dmPvLFua8agi0Ry 5FHLuI9OVdqEgH1lufxLdE5xO6jkhgqgSgTWqdjBxu0zFxUZxn6o2BsJ2tVvYU/ySvZe jxr72ho/0yrbUwLpAfpmovBeCpmsPHbFzYY8IClaMU3ZFszDIiGjGGco1KmMS6mXmec8 wMYV8TKRhSwQR05WV4Fd+aY7ZS1Asxgv9PcM64hNjT96yGS4Ax1sYJ7/LR9LzZ703xGu dAmPTAw0awJosMg9Ba89c5iqXrq9S42sE0JQ1g/MlqPVrh3W0hQl9aWPyl/m6VQZy3I5 Rv7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=JLuJ5EyJ; 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 j2si5953321ejs.531.2020.05.18.06.25.54; Mon, 18 May 2020 06:26:17 -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=@tycho-ws.20150623.gappssmtp.com header.s=20150623 header.b=JLuJ5EyJ; 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 S1728109AbgERNUl (ORCPT + 99 others); Mon, 18 May 2020 09:20:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726872AbgERNUk (ORCPT ); Mon, 18 May 2020 09:20:40 -0400 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D9D6C061A0C for ; Mon, 18 May 2020 06:20:40 -0700 (PDT) Received: by mail-il1-x141.google.com with SMTP id e8so9739119ilm.7 for ; Mon, 18 May 2020 06:20:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho-ws.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=fgpdOynF6cHr+f7BfLRTcoqsZLiHJjSZb3oyMsov/Ak=; b=JLuJ5EyJnmImXOc3M2tKKSPI6B+PcA3dWkQ4oWB1yJLUGsMbea2I99AQvsy6jxwBcQ qNVhv6uqiP7/IC/qmcMSzpxqKau1sUzKlPuU+R9xvDB32WwKbCBYIXx2Uui6PbMev5m+ Qv9O7KKI4REUBmO8NdXYlPh3q0kt6I64aefaM6irfkREpk1yB85ScH3gsX/icETPRC9S 8R27qEENMhVWyXW0HjAvVl2VcYhagtg31vqk1rp3KgZ86NCcF5PjCSwKYR8a1VnZM0ax hhjfEaxGek1yFrzCSuPtOnTSkK4AN0ImEr3mGaeQJ83SsDA88BOOID+LscKjXhkE5ksB Nd/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=fgpdOynF6cHr+f7BfLRTcoqsZLiHJjSZb3oyMsov/Ak=; b=X5d/++Bi+f0W/Ubf8Kcu0k/TtcGnEazLuTaEoSq8ZNinxZzo4+Z2vMpqnaSKEY+Trk +yLQdAbehBD9msFae3F0S9mRltQbF2JYbJHqhNbq1rT1+kxejTcLqRswRYxhIjSZ9HZr faD+7bu+01RUdSTFfViST2TSqoBZjv0IFpr/29qpqbNnrdtZVU6SEWYiYQTtF2m/Edmu rcZvgUKWBq5Cyl9DhcfWx3Ski770TxpXss9beQUpazX7iWMGYPmwFD6oWToxsYifKfK6 OBTxquuvuwQ/DjcsHn3Y5vF0zxQJNw9RNUq06irZh9wq5umIVUhcidA+ZZjRg2N9xgZN OOJA== X-Gm-Message-State: AOAM531KgTsXFa4r5PYhg7GmwvBLa3E01MVZmrf0vY/rXYavYAtWN0yw baucpFEzdItXYpTGEAjicmnxFg== X-Received: by 2002:a92:507:: with SMTP id q7mr15605515ile.150.1589808039529; Mon, 18 May 2020 06:20:39 -0700 (PDT) Received: from cisco ([2601:282:b02:8120:6155:7c8c:3dc0:c56e]) by smtp.gmail.com with ESMTPSA id y12sm2715736ilk.16.2020.05.18.06.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 06:20:38 -0700 (PDT) Date: Mon, 18 May 2020 07:20:38 -0600 From: Tycho Andersen To: Christian Brauner Cc: Aleksa Sarai , Kees Cook , 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: <20200518132038.GA2405879@cisco> 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> <20200518125325.l2lpixp3ch7zuiwx@wittgenstein> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200518125325.l2lpixp3ch7zuiwx@wittgenstein> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 18, 2020 at 02:53:25PM +0200, Christian Brauner 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; > > }; > > > > ? > > Oh yes of course, sorry that was my stupid typo. I meant: > > struct seccomp_notif2 { > __u32 notif_size; > __u64 id; > __u32 pid; > __u32 flags; > struct seccomp_data *data; > __u32 data_size; > __u32 new_field; > } > > at which point things should just work imho. Are you saying that data_size is an input? Because I don't think they Just Work otherwise. Tycho