From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65492C4363A for ; Tue, 27 Oct 2020 10:28:54 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BB13E22263 for ; Tue, 27 Oct 2020 10:28:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="SX3vumt+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BB13E22263 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lists.linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=containers-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 47EFA84DFD; Tue, 27 Oct 2020 10:28:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KHnFLeQHmrjw; Tue, 27 Oct 2020 10:28:52 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id C00EC84C09; Tue, 27 Oct 2020 10:28:52 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 95BE9C088B; Tue, 27 Oct 2020 10:28:52 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1C69FC0051 for ; Tue, 27 Oct 2020 10:28:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 1832B87258 for ; Tue, 27 Oct 2020 10:28:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xqJf+3umOY6L for ; Tue, 27 Oct 2020 10:28:50 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by hemlock.osuosl.org (Postfix) with ESMTPS id 2022D871F1 for ; Tue, 27 Oct 2020 10:28:50 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id h20so1122713lji.9 for ; Tue, 27 Oct 2020 03:28:50 -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=k3hCe82VtJfnQ9xhvyOF1ROhFbMwNxU/xFwyfLw/Om8yxpSiZdG7x8QaVBKz83bFFO FcWJbmrLzrn1OGmNuWQZoSvkfzRd6vQ0v3zlf6e3XWrZ2EVY20tCjMTeZ+/Qy1xId2Z6 1F8QRhYPlqF/r5AOOWKoV6ZN6IF4S21yb0nDyvhB+Y4lZgYf2lVw7F0xbXBgRkGdaNhZ AfKKd3W3bDIxSHXcDeD8r675TV5+NW9s/K451lRewkqUxdDoYUwcZkssLXYnwtzR9zJw O4WpOUDoVG9hlJHwmQREC5crUDFsJi0cHjoAL4tozqnpyIz+spz2kn0p1Kt7MotBJijw bcDA== X-Gm-Message-State: AOAM533Yby0J56K229X4ABAhEneMg/n9aKzF2lgHGTrBgLQpsLOax6De CbqLitMcohKWHNRVG+AmIkzqddhYbSL8LAgDrgkrYA== X-Google-Smtp-Source: ABdhPJxJshhNft3hUOxXAULUlOUPgHVANJYgBC/Mm8PWirgk1D2JwvX0yuxEiO1qIxFs4Z4pw393eScZt+DPrsMeX1c= 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: 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: linux-man , Song Liu , Will Drewry , Kees Cook , Daniel Borkmann , Giuseppe Scrivano , Robert Sesek , Linux Containers , lkml , Alexei Starovoitov , bpf , Andy Lutomirski , Christian Brauner X-BeenThere: containers@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux Containers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Jann Horn via Containers Reply-To: Jann Horn Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: containers-bounces@lists.linux-foundation.org Sender: "Containers" 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. _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/containers From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 879C6C4363A for ; Tue, 27 Oct 2020 10:32:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D04F20790 for ; Tue, 27 Oct 2020 10:32:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="SX3vumt+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2898135AbgJ0K2w (ORCPT ); Tue, 27 Oct 2020 06:28:52 -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-Google-Smtp-Source: ABdhPJxJshhNft3hUOxXAULUlOUPgHVANJYgBC/Mm8PWirgk1D2JwvX0yuxEiO1qIxFs4Z4pw393eScZt+DPrsMeX1c= 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.