Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp836426pxj; Tue, 18 May 2021 15:30:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyP8m0rO1lZEBG4MYuaxtCLtS79O8PP8u39I7YlifQ2UU015Gemh8nopgsdnc+qiK7zIuGy X-Received: by 2002:a50:f689:: with SMTP id d9mr7470161edn.197.1621377053576; Tue, 18 May 2021 15:30:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621377053; cv=none; d=google.com; s=arc-20160816; b=fsbSV6zxnbS6CiM+VlLjqdBQwfqq7EPNl9CsQ2uJbRu3caqMfrmx8nFZasM30vdetn 0UGfLa5mGA7m1EC+vHyWrpk/uFE6alPWoomMAnZWrlqdbgmdFlxRaAHEJQV9XHTYC1EP xP2zOjXxFEZ7d9IYSmpeAh8sNRd8mpqzwf740cmCMCgmM0ie+BkAr1wAdlzB0GLWF5r8 AJg52lY1McP+DDKIVXwESA8XXo/iytl11SPDl9R1ewEdsFh+QPclBjeM5lqaix2/ELPy CvmQ0WEZcWqD28FMUO0rT99+e0jTl6m5p+aki9OS6rPVmZS8CPH0aH6mxzMUGMsfepeq /kNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=staAu2NQSD+sUEvD6aPKW7Ph2gmxQzl1MyMLLgSmbIw=; b=ntwHwjt/HuVFYT3S59c80B87RuROY+HHvqvfvEI7WZkksbUjiLb1JCWuGTuS6bZzvt XuuME1fSUNTi8XjZqs0/PlTLNk3EembyD3PyCwx6NCBrKIb4jLcJnfWOp8PDOQvau498 otqgGBzMBObIHbPQ46wPrZiyGUQdkSYDzDONsnuwGrOTMRY1S3nd8rAZFtzIRAp7a1X7 iMrduTrnvyFMmJ3uZ0chuTu0+A3U3Awno2WeO4pNgRh/Sx8ll0JhfrLKqDZnp+hhiLP0 WbX3Rgqc4qwU2WylGc/K7gqmt46JxaFf3s5dI/gO1A4EGsJxGfTqKhFhBb8reo0hrEiZ gBmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tycho.pizza header.s=fm3 header.b=3RDlHGPr; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=QWPTUkls; 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 g8si852438ejj.29.2021.05.18.15.30.30; Tue, 18 May 2021 15:30:53 -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.pizza header.s=fm3 header.b=3RDlHGPr; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=QWPTUkls; 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 S243883AbhEQSMj (ORCPT + 99 others); Mon, 17 May 2021 14:12:39 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:52837 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236884AbhEQSML (ORCPT ); Mon, 17 May 2021 14:12:11 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id D6AE65C0194; Mon, 17 May 2021 14:10:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 17 May 2021 14:10:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho.pizza; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=staAu2NQSD+sUEvD6aPKW7Ph2gm xQzl1MyMLLgSmbIw=; b=3RDlHGPrfd1Khe9wxpViyXgqUn1BL+UvWv4TGjZ/QYS kLi699KaIqzt6UCcbJl9oytmRhI2ww0nvVwVevbxOFysJXv+P9bVyzryOoY53iul dCZS7FsbgSAdHzEJSPjnxdftKn6E9uDkjBxfwGhyOEX28H3qVl5htl7ht6cb3kNs 0WIvLkmlPGdfAuH5AwTyaAd3I13dyRqwzBdcZlilwSyBj4shjTm6bKtv9FKRxOpy h0uaF2oI1DmDeKi5N+JKK6B0yaLYBXkuE1Xlvp11KXYdDgRcxhA+EcBjZLO2Y1eB LvGdOEbBUg71gvzhLPIvuCFvZZUXVQfnKD/jaeOV9Ow== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=staAu2 NQSD+sUEvD6aPKW7Ph2gmxQzl1MyMLLgSmbIw=; b=QWPTUklssD8iMmMu7zqjP/ kbcVPYoZB3wfVji1aRotB/ty6pkO6i+yzYKrzVhW+mWy/boQOMMHavIFG0xA1+hn J3SdUKfch/NO6wQmHxFijBfppDAia5nbH5ogqtFDptlGZup80zhCu5579ZDVj//Z +5nLP6H4YKMkAdGDVmd1Zu2fwF/baVTJskol3qn70Zv64l7EcFXgAl9CKK2spkkO Q9hDBykBFtx5nxbisOA0c4EiY4clroAFggBH1B6Ektl3kXE/+Bscz5S71yHca8fr up6lWnjlTy0/MUdkDoPuntnm69Vuy7RHCw4wplTEHn7eQFW4DrR/nGTphD/lXhfw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdeihedguddvtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepvfihtghh ohcutehnuggvrhhsvghnuceothihtghhohesthihtghhohdrphhiiiiirgeqnecuggftrf grthhtvghrnhepgeekfeejgeektdejgfefudelkeeuteejgefhhfeugffffeelheegieef vdfgtefhnecukfhppeduvdekrddutdejrddvgedurddujeegnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthihtghhohesthihtghhohdrphhi iiiirg X-ME-Proxy: Received: from cisco (unknown [128.107.241.174]) by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 17 May 2021 14:10:37 -0400 (EDT) Date: Mon, 17 May 2021 12:10:35 -0600 From: Tycho Andersen To: Sargun Dhillon Cc: Kees Cook , LKML , Linux Containers , Andy Lutomirski , Rodrigo Campos , Mauricio =?iso-8859-1?Q?V=E1squez?= Bernal , Giuseppe Scrivano , Christian Brauner , =?iso-8859-1?Q?Micka=EBl_Sala=FCn?= Subject: Re: [PATCH 3/4] seccomp: Support atomic "addfd + send reply" Message-ID: <20210517181035.GH1964106@cisco> References: <20210502001851.3346-1-sargun@sargun.me> <20210502001851.3346-4-sargun@sargun.me> <20210511215010.GB1964106@cisco> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 17, 2021 at 10:53:55AM -0700, Sargun Dhillon wrote: > On Tue, May 11, 2021 at 2:50 PM Tycho Andersen wrote: > > > The struct seccomp_notif_resp, used when doing SECCOMP_IOCTL_NOTIF_SEND > > > ioctl() to send a response to the target, has three more fields that we > > > don't allow to set when doing the addfd ioctl() to also return. The > > > reasons to disallow each field are: > > > * val: This will be set to the new allocated fd. No point taking it > > > from userspace in this case. > > > * error: If this is non-zero, the value is ignored. Therefore, > > > it is pointless in this case as we want to return the value. > > > * flags: The only flag is to let userspace continue to execute the > > > syscall. This seems pointless, as we want the syscall to return the > > > allocated fd. > > > > > > This is why those fields are not possible to set when using this new > > > flag. > > > > I don't quite understand this; you don't need a NOTIF_SEND at all > > with the way this currently works, right? > > > I reworded: > > This effectively combines SECCOMP_IOCTL_NOTIF_ADDFD and > SECCOMP_IOCTL_NOTIF_SEND into an atomic opteration. The notification's > return value, nor error can be set by the user. Upon successful invocation > of the SECCOMP_IOCTL_NOTIF_ADDFD ioctl with the SECCOMP_ADDFD_FLAG_SEND > flag, the notifying process's errno will be 0, and the return value will > be the file descriptor number that was installed. > > How does that sound? Works for me, thanks! > > > @@ -1113,7 +1136,7 @@ static int seccomp_do_user_notification(int this_syscall, > > > struct seccomp_kaddfd, list); > > > /* Check if we were woken up by a addfd message */ > > > if (addfd) > > > - seccomp_handle_addfd(addfd); > > > + seccomp_handle_addfd(addfd, &n); > > > > > > } while (n.state != SECCOMP_NOTIFY_REPLIED); > > > > > > > This while() bit is introduced in the previous patch, can we fold this > > deletion into that somehow? > I'm not sure what you're getting at. This just an argument change which > also passes the notification to the addfd function. The patch is split out > to allow it to be backported to stable. Yeah, I was mis-reading, you can ignore this. Sorry for the noise. If you send another version, you can call the series: Acked-by: Tycho Andersen Tycho