Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp857534lqp; Thu, 23 May 2024 02:00:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQqtIobQE6TonTiP+Se2A4j86Wo3C82K59F4KAIMtEFk0gOC0dvAoL1PPyo/C6NJOSquyli/kzr2F/uSd9/ZaF1Qcx3eoVh7lu+utwyg== X-Google-Smtp-Source: AGHT+IE2/6Mt6yFfIaxT/4Gwa/oVPXHph4WihFYzk2V53oIeFx3V2z8gmb+NElc+WiYyDHnkQa4c X-Received: by 2002:a05:620a:40d0:b0:792:c413:1d02 with SMTP id af79cd13be357-794993454c0mr546410685a.0.1716454841122; Thu, 23 May 2024 02:00:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716454841; cv=pass; d=google.com; s=arc-20160816; b=HbK1RzAKs49mR14/5trykgujR68tPNAnCI0wFSTYz29amRk649By1I47L71prKodlg FVDA8wXh7lFfBdnEsaEno1gXwahMj5IH9ZqPMPEq9oIACxZjXMbwXeReag1xKjGm4srW zKQgixobCEaqrrP8E0Ch5Coy5QwbNhD2QJ/eMjady/ysk8gyC9DzcKi08dOM+qFQoBgt zMzq79h/cN80LPNACwjmze3T+EPLOPuFZeBWCnAUfCjTf2nWrwGgBC0UF35cU3DpZsRV EBl1pVBldlmwZPWifBUWxeJy4NecM5QcNoSmLYEjpcbu+s+EoAOZDj6Ft/PaC7QmqzaE Cd3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=xXjX+Eg6UXL149zcQPuNAImukMuIAXQwQcO/3R22CZY=; fh=rmSkX/pKTICT/aNDQxIWLVUoo5abr6rLaBQANVmeF3o=; b=NuonnO6ZLhbQJ8w+ipmGYrX2QlPEZBujvrW0wSKdOV3DJ71qybo68IaFiosG6az5cF SHFKIOPrwZpkXiKGQOzK9iSMSS+YBKL+JmNhcmJ+UXF1p/hsu33u3wiUN+dPzmOieb95 Sz50yUkpH9wZvw2gcc7D68yOSChF1nsgaXIHRWlUwPhbSTgUwCPdH1Og4GPSPW6TaeXX ysMPOQOfEbW5GXiIcuoRuvmMCqXHM6TCvlpKsoEHnXMJiVRvTOvAvDGzj8w396l3r+Nh BNoTGINHlnk1vvV9mUm3Hi2aTPyUSb/V5ZcGC45Lkld/pvRV6HwSmTBmu4F3zBFo0Cpn sjRw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Hx+jwPhh; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-187216-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187216-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-792bf30b68fsi650499485a.354.2024.05.23.02.00.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 02:00:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187216-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Hx+jwPhh; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-187216-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187216-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D54AF1C210E0 for ; Thu, 23 May 2024 09:00:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB32813D240; Thu, 23 May 2024 09:00:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Hx+jwPhh" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AD645B5B8 for ; Thu, 23 May 2024 09:00:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716454838; cv=none; b=AEIEPhqzPJFTbqTvnbYlFZl01WVdvRE28YxotEkYXzOLPZxAv20pEE8aspLcx3gCNN1Xm/XIe8gPvWuKmAs2fBERwAhNdNyYiAqtb3dWF9Sq3nX/wsJXPYGG0RpvqJ5difpzUP1mmgl4UrnCZ5wonw60Wg5psmq3KI/LgCf+9j8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716454838; c=relaxed/simple; bh=fx3lnRrdYGSzCWxxWFbM9mILK2AYStWqU56b1FFbsp0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fvRxrlgU0n18YJc6bxctovnJzZyRkvKIolKKfUaByclprqVuokKoHytqwGOVvaHLGSXW+o4G93soSGx4z+AOai2VWx/ShuHdL+cRcvDIiWQfGLxr5z49O6zOgDWfZIDoU60ew+TvLS8naBnQC8gPiRrqBlMhfF+/8UyT78zyXP0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Hx+jwPhh; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716454835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=xXjX+Eg6UXL149zcQPuNAImukMuIAXQwQcO/3R22CZY=; b=Hx+jwPhhifZFxPhMctngln+yjQw2ys4+6FJ2HdqpyXAhgrmSND0pwB0l538JP6ujf69bmF mIAfTbOkjGgsviqzliFIB6jMPzkm4+flHIjfLTK0blBer927u30pCn3wQ+vkg+U5d4ihKI lISLp+FC0pjXSJqTbRaznkQbSzy8E24= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-591-azrIwL-cMMK17mfrflUcGg-1; Thu, 23 May 2024 05:00:31 -0400 X-MC-Unique: azrIwL-cMMK17mfrflUcGg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 20DCA800169; Thu, 23 May 2024 09:00:30 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.226.7]) by smtp.corp.redhat.com (Postfix) with SMTP id 1316D28E3; Thu, 23 May 2024 09:00:27 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 23 May 2024 10:59:02 +0200 (CEST) Date: Thu, 23 May 2024 10:59:00 +0200 From: Oleg Nesterov To: Andrei Vagin Cc: Kees Cook , Andy Lutomirski , Will Drewry , Christian Brauner , linux-kernel@vger.kernel.org, Tycho Andersen , Jens Axboe Subject: Re: [PATCH 1/3] seccomp: interrupt SECCOMP_IOCTL_NOTIF_RECV when all users have exited Message-ID: <20240523085859.GB15163@redhat.com> References: <20240523014540.372255-1-avagin@google.com> <20240523014540.372255-2-avagin@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240523014540.372255-2-avagin@google.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 Hi Andrei, the patch looks good to me even if I don't really understand what SECCOMP_IOCTL_NOTIF_RECV does. But let me ask a stupid question, On 05/23, Andrei Vagin wrote: > > The change is based on the 'commit 99cdb8b9a573 ("seccomp: notify about > unused filter")' which implemented (E)POLLHUP notifications. To me this patch fixes the commit above, because without this change > @@ -1466,7 +1466,7 @@ static int recv_wake_function(wait_queue_entry_t *wait, unsigned int mode, int s > void *key) > { > /* Avoid a wakeup if event not interesting for us. */ > - if (key && !(key_to_poll(key) & (EPOLLIN | EPOLLERR))) > + if (key && !(key_to_poll(key) & (EPOLLIN | EPOLLERR | EPOLLHUP))) __seccomp_filter_orphan() -> wake_up_poll(&orig->wqh, EPOLLHUP) won't wakeup the task sleeping in recv_wait_event(), right ? In any case, FWIW Reviewed-by: Oleg Nesterov