From nobody Sun Jun 21 04:20:34 2026 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DDDB226CFE for ; Tue, 7 Apr 2026 14:35:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775572557; cv=none; b=Dq+DUwwBCzCCEK7oqk8JfWZoDE8E9Ou9PnBsKjj6TC3rrEy9F1/PYcPQkOzsLi1KcMFYToIB63DQae6KCNc30ofQJvNTNpDLOJno2U3MKwiaRr6pecF2LNrrocMLWbdXDIoypKUrwydNGbB0m1wPpJSXmuXKIwJ8mt2f031dssk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775572557; c=relaxed/simple; bh=KDyps0kcTr7T9J7GuBB29GJhWFeBGQihHTwt+gW0qf4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uNCQOzZFlYqbLE3KG8shfibHDdH2Iz+frVHOO4MQaNOZ/G7yWV2mrCYgz2EIUYOAYedNuv2gqAU/UgeTHyB2fkTioSGQciyIEFAcFh9CPlCqHUE3LFcAeIIekkRgF/V3Ata4kmp5lHnav88HdYjMzEcGCM4oUviEIqbcJ9sOeps= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=AJjtFnCh; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="AJjtFnCh" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4887fd35e60so33160615e9.2 for ; Tue, 07 Apr 2026 07:35:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1775572554; x=1776177354; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Ukt5NWqBecP1NcuRSmjZ7NqX4Lbk2NtstpvbaJriLXk=; b=AJjtFnCh76VL8VqUpXONXZ7BpUlGCl+wVkcSE+Aw/04K1VvFrREAvbfhKBlYCjDlfM /XxcOPN9dDLhqEWbnMgEdNOa5pvojF8nXdzxmo71n0gM3cBBbSSiLgYEFCsbmZ8HcpVr kxlJf4nkFAkyraaPf5EItXh3a0r1EMcHYxrY2EuzejcRaIGLTeR941DWu1chTnMo4q9X cbpvQWlOwQSUw0qVyGONYKZcRYdk4PMakEwkJJ8T7gUmHcScluxwA2P7IqgvBO8qyPiE m3xajjOXmP179VnyTQsUpw3AvIw7qhscueqHgCF9JSKXvZ7GFimU+vL0abyfAN1KYLrC xe7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775572554; x=1776177354; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Ukt5NWqBecP1NcuRSmjZ7NqX4Lbk2NtstpvbaJriLXk=; b=jMnTI8ShDP/zmRPdrO3zVO2Tf5ftE6sNVf3HjnT9JofuAbvz2aC1CxVZLXU4NSjYFO yC3O7GIXqpbMGbvMUT9+arTY66X698u8lRS6v5Tve0Zmxs6Mj6WkFZYSC2xel2i9OBAn LF79A/5jXmZNtSyR0MFK3WKVpA1XniWpygk9vf2WHyv8pR24+Zbsq14bHsKRbCRHDV/v rxH09fQkA1rSRb81ZbfqhOWfRCO5ERjM/HsCk1S1scQvFlWHS1dcxMyji9xuLUEl+rPs VfHVkGS6AgM+MQViK6aFoVaqse5wwk3cYH80c6CZsH8akcu5hWaxJkn0Dymrb7TWmhW7 9cfQ== X-Forwarded-Encrypted: i=1; AJvYcCUgWffniwVHHmDv7RKrxFpXYFbDqhKSGlE9YncK+IM0i6fgCShdw8Z4HFXVj3T+wwQxAFbX3RxblLYV5j0=@vger.kernel.org X-Gm-Message-State: AOJu0Yy6vfukg+LH1su66Pc/kPFAP8BoOmumhFklRIPaDYnHuTxD9TpU Crn+/ju1QTgUGFxwYIlTxVRBpXSc5nL75UMuhnbztQ7oBszwnzm7D66vZt2gH/kiQmSSnVmaXml nnhCTgxQ= X-Gm-Gg: AeBDiet612L3jcPWSct7P8ox59ZrFb0R66A4EjvvQi7/qfVji9S4dPFuCadi9wKZyjS 1CYHho7R6gKQnlqlN1nV7yXK6eclJ44Tbf5ORwtghvlRRyxB3Fr6CpjgTySsQi4LRMS7GriLfgF POdGs1G5t+dqFlyiMYB235pJ1NY+N68EOuyTs0iWECGjslDrCL38yhB0kZgfO9te0r6O/KlJCKv 5F87yNwAIppn3JXFWmQoXzffHxh8cHtfGO/Z3XwTn55/3RBIDhfTMw/+jjKqFL53s2vnXXG+F3q Z54y+/WtMhsDGjfFKF5HSDWZO+gh6fwIFH5nyvtCpCCEHg+J3dgE7fgZ4/zLGbOk7rnKUeOCowk ByuRHOoErhQvmDwlk9MR6rYR2wsWuFEXPumr/bPEJwZIHUFsc0UiIg+IFsFTkdR3DwNnKjja6Kv 2mUW9uq/9rJyM7 X-Received: by 2002:a05:600c:a410:b0:488:b726:6daf with SMTP id 5b1f17b1804b1-488b7266fd9mr68006725e9.24.1775572554508; Tue, 07 Apr 2026 07:35:54 -0700 (PDT) Received: from localhost ([2804:7f0:b767:120d:a4df:3777:2c55:2b95]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2cef60a435dsm8251268eec.10.2026.04.07.07.35.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2026 07:35:53 -0700 (PDT) From: =?utf-8?q?Ricardo_B=2E_Marli=C3=A8re?= Date: Tue, 07 Apr 2026 11:35:45 -0300 Subject: [PATCH 1/3] selftests/namespaces: Kill grandchild in nsid fixture teardown 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260407-selftests-namespaces_fixes-v1-1-59109909d88b@suse.com> References: <20260407-selftests-namespaces_fixes-v1-0-59109909d88b@suse.com> In-Reply-To: <20260407-selftests-namespaces_fixes-v1-0-59109909d88b@suse.com> To: Shuah Khan , Christian Brauner Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Ricardo B. Marliere" X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=openssh-sha256; t=1775572546; l=2577; i=rbm@suse.com; h=from:subject:message-id; bh=KDyps0kcTr7T9J7GuBB29GJhWFeBGQihHTwt+gW0qf4=; b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgguRCc5X8/UX9M40lkMnr//aFGOhce x5ezt8MFNUFlqYAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA QA/grReIxdB2qJIGWyTXSHgCmtk0IfhrJFKsYfdGxLDcCLR7+iNv7TU1f/gn14etaaNhjPhN5S6 G/5DnxGgM4Qc= X-Developer-Key: i=rbm@suse.com; a=openssh; fpr=SHA256:pzhe0fJpYLz+3cZ33FFPhIfaUElk9CXPFFXmalIH+1g The timens_separate and pidns_separate test cases fork a grandchild that calls pause(). FIXTURE_TEARDOWN only kills the direct child, which is the init process of the grandchild's namespace. Once the child (init) exits, the grandchild is reparented to the host init but remains alive and continues to hold the inherited write end of the test runner's TAP pipe open. tap_prefix never receives EOF and blocks indefinitely, hanging the entire test collection. Record the grandchild PID in the fixture struct so that teardown can send SIGKILL and reap it before dealing with the child. The grandchild must be reaped first because the child acts as its PID namespace init; killing the child first would kill the grandchild without giving us a chance to waitpid() it. Signed-off-by: Ricardo B. Marli=C3=A8re --- tools/testing/selftests/namespaces/nsid_test.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/namespaces/nsid_test.c b/tools/testing= /selftests/namespaces/nsid_test.c index b4a14c6693a5..46dc838cba82 100644 --- a/tools/testing/selftests/namespaces/nsid_test.c +++ b/tools/testing/selftests/namespaces/nsid_test.c @@ -25,14 +25,24 @@ /* Fixture for tests that create child processes */ FIXTURE(nsid) { pid_t child_pid; + pid_t grandchild_pid; }; =20 FIXTURE_SETUP(nsid) { self->child_pid =3D 0; + self->grandchild_pid =3D 0; } =20 FIXTURE_TEARDOWN(nsid) { - /* Clean up any child process that may still be running */ + /* + * Kill grandchild first: timens_separate and pidns_separate fork a + * grandchild that calls pause(). It is reparented to init on child + * exit and keeps the test runner's tap pipe open, hanging the runner. + */ + if (self->grandchild_pid > 0) { + kill(self->grandchild_pid, SIGKILL); + waitpid(self->grandchild_pid, NULL, 0); + } if (self->child_pid > 0) { kill(self->child_pid, SIGKILL); waitpid(self->child_pid, NULL, 0); @@ -676,6 +686,7 @@ TEST_F(nsid, timens_separate) =20 pid_t grandchild_pid; ASSERT_EQ(read(pipefd[0], &grandchild_pid, sizeof(grandchild_pid)), sizeo= f(grandchild_pid)); + self->grandchild_pid =3D grandchild_pid; close(pipefd[0]); =20 /* Open grandchild's time namespace */ @@ -797,6 +808,7 @@ TEST_F(nsid, pidns_separate) =20 pid_t grandchild_pid; ASSERT_EQ(read(pipefd[0], &grandchild_pid, sizeof(grandchild_pid)), sizeo= f(grandchild_pid)); + self->grandchild_pid =3D grandchild_pid; close(pipefd[0]); =20 /* Open grandchild's PID namespace */ --=20 2.53.0 From nobody Sun Jun 21 04:20:34 2026 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6CA9126FA6F for ; Tue, 7 Apr 2026 14:35:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775572561; cv=none; b=GfQhNfUks+eofszBOC7ThSbjOFdw26ZXfAZ9uTYKnvww0fHCnzbYhaIvrw5ifMbyE/3CCaJ03nq/nWPFpiaT5dvzVVqP9sOXkiJTFtPfHsYHmjei5NNVrHwO0jOe6cl4lrYyBSGpGKCS/hJ+AMBaZUUxuOMJXMGjtEpeYObR0JM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775572561; c=relaxed/simple; bh=ruJfw0yxki9i49bwWKgVXg9RYwXel0TmFTpZwK8U93A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iLu8FB8xRQSSuVLUqw4YLWLUUk8s+1sdiclt5Tb7EtmnpoQyqjFUoZyWDAmM3z5zMmTca+OURrkaMG+S1vMeXEwVzmWQC59tTBE0Jlc1/LcSELc/rilNGXxqShGbohMLDFKDas2AmzBeTxB8JWgazBM09wM4GC3TCS7GA8Lg78A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=S8dkUqVx; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="S8dkUqVx" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-488aa77a06eso38127295e9.0 for ; Tue, 07 Apr 2026 07:35:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1775572558; x=1776177358; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=LwQXi5Tu0OP3YXIfJ0yEywBxARJgRMYgFrQgcpLPUL0=; b=S8dkUqVxysSSKE5iR8LdKcCzLZMdX3Vs42CqLgSJOubLtWtL1KfAFGZPsnLUJvbkh+ D19yaW39ts/TLCdclmNqCZucEh3OsMwQceoHfDiWuHPCsxGm6a+pYKXwQIBjlzBVaJs3 GAGrLyOnvCe+PFsITAbQpG3hqZMjZanhYiCKmgptw1teNP450zSrqGqE8exqG0cC0qdw 48X5TjlK8lGtpFBY+5T1Vq6TxlftnErDbUDPjYEnZZgx2Gg+lx1qtC5ey/VApvrhICZZ s6+3Y7qheyVtD16W4/nqlYErGQq3DY3xjp42QfuoqYtq1WZ2B7laKwgw6HCI3kddM2h5 x0ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775572558; x=1776177358; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=LwQXi5Tu0OP3YXIfJ0yEywBxARJgRMYgFrQgcpLPUL0=; b=bQiFoML6lhb4K1aMOFOETfIWtSf2E2FBhILt8wPBl3D4+pfA6dAJNMelf+F2yocaWo QSqmzY/NtIaseph3ucvVigHOCtvS0vEDY//dLYweCFTCPNRGXlMhZGhWKlJrxhFQZAlc 0umn2ov5wD1B7PDR13jYCtHsch5teStKT4V7vSvo9ZKdG5aRzAv5lz96L6+gFAAChGp0 2TO7bFLGIVRqJVkoz5kZR3ima/I9T2rrwwK9UJH88VKVYCNCcyta/kq15GcSbjDUtt6d pH2MpkWlogUPZFwq8d+wkZVeMBb8EzyucDOxBrHUWh2wmq/OarcMrCRmv2k7KlXbMJQ9 qhqw== X-Forwarded-Encrypted: i=1; AJvYcCXb7BYQmHzEw4Log8ygqzdHCHZxV5fTgFYb+Z+tYfuCMrcmk59UM5X7CWF9VY4ASdNPvbxpMO4MAey3MsU=@vger.kernel.org X-Gm-Message-State: AOJu0Yyy2VIbMjiAjxz+NdAc7BoF1914OY2m4ZInoLVJh7tAtNXVZNcl c9FVnoN4Ahwygrn6aoUy6mj8TjKgjNAkEHn5O7+YAdAu9DGSZLvUZ8kXGULT/eHqad8= X-Gm-Gg: AeBDieuqJxpWYbTaz24CwH6O3FLgRy7wQjpVnfhSdVKNRy1NO3n1g01YlabNcwW1tr2 JhZK3GXJpDRVSXQlFXRsxeeFhzyLuIXZxsH5XbBf6/wiit/mThMMAPif9KZS7bEhrzYSwC+BG61 wxg/ZTxDUXhRRphaLNZXAbGGy8n46k8N2vkjb5fBqS67q6cv+2hpOviRdCXrYR9P5xZJxo7V2NL BQlNenoG/bfnuQ/CCN0jzbQVzLEqBuIrBLBY41a5ozyhxnItU8/MHWeet0+3uSJT/JBc7iAWrfM ZNbuujkIa/6mORU8rxD89mBjGTg13ND1cEnXQlSj0CLtEn79Cu2zUiBqncb0EFGLQv3iMAN5kCW /pltSlKn8+7Xd7v/8tw8vm7v7InUgX6CvDviE4J0rwlw+d5oNBBOA6kxlrvOJlgcWQpJFBozVjY WjrhdpJZpWUgXN X-Received: by 2002:a05:600c:a404:b0:488:b749:8478 with SMTP id 5b1f17b1804b1-488b74988e4mr67381975e9.6.1775572557735; Tue, 07 Apr 2026 07:35:57 -0700 (PDT) Received: from localhost ([2804:7f0:b767:120d:a4df:3777:2c55:2b95]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2ca78df5ed3sm16357686eec.6.2026.04.07.07.35.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2026 07:35:56 -0700 (PDT) From: =?utf-8?q?Ricardo_B=2E_Marli=C3=A8re?= Date: Tue, 07 Apr 2026 11:35:46 -0300 Subject: [PATCH 2/3] selftests/namespaces: Fix waitpid race in listns_efault_test cleanup 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260407-selftests-namespaces_fixes-v1-2-59109909d88b@suse.com> References: <20260407-selftests-namespaces_fixes-v1-0-59109909d88b@suse.com> In-Reply-To: <20260407-selftests-namespaces_fixes-v1-0-59109909d88b@suse.com> To: Shuah Khan , Christian Brauner Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Ricardo B. Marliere" X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=openssh-sha256; t=1775572546; l=3317; i=rbm@suse.com; h=from:subject:message-id; bh=ruJfw0yxki9i49bwWKgVXg9RYwXel0TmFTpZwK8U93A=; b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgguRCc5X8/UX9M40lkMnr//aFGOhce x5ezt8MFNUFlqYAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA QF0cRacwgjbTV7M69qSX6/IpJxZn3/A2k77vLqxIKuj/B9Azjr5TbQSFO0/nkgeniJ+RUWGmaEy r+dMejsrdawo= X-Developer-Key: i=rbm@suse.com; a=openssh; fpr=SHA256:pzhe0fJpYLz+3cZ33FFPhIfaUElk9CXPFFXmalIH+1g The efault tests spawn two categories of child processes: namespace children (each in its own mount namespace, for concurrent destruction) and an iterator child that calls listns() in a tight loop. The cleanup loop used waitpid(-1), which reaps any child in any order. If the iterator child exits early (e.g. because listns() returned ENOSYS) before all namespace children have been reaped, waitpid(-1) may consume it instead. The subsequent targeted waitpid(iter_pid) would then block indefinitely. Track the PIDs of the namespace children explicitly and use targeted waitpid() calls in the cleanup loop so the iterator child cannot be inadvertently reaped during namespace cleanup. Signed-off-by: Ricardo B. Marli=C3=A8re --- tools/testing/selftests/namespaces/listns_efault_test.c | 15 +++++++++----= -- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/namespaces/listns_efault_test.c b/tool= s/testing/selftests/namespaces/listns_efault_test.c index c7ed4023d7a8..ac3b208264f5 100644 --- a/tools/testing/selftests/namespaces/listns_efault_test.c +++ b/tools/testing/selftests/namespaces/listns_efault_test.c @@ -39,7 +39,7 @@ TEST(listns_partial_fault_with_ns_cleanup) __u64 *ns_ids; ssize_t ret; long page_size; - pid_t pid, iter_pid; + pid_t pid, iter_pid, ns_pids[5]; int pidfds[5]; int sv[5][2]; int iter_pidfd; @@ -115,6 +115,7 @@ TEST(listns_partial_fault_with_ns_cleanup) =20 pid =3D create_child(&pidfds[i], CLONE_NEWNS); ASSERT_NE(pid, -1); + ns_pids[i] =3D pid; =20 if (pid =3D=3D 0) { close(sv[i][0]); /* Close parent end */ @@ -165,7 +166,7 @@ TEST(listns_partial_fault_with_ns_cleanup) =20 /* Wait for all mount namespace children to exit and cleanup */ for (i =3D 0; i < 5; i++) { - waitpid(-1, NULL, 0); + waitpid(ns_pids[i], NULL, 0); close(sv[i][0]); close(pidfds[i]); } @@ -251,7 +252,7 @@ TEST(listns_late_fault_with_ns_cleanup) __u64 *ns_ids; ssize_t ret; long page_size; - pid_t pid, iter_pid; + pid_t pid, iter_pid, ns_pids[10]; int pidfds[10]; int sv[10][2]; int iter_pidfd; @@ -321,6 +322,7 @@ TEST(listns_late_fault_with_ns_cleanup) =20 pid =3D create_child(&pidfds[i], CLONE_NEWNS); ASSERT_NE(pid, -1); + ns_pids[i] =3D pid; =20 if (pid =3D=3D 0) { close(sv[i][0]); /* Close parent end */ @@ -374,7 +376,7 @@ TEST(listns_late_fault_with_ns_cleanup) =20 /* Wait for all children and cleanup */ for (i =3D 0; i < 10; i++) { - waitpid(-1, NULL, 0); + waitpid(ns_pids[i], NULL, 0); close(sv[i][0]); close(pidfds[i]); } @@ -403,7 +405,7 @@ TEST(listns_mnt_ns_cleanup_on_fault) __u64 *ns_ids; ssize_t ret; long page_size; - pid_t pid, iter_pid; + pid_t pid, iter_pid, ns_pids[8]; int pidfds[8]; int sv[8][2]; int iter_pidfd; @@ -463,6 +465,7 @@ TEST(listns_mnt_ns_cleanup_on_fault) =20 pid =3D create_child(&pidfds[i], CLONE_NEWNS); ASSERT_NE(pid, -1); + ns_pids[i] =3D pid; =20 if (pid =3D=3D 0) { close(sv[i][0]); /* Close parent end */ @@ -509,7 +512,7 @@ TEST(listns_mnt_ns_cleanup_on_fault) =20 /* Wait for children and cleanup */ for (i =3D 0; i < 8; i++) { - waitpid(-1, NULL, 0); + waitpid(ns_pids[i], NULL, 0); close(sv[i][0]); close(pidfds[i]); } --=20 2.53.0 From nobody Sun Jun 21 04:20:34 2026 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9C4728488D for ; Tue, 7 Apr 2026 14:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775572565; cv=none; b=DY/UfrZxsoiWS5hSXpTyuE7p89Hvx4KOosDbCZ+F934Kf/dvQMFPr+wTMCjnmcr5X5QAtMw3IXuIW/C2V4TtcqKU0xdvLW9aQYRrEfGXafL10kcDjQn9syPtiUWd0HML6V53izVV3WUyxvd/tnHEL7QGdzaCSVW4svpLtAQg/Sw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775572565; c=relaxed/simple; bh=LfUiEUPfBZYN6FkeSaEgUWNG2ClgHgkt1O09UueoM8Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=G07ySpZ3IXagAujlhHAASDXY2rQ6yQVcecciQOaYto74dH72n2sDKE4ytXw/U6q4jwt/z7lDzG4QZdSv2AxlHLh7ABMeBztIh3f7QolEK7iRGvAhJx8g+wS0PAys7bBzP5EvEwaBNlRoP0eL8huVzGVD3uQRdheOGaduLjlZf5Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=YR80o3pO; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="YR80o3pO" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-482f454be5bso64123215e9.0 for ; Tue, 07 Apr 2026 07:36:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1775572562; x=1776177362; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=TrFTuUdVbL8YUjWZ5ZEUaPVucQjwMCOkmEq7Dkm7NoA=; b=YR80o3pOKwErUU/XBxxnKef1XRpm3UeF7xSeoCjXYW1dWFbE5Z/KDxXPUSY4d0kfis b+mCFGrKjZu/8qeS6CPdDAykysXrZEENY1Suj0AVQq1jdHzwhf7lBeTRdjnAwMnzLLMD /03fvbDkNnyBOESmZsVRfTyJZpqWR20AIf9odRUwj4sN3/VkfAV350NTXTUFkUFRm3fe Bu6EON1PpF2+sgMkjp18bkrxfO2BO3anFVL3anZHQprJYUbhhFXv2xnk48A/UVDYsORI Gd+NuQQ/TxNxHGx0IZ6ns85AChdgeOx8UB1+9BmBWrkFLvxdi6skl6bjrhkc5v7yqWwT rGEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775572562; x=1776177362; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=TrFTuUdVbL8YUjWZ5ZEUaPVucQjwMCOkmEq7Dkm7NoA=; b=H8KyB58AGcFqi+cxTIMvv9jSSzYHhQOT+Dm3M+y0oMrNRJpH8FJXmNCTXowdaLQZOq XEl9v1wGyt8jv50vM8a6NqqTsLlTZ2xvTh2gGp4v2trM4pVdIr9A2XireXXZpWTC6fZi c8RjMExgj7+CbVQmUA81Y0MouoVk6+X1vrSENfbdmGn5Dj4Y6Kf0rG3Hc1aNKqNo1k/2 /B7ReYpSV7o1kFEBWVenbRJD4N4Hw8e4quJJ3e9skDHTIXoqEtSH2lkZoyQoeW+kHjIF TAfToT+1NV/nGjeOCVZ891LyrCCVTik5voz6dMZECA/j6mmOnSZBEtxU0+bnJ+J/afG8 59+w== X-Forwarded-Encrypted: i=1; AJvYcCXA72UwPx6QGCGZTdqGikEy2WxdeoQyGb9hyG3U98N4H6zXn5BPhxbDFqH4hpR6Rjoikn0KOrpqjNxwmA4=@vger.kernel.org X-Gm-Message-State: AOJu0YxMbD9u4fjVHjz67tgsxkJLS8aohcCdTGE6Gn36QoTxLghHayem s8xlKJ/DFRkpR058oQTFZ6Ox9kFGf4PWnbyvdw0jHvKhrxPGG8YYuzBxDzekFrdL5gs= X-Gm-Gg: AeBDietAiaeJh/iIFNdzNHIn7iHk9v7VVI/DO+ItZGYQqkdA7QdS8sXI3IMMUW3nUDJ 1ehIQzU/VprZUqgUVYZLzFsOUvyfOkFkaIQhnoO0yug2DjWjOlY2PM3nvYePzSzdHA3P6N35VSz YAQ42gwDLhxWkA4eoPHIkoHLnJdnmkwMH2HZ4F59fj5qpLufVwj0d2l1Ntxy3Qi7HYuotk+QI6A HRm4UYzKxo8KvZzypWs8hY7R3Ajw7GsdgBVfYUJA/FCmiLCo5iiW1YtAaJtcf5sShg5cjuxqWB3 IoFbLSspfZeAuetQ5XKc4g0ItWLY7/wP66gbWc3MjrJbyC7/BQqvfUxgZjzTtmMSPiXln/AsYTW Lp7iRGS7ZcQeGrbCzEwmIw3a08oMHShuUf5u6CZufw+DEUQo/DYCdKYTtNj1qf4VLsXArKIZbDJ 5oVZl5feD71eMA X-Received: by 2002:a7b:c386:0:b0:488:a9c3:44a3 with SMTP id 5b1f17b1804b1-488a9c34679mr107798445e9.2.1775572562170; Tue, 07 Apr 2026 07:36:02 -0700 (PDT) Received: from localhost ([2804:7f0:b767:120d:a4df:3777:2c55:2b95]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2cf1af62347sm9214409eec.22.2026.04.07.07.35.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2026 07:36:00 -0700 (PDT) From: =?utf-8?q?Ricardo_B=2E_Marli=C3=A8re?= Date: Tue, 07 Apr 2026 11:35:47 -0300 Subject: [PATCH 3/3] selftests/namespaces: Skip efault tests when listns() is not available 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260407-selftests-namespaces_fixes-v1-3-59109909d88b@suse.com> References: <20260407-selftests-namespaces_fixes-v1-0-59109909d88b@suse.com> In-Reply-To: <20260407-selftests-namespaces_fixes-v1-0-59109909d88b@suse.com> To: Shuah Khan , Christian Brauner Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Ricardo B. Marliere" X-Mailer: b4 0.15.1 X-Developer-Signature: v=1; a=openssh-sha256; t=1775572546; l=2530; i=rbm@suse.com; h=from:subject:message-id; bh=LfUiEUPfBZYN6FkeSaEgUWNG2ClgHgkt1O09UueoM8Y=; b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgguRCc5X8/UX9M40lkMnr//aFGOhce x5ezt8MFNUFlqYAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA QCnn91ibS0jvgFf4QOePzCOblr0iqaJTaATUbCO8O0ujcw7hMQdYw6TzH3Upty3WM6TtFc0dSGs QTjEaFoGGOQk= X-Developer-Key: i=rbm@suse.com; a=openssh; fpr=SHA256:pzhe0fJpYLz+3cZ33FFPhIfaUElk9CXPFFXmalIH+1g When listns() is not implemented the iterator child detects ENOSYS and exits cleanly with status PIDFD_SKIP before the parent has a chance to signal it. The parent sends SIGKILL (which is a harmless no-op at that point) and then calls waitpid(), obtaining a normal-exit status. The subsequent ASSERT_TRUE(WIFSIGNALED(status)) therefore fails, causing the three EFAULT-focused tests to report FAIL rather than SKIP on kernels that do not yet carry listns() support. After collecting the iterator's exit status, check whether it exited with PIDFD_SKIP and issue a SKIP verdict in that case, consistent with the behaviour of every other listns test that already handles ENOSYS correctly. Signed-off-by: Ricardo B. Marli=C3=A8re --- .../testing/selftests/namespaces/listns_efault_test.c | 18 ++++++++++++++= ++++ 1 file changed, 18 insertions(+) diff --git a/tools/testing/selftests/namespaces/listns_efault_test.c b/tool= s/testing/selftests/namespaces/listns_efault_test.c index ac3b208264f5..c20c6a812217 100644 --- a/tools/testing/selftests/namespaces/listns_efault_test.c +++ b/tools/testing/selftests/namespaces/listns_efault_test.c @@ -177,6 +177,12 @@ TEST(listns_partial_fault_with_ns_cleanup) ASSERT_EQ(ret, iter_pid); close(iter_pidfd); =20 + /* If listns() is not supported the iterator exits cleanly via ENOSYS */ + if (WIFEXITED(status) && WEXITSTATUS(status) =3D=3D PIDFD_SKIP) { + munmap(map, page_size); + SKIP(return, "listns() not supported"); + } + /* Should have been killed */ ASSERT_TRUE(WIFSIGNALED(status)); ASSERT_EQ(WTERMSIG(status), SIGKILL); @@ -387,6 +393,12 @@ TEST(listns_late_fault_with_ns_cleanup) ASSERT_EQ(ret, iter_pid); close(iter_pidfd); =20 + /* If listns() is not supported the iterator exits cleanly via ENOSYS */ + if (WIFEXITED(status) && WEXITSTATUS(status) =3D=3D PIDFD_SKIP) { + munmap(map, page_size); + SKIP(return, "listns() not supported"); + } + /* Should have been killed */ ASSERT_TRUE(WIFSIGNALED(status)); ASSERT_EQ(WTERMSIG(status), SIGKILL); @@ -523,6 +535,12 @@ TEST(listns_mnt_ns_cleanup_on_fault) ASSERT_EQ(ret, iter_pid); close(iter_pidfd); =20 + /* If listns() is not supported the iterator exits cleanly via ENOSYS */ + if (WIFEXITED(status) && WEXITSTATUS(status) =3D=3D PIDFD_SKIP) { + munmap(map, page_size); + SKIP(return, "listns() not supported"); + } + /* Should have been killed */ ASSERT_TRUE(WIFSIGNALED(status)); ASSERT_EQ(WTERMSIG(status), SIGKILL); --=20 2.53.0