Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3920048iob; Mon, 2 May 2022 08:44:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYsSdQcXUqQGCK3RTyUrm5Iw7nboDpnKctL9m6437wYDh/2KXrXRlOmQHoclij7wH1bDJ+ X-Received: by 2002:ac2:4d14:0:b0:472:90d:d008 with SMTP id r20-20020ac24d14000000b00472090dd008mr9077908lfi.240.1651506297743; Mon, 02 May 2022 08:44:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651506297; cv=none; d=google.com; s=arc-20160816; b=wdXGPRmwWOFjOd+PtP3apeh2lqW3vAXLGj0ro0Em107o86GKMjFbsSqDfmQovojtNL ocIvbOXeJj/IvHV0sBARN+EJYgu2RmUZpstdxQ52xjdO0TgPs34sBiS/bc1padH2CjoM pr6zv03Km24JzvuOxPFO5m0OFSoM0QyF/WwBZauLkszs3VN/givV9NXqrZPkp2L0pswB L6r0fD+n/4W1RXviENb3TI4b5xXECe++ErCvVNhP8LlOnHv4UJmhChBvDGhFrVXcNc/B j5kR56MJTFSIMMOUV+loRHTDi2Ch+umlXRT10pdugBXZUwnmKU+ycLHAyMkJWk0/7Fe0 h8kQ== 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=FZ2ZMuL/LpbRzXpzd8eL6QW8bLX6uuX0IBW3S/wms2M=; b=qcN4NaO7qNxfd81jMQjInC9Tqrflf6mBf7qlM42MVUUznFmlu/QoTHSptznjLMF0YE glhM5cEDlWCHKO5LvHnbKUOE8BX4u6RhIrOc7UJ64wZNjpxfMy8lbbprM7uH4KdzHE1X ++za0pUJo0aFcBtdCNhr/CA8nFK65hiO7tL3YQ2Os/yiO+7WRzUQHxsZM56WPqlfV/4e yy30hHBH2CaOdtg1T0JwBRIRbCUt8GOPqz81mMyusqcEcPd9Ko4qj7ZcZPN7bzCBa7il Xss01QL9Bu4Pzde+gnpAmLwKioaaYTIlINMa4DNX2QxbFp7dJinJuDpQEblMuFoTFPyV TA7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (expired) header.i=@tycho.pizza header.s=fm3 header.b=jqe3D6ds; dkim=neutral (expired) header.i=@tycho.pizza header.s=fm1 header.b=qQdEQuyz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a8-20020a05651c210800b0024f50a9f03asi5485291ljq.590.2022.05.02.08.44.30; Mon, 02 May 2022 08:44:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=neutral (expired) header.i=@tycho.pizza header.s=fm3 header.b=jqe3D6ds; dkim=neutral (expired) header.i=@tycho.pizza header.s=fm1 header.b=qQdEQuyz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351423AbiD1Tih (ORCPT + 99 others); Thu, 28 Apr 2022 15:38:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231975AbiD1TiA (ORCPT ); Thu, 28 Apr 2022 15:38:00 -0400 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85BBB5AECF; Thu, 28 Apr 2022 12:34:33 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 41C745C00BC; Thu, 28 Apr 2022 15:34:30 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 28 Apr 2022 15:34:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tycho.pizza; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1651174470; x=1651260870; bh=FZ2ZMuL/Lp bRzXpzd8eL6QW8bLX6uuX0IBW3S/wms2M=; b=jqe3D6dszG+9pWsC+SEYq8CVEQ EvJGYVJMmm/o58el8L7aYmMBI2QUtUHdS5QGXCxZrizvOvTARRBrZkiN2BeqCTov wpJhhOjtniEt0WvceN88+2kIyxln86q1Odu3FmrWNvKqk95NTzCLFoF336WrF10l opZ7vPsD2N91mRzZvr2sVmObZ46OdmmyPofjYRorOYiOO3GnLorP12UZ8sZyXaqX kVUclyH+SgpZf5P8USKv5b1yNziuyjUFP+JiWzxu1W1T610euiFxSczWuNwnXher 6lVFHWNDNc9T6opcwnfCyQcbiPQ06H/HKTuGfaEfD/kBtIcB8dkE5kQFF73w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1651174470; x= 1651260870; bh=FZ2ZMuL/LpbRzXpzd8eL6QW8bLX6uuX0IBW3S/wms2M=; b=q QdEQuyzyn1jVuUGKX5SbRZz/tDb9ry79I1j/VzxrfxtIdeuc0ksgMVpu/ByCSVJP kUE+cCXUuuzB6HmfBJQtgOxYl4kjTw1vD40ZVJY1aA4p0VYtTymFVnmCeBBhtcc7 A67PoeeG+ntgVumeLfOEBxARM2/DYAJolKQOME2xgghSqygC5JmRc/Nx7dKEK92k MDf00JDHyqP1tOjUVhqV8iXOJletxQynmKRjepZZu7D6yQ2SRFKOvqhXp/1uflzh gmSLHd1X9qyxJf0z0lRyFB+K+9nXOTxEFptgB4Rd+BRs/+svg9j2h2VqLaI4M0th va6swbQRv+TgpjxKGu9Bw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudejgddugedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepvfihtghh ohcutehnuggvrhhsvghnuceothihtghhohesthihtghhohdrphhiiiiirgeqnecuggftrf grthhtvghrnhepueettdetgfejfeffheffffekjeeuveeifeduleegjedutdefffetkeel hfelleetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epthihtghhohesthihtghhohdrphhiiiiirg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 28 Apr 2022 15:34:28 -0400 (EDT) Date: Thu, 28 Apr 2022 13:34:25 -0600 From: Tycho Andersen To: Sargun Dhillon Cc: Kees Cook , LKML , Andy Lutomirski , Christian Brauner , linux-kselftest@vger.kernel.org Subject: Re: [PATCH 2/2] selftests/seccomp: Ensure that notifications come in FIFO order Message-ID: References: <20220428015447.13661-1-sargun@sargun.me> <20220428015447.13661-2-sargun@sargun.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 28, 2022 at 09:38:10AM -0700, Sargun Dhillon wrote: > On Thu, Apr 28, 2022 at 6:15 AM Tycho Andersen wrote: > > > + for (i = 0; i < ARRAY_SIZE(pids); i++) { > > > + pid = fork(); > > > + if (pid == 0) { > > > + ret = syscall(__NR_getppid); > > > + exit(ret != USER_NOTIF_MAGIC); > > > + } > > > + pids[i] = pid; > > > + } > > > + > > > + /* This spins until all of the children are sleeping */ > > > +restart_wait: > > > + for (i = 0; i < ARRAY_SIZE(pids); i++) { > > > + if (get_proc_stat(pids[i]) != 'S') { > > > + nanosleep(&delay, NULL); > > > + goto restart_wait; > > > + } > > > + } > > > > I wonder if we should/can combine this loop with the previous one, and > > wait for the child to sleep in getppid() before we fork the next one. > > Otherwise isn't racy in the case that your loop continues to the next > > iteration before the child processes are scheduled, so things might be > > out of order? Maybe I'm missing something. > > > > In any case, this change seems reasonable to me. > > > > Tycho > It's okay if the child processes are started out of order. The test just > verifies that the calls are delivered in FIFO order according to when > the syscall was called (not when the process was started), and we do > this by just looking at the notification ID. It doesn't care about which > process generated the notification. I totally missed that you don't this, I just assumed you did. Thanks. Anyway, you can add: Acked-by: Tycho Andersen to both patches. Tycho