From nobody Tue Dec 2 02:19:43 2025 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (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 E80C73596FB for ; Wed, 19 Nov 2025 12:24:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763555096; cv=none; b=hzw6Lo0xgbOs7CR/fDOChIaHF4DG878Yg1ThEE2ZwQx4a+MXaIgA5hhlo/O70+4gNmnFZnFpfxnor0XeUvLcxkKaN8+DrmVUFJXB/dd4te3OUZPLF+xnc+w3PHrVQMVGsTOteaKMIAts4zwKbSCFp35CzTsBwg13YSYOXLVAxvE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763555096; c=relaxed/simple; bh=TVKagHLMq86niku/IsrWaT6VJmg3K0mXFoR5k1tmH4g=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=LxAnmzDlgdwmByBiYQQg7e7mYAR+cGXkOsM5InpvgV045g1MNzNSBHt+S8OD68pck8d2xxNQ/+QSX2ugkvFa4YNhtj6B2aN2DqOniApkfp43v7kJrHG7BV613hEb6h9TY15TF+yMs3+fsqtIRyZpe35seA90neMXGlMhBh29lrU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--wakel.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rtLPYGgX; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--wakel.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rtLPYGgX" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-297dabf9fd0so87931755ad.0 for ; Wed, 19 Nov 2025 04:24:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1763555093; x=1764159893; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=NYWYlJeGDo5clFNrAJGuFwv30IEE1UTtRiLwWKQi3e4=; b=rtLPYGgXVtNfDzUSEE4dtgjlXOuxhyiryeVt6pytsi8m1CzpcbQLqrPoUaCLh0cBvM vC7rU6xetiNzvq/04x+8L+hUdvNZnoiBuKnyWnVAd4nDAu9ao5lXKHCBsaZnA9DiI8M9 ogN2jnsUgWYjmBLmH59E5xkVGyw6TMF1g49hGOss7KGEkRfRkPl4egG4AFRM18Jiqhbp NmrpbInWwdeR1e5kLbsHZaNXT4rIWIQOJUmjvy2EdzRB1pLDTIzQ/FYPWjviurfmKnBQ 82Lw4lmlEavvzhelG188LarpYLm0+YJIBq+dZLAQ62HYe9Pi3pMrjEp1Qmntv53EAjSm 4+5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763555093; x=1764159893; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=NYWYlJeGDo5clFNrAJGuFwv30IEE1UTtRiLwWKQi3e4=; b=Qy5ZPf43jYhOS47QLUJLq1TaZUo9W/CxeKJRvJ/cFxV9m4D+pnettO3Lu0voz1w09l MIG87uxNZSbFlBQirRex8vQTHv0XkY21in312D6JhErpJ7WCqqZv3E4Ih6iburvN/GPE 5OW4VTDqVoLFNUYFegT+hFM4wE9UqF7V8QxIIw2XdYqn0FQtaNtAyAbIPP/UB22ji/jm SeLHowTMfpVSxCVEc1b89d6kpwYxY2B1FFY0MDs3K37Q1iZlA6c2Q2x5QIqevAA1sD5d bv7hlmUy3Z0kqx7sXALMWyN8uTHNwcuhwSW6El8ytKyED5gPGnXcgpPPZmE0TcxdRgko Er9A== X-Forwarded-Encrypted: i=1; AJvYcCUoesxzejAfGy/YPiDO9xiMWAZDM+yiEoDKXP8z4i2VMWtcgf13wqRBeElH6MrXHurxujtgMV28tiR2uL0=@vger.kernel.org X-Gm-Message-State: AOJu0YwTMHqmXL6nJgGHP1DhZyuLP0XUTi1efPqLU4tbERrkDZ/bY7NI EuE6KgbVFiUWnsmehNndWU2y0w3sesaeD1SdT2gYP7oXEqnUaMmSOXKWlwb8zeLZmVJrzrBLWBE p3Q== X-Google-Smtp-Source: AGHT+IEfRw6i/kbpmpgUOp8qq5WqsJEozs8Mg64CN6IAOihR7+nbVd7lj0znyp/a2PV0e5Wq/pXwp4XKqQ== X-Received: from pjblp4.prod.google.com ([2002:a17:90b:4a84:b0:340:bb32:f5cf]) (user=wakel job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:ecc7:b0:297:db6a:a82f with SMTP id d9443c01a7336-2986a6d27fcmr243511015ad.24.1763555093194; Wed, 19 Nov 2025 04:24:53 -0800 (PST) Date: Wed, 19 Nov 2025 20:24:49 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.52.0.rc1.455.g30608eb744-goog Message-ID: <20251119122449.517565-1-wakel@google.com> Subject: [PATCH] selftests: seccomp: Handle syscall interruption in notification test From: Wake Liu To: Kees Cook , Shuah Khan Cc: Andy Lutomirski , Will Drewry , linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Wake Liu Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The user_notification_wait_killable_after_reply test fails due to an unhandled error when a traced syscall is interrupted by a signal. When a signal arrives after the tracer has received a seccomp notification but before it has replied, the notification can become stale. Any subsequent reply (like with SECCOMP_IOCTL_NOTIF_ADDFD) will fail with -ENOENT. This patch fixes the test by handling the -ENOENT return value from SECCOMP_IOCTL_NOTIF_ADDFD, preventing the test from failing incorrectly. The loop counter is decremented to re-run the iteration for the restarted syscall. Signed-off-by: Wake Liu --- tools/testing/selftests/seccomp/seccomp_bpf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/= selftests/seccomp/seccomp_bpf.c index 574fdd102eb5..c3e598c9c4ee 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -5048,8 +5048,12 @@ TEST(user_notification_wait_killable_after_reply) addfd.id =3D req.id; addfd.flags =3D SECCOMP_ADDFD_FLAG_SEND; addfd.srcfd =3D 0; - ASSERT_GE(ioctl(listener, SECCOMP_IOCTL_NOTIF_ADDFD, &addfd), 0) - kill(pid, SIGKILL); + ret =3D ioctl(listener, SECCOMP_IOCTL_NOTIF_ADDFD, &addfd); + if (ret < 0 && errno =3D=3D ENOENT) { + i--; + continue; + } + ASSERT_GE(ret, 0); } /* -- 2.52.0.rc1.455.g30608eb744-goog