Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2231863ybk; Sun, 17 May 2020 14:35:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVwVUhGzmlZ/vKshcYFc96fSmq6/yE6vonBfaHePWsBWxDgJqpRFwwD0sz/l926NuDhpCW X-Received: by 2002:a05:6402:c84:: with SMTP id cm4mr10685342edb.316.1589751303750; Sun, 17 May 2020 14:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589751303; cv=none; d=google.com; s=arc-20160816; b=P9EnFRXgHy4xgThFqV6W+N2xWqZegEAUVbbyIqLqYaKoj7rCA3khSjC9HXL8Jh9pI3 AAvuLbKnqFhpBywQ3wIRUwnOsX9WuaH8WdaQYe0nPR4bKdpFnsGi0xgsMG+jAZs+xahU xK8HsmV1ushtaAhe//m+n6NXEzDEyaVp5VU8D1NCCdPHKYnMS5uLVC7OqAirLJxN1rqW 29/uPkdRzeb4QEd1y5eUuCF2zeUMqtU6NTLkwu/7mzyEp1L/Qzd1Hqq7jhhHnLHDgtEs +SpwfAm7ZkPDn534+qpHER1dGlLzG6CXMKXvmUEEzQ/HxybFi3zEwZ4SdcM1YLcbnc2u BdGw== 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=Nl1jPUv4ba/yAtewxEYF9Vx5ehHzan7FcPOetz1sGxI=; b=cHJSHcbdBjeiBM9kIzswZQsy9kvrqAODhJS4v4unKmhx2+GQfywEtCNQOpiyzlr3Wb qFEObfsSTB/sBcsQW9TK2yfy9D3L+hYbd4wRzkKT3j5UCJUaHAy7bbsrQIh3PpGslU2M yUCEKIrPc7/RBaNx1pnK31aGDlwqLW3diCgcHOVEUDTkp08EBjBlxWuZxe6c7vzdq9iV jU01jN906RW+Fwileh5Ke6zTyr/37Zyr5lrrGuDgMdzFFBN5Sh7+Key/KqaGNvdojWj8 BLP9GxwBIQUzsgojZxynZttqjD+4Tyfcb3AJyJzk8wc0ZBdE/yw3kL6kaiYooflVpw9a v3NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=clGboMqE; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f25si5431482ejr.12.2020.05.17.14.34.40; Sun, 17 May 2020 14:35:03 -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=@chromium.org header.s=google header.b=clGboMqE; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726670AbgEQVbC (ORCPT + 99 others); Sun, 17 May 2020 17:31:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726458AbgEQVbC (ORCPT ); Sun, 17 May 2020 17:31:02 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA654C05BD09 for ; Sun, 17 May 2020 14:31:00 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id b8so3833252pgi.11 for ; Sun, 17 May 2020 14:31:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Nl1jPUv4ba/yAtewxEYF9Vx5ehHzan7FcPOetz1sGxI=; b=clGboMqEVH0oyyAstusWn9pLsPGuJI2qTXOqf/fLKtmNWoo8PU8U4KP2i1KZsbuaVt ZVGmYLRPYusSG7WQp27LnGotSSiVFtdWBjg36zFTERbOW+EMPqf6y69jWaRLHHT/vias cVIIdpg0UDwKIC22zDZF7idLsYnz1Rns+G0xQ= 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=Nl1jPUv4ba/yAtewxEYF9Vx5ehHzan7FcPOetz1sGxI=; b=UqhQRdOxepogutGZj+9FK+wRtrYYK6zoil+9G7FTeHO0/kePu1uONW2KWi8KJNWIhM YzrohQHViGVxMKG4t3mnw5APxjJD/QZIxWWZCQpJ7M45jCrL33DMZSntW71f2npYAFXa p7n/pMLqhHrMzsJxEbV7QHs+grJKDo3y53w1havr+ndZQaE/ZHWv6KE7CTsi9lGKs44O ErM8EhU+xoVQm//BTFv8ysuhQF2pmFM6XIZcbR13Wg26UQWmXrGgSIGc38EA9gq9aA13 ojgv6cAZLluJaUe8twLvR/8haSpdNGiWXnkBV8pem4P/TrlDNlzO7EhzZHP9Zu4TqUPB L6LQ== X-Gm-Message-State: AOAM533EodS41jyC24Bks2cQEeWgYvkp+a8EjG2IhHCXD72wP1dGzT1o hAJoV0Qxn3pifiGyJ4BwZB4lV1/dtYA= X-Received: by 2002:a62:6041:: with SMTP id u62mr7558083pfb.62.1589751060296; Sun, 17 May 2020 14:31:00 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id b74sm6106085pga.31.2020.05.17.14.30.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 14:30:59 -0700 (PDT) Date: Sun, 17 May 2020 14:30:57 -0700 From: Kees Cook To: Tycho Andersen Cc: Christian Brauner , 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: <202005171428.68F30AA0@keescook> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200517150215.GE1996744@cisco> 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 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.) 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. -- Kees Cook