Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp126050pxx; Tue, 27 Oct 2020 23:50:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwva92ixglhOYn6paTkVLGlBKfSywmARb0B8ec0UMT/xMkJbq3JwQSb7X+A5++ahk6k///z X-Received: by 2002:a17:906:14d:: with SMTP id 13mr6015346ejh.516.1603867825117; Tue, 27 Oct 2020 23:50:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603867825; cv=none; d=google.com; s=arc-20160816; b=n/P6GszYCmq0C663ja6D1emdLVeD4QxmB3LmSRRlaCNVWCSTMQz4uhYWmykvnfZH4T 3KDmEQr//4gFLzJYkG+NckX/9GPVSM1GQTFe9vfujIDqTG4x8Iu5l7H5aTbXo3q6ebY6 uejT2TXPqwIL7dT1UUqRyj5aQa124YvgoJW0dvZfzhZgE6+YK86lsY6P1YZ1ctcaVcyX 27KyMt9kRfV+wY7/bfkUTDxid0N2hnmOsaGXTaFv580YAV8hLppdCzOyeNmEDb7g9DrE usA+QZK0/Jo9TV58PihnuXC7h3dWG/gPYOA7eiLNp0/rcwQvS2l8SXF/wZz4PzwH6C/j 0nxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=SXBs8vJX4cJod5E0ma8hUPOwIJojpK61dnpKV/ODZKw=; b=UNt9TKVkmapmwqu/huyQXmOVsYIKiCrRpdp0biI9nZ1Bh5yeoSCq/pLhf3kXTw5aYC fhY31tDtyzaeV5EnnHUUWCTS+GkMamu3npOVXE2afqb5JzfW4qTjBRqmMi1P3qaSDIRM nBQsut0uuHywTDGOSa+1p+BxdgRcNC/MGps5hRjJ5vmVSG/G16xUmncn57GVGPOyiUvh h8e5ZXuapSL0ilu6anmtVrgSD3kVwvWhCsgYy57ps5xl4b+/tNltsdb7Y3UbBePoPtNi Qklwd9ZjmM3LnOIA0EtY6Hthl0TOQtrKy0HKqcmm8lwF6DWks+wBT3wSomrKqhyDwdug ySOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SX3vumt+; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t11si2859762edj.441.2020.10.27.23.50.03; Tue, 27 Oct 2020 23:50:25 -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=@google.com header.s=20161025 header.b=SX3vumt+; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2898132AbgJ0K2v (ORCPT + 99 others); Tue, 27 Oct 2020 06:28:51 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:45032 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2898094AbgJ0K2u (ORCPT ); Tue, 27 Oct 2020 06:28:50 -0400 Received: by mail-lj1-f196.google.com with SMTP id a5so1115816ljj.11 for ; Tue, 27 Oct 2020 03:28:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=SXBs8vJX4cJod5E0ma8hUPOwIJojpK61dnpKV/ODZKw=; b=SX3vumt+l2xFwFJ7RtGU6f2QwqvLXBNvJIBGPSr2ScNXfHRvXmCpg0n+1g5TYU5nLS er6t1l0zNORBj09H+ZooUZPlhEvAKaZMbyK0tHvjx0xf52Lc9zV+/VxaRuXfwO4j3DZS BSNoLT8j8uzFqjMddbNAbinjHbTmVWxpugf1ax7hBpEqrp2fvnzsaWEb4iG/OB2c4AIp FrLQX+f5C4iZYd6tWM5RnEW7S020S60vUQngFeSZlbJMHUEJWPe4WaELOPFP4YaGQrF2 Er58dEZ1XpSNCN8LI1ddVAiSEzdRCBcuY84l0Wi5OvgFYxs5XmBA8iYYSQdbkdikXUET gTzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SXBs8vJX4cJod5E0ma8hUPOwIJojpK61dnpKV/ODZKw=; b=BiQ0sp/PB8PQW3gUbQ+wYs1qMgX5BqBffQhU+joQ63ccrddnAJ/BNbK1zI9MyJZOzN ksZRz6djcTqjg1ZgeXFuT6JFr7CN5iZyQPm9K9CVkVY++nzITMCZ+mDIk8DvPBm9mS4O PpSltIHtETjp5f4sG7124T0dKYaJAYVv7cbr3gw52ARkQms1xMo2faXq6pAndjOsl/1r zqfmtEIKoS4QjPPg9P1Asg0CD7URG8qsYNbJbJkWt+xscYS/Hyk6rx5MyUWA8/A2cg0y Lzw8oF7VXO1c4c3k47LnNnYT/f+5tdm/IMNIWTdyAOkEpWuV3jm6sm6REs8L2FqFA2ss TWjw== X-Gm-Message-State: AOAM531IjmFTQHDPzO5GXDbWtYa9XaF/22mYdOMYtvwtDkxWRxrLxQ8M M6bRLSjwyhIh69KY6Z4tU02O89eFh2V01Qa6yAOjWQ== X-Received: by 2002:a2e:9c84:: with SMTP id x4mr750615lji.326.1603794527981; Tue, 27 Oct 2020 03:28:47 -0700 (PDT) MIME-Version: 1.0 References: <45f07f17-18b6-d187-0914-6f341fe90857@gmail.com> <20200930150330.GC284424@cisco> <8bcd956f-58d2-d2f0-ca7c-0a30f3fcd5b8@gmail.com> <20200930230327.GA1260245@cisco> <20200930232456.GB1260245@cisco> <656a37b5-75e3-0ded-6ba8-3bb57b537b24@gmail.com> In-Reply-To: From: Jann Horn Date: Tue, 27 Oct 2020 11:28:20 +0100 Message-ID: Subject: Re: For review: seccomp_user_notif(2) manual page To: "Michael Kerrisk (man-pages)" Cc: Tycho Andersen , Sargun Dhillon , Kees Cook , Christian Brauner , linux-man , lkml , Aleksa Sarai , Alexei Starovoitov , Will Drewry , bpf , Song Liu , Daniel Borkmann , Andy Lutomirski , Linux Containers , Giuseppe Scrivano , Robert Sesek Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 27, 2020 at 7:14 AM Michael Kerrisk (man-pages) wrote: > On 10/26/20 4:54 PM, Jann Horn wrote: > > I'm a bit on the fence now on whether non-blocking mode should use > > ENOTCONN or not... I guess if we returned ENOENT even when there are > > no more listeners, you'd have to disambiguate through the poll() > > revents, which would be kinda ugly? > > I must confess, I'm not quite clear on which two cases you > are trying to distinguish. Can you elaborate? Let's say someone writes a program whose responsibilities are just to handle seccomp events and to listen on some other fd for commands. And this is implemented with an event loop. Then once all the target processes are gone (including zombie reaping), we'll start getting EPOLLERR. If NOTIF_RECV starts returning -ENOTCONN at this point, the event loop can just call into the seccomp logic without any arguments; it can just call NOTIF_RECV one more time, see the -ENOTCONN, and terminate. The downside is that there's one more error code userspace has to special-case. This would be more consistent with what we'd be doing in the blocking case. If NOTIF_RECV keeps returning -ENOENT, the event loop has to also tell the seccomp logic what the revents are. I guess it probably doesn't really matter much.