From nobody Wed Dec 24 20:15:13 2025 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.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 BD07263115 for ; Wed, 24 Jan 2024 14:15:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706105724; cv=none; b=W4DnE0/UtGir8SBtWNd8EXpfBIFLrxbHMASOUhDhCyqoGFTEeIBuQ6IiW9HEL2MouhmZgV8gWqqJ76sXjwa8l/J6eCwTuRXw87H7/N6yQTJT7TXFWgXUzbdOIrcBlbppFib8JMVarQpQ3pLdz2dJA4LA+nyLhw2dk1QunTABAz8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706105724; c=relaxed/simple; bh=0UEj8Oof/abgmDFcrUPI79i5BHVw6bCbAYsJDPU2SAM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S4eVTyjor5zvfFgT7bw6fuJTt9cj2Dy9ZAPsCAadXiuEN+pGlJL75UnirNb4pg1zzWM32eYH6J9djeA4zHSPRcHcA/wOe1ALxgshuYm+1FuJZUic0+0gRioCznGO4w8dypKl2t/6wRirIpzuEsUOdohF3whBI8DjYVW7JBr3/YY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=DSINa5t3; arc=none smtp.client-ip=209.85.208.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DSINa5t3" Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-55ad2a47b7aso4878890a12.3 for ; Wed, 24 Jan 2024 06:15:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706105720; x=1706710520; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kinIyrY0DiVL9FjvsbU90IrpJuAQN+qhOmTSZHZdLpE=; b=DSINa5t3MmDC8b2fbZ/xUX2D2ctlZnXEZf1qMjsrZPQmF1Chq0+fBQPztuxKmSTYzl jlPVPKICQBJThTEyqE2APseDp/9idHUSrfvC07LuCyJBJjNKn0IGMxMI28Yj8SeY2nv4 AARfcbe6g+zH5MSAffVrD+5g1KUsNjIJapezxudwGujChqw2I/2Bqh8eAjQ5AYpUwN7H omJgIPvIBfEnsicWt5Fi5lxfRnFxcoob5lHp/7dy9sm8LGlKyjA9WZNahRGK3oZ44CX2 QFI59jvPophJ2WO7t3tF5okxVF1PMcgk3D8bUIrkJ+I+4mctPB3p8Ig1iRCVwRtx3Cv8 9u3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706105720; x=1706710520; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kinIyrY0DiVL9FjvsbU90IrpJuAQN+qhOmTSZHZdLpE=; b=ZZBTdeTUvsqpC5Um9jvX6Y3vrqKn10LUIEBOdVhzyOn1yIwGABnYkGWvERmeF3lICE jgOkJKmPjYnozMGkNvbdrqZvrgyjPj7mCkutmUyXuNffvTf0W5N1kWoc4TvDQUnqkR/x epdu/aOrbErzQr/ZUmJXdzPN8nDR5RvM8cMLmeop6y59pQfMshQcjT0ez94R9DYeq7md dupgAo6Zib5l1e+c0MQzDI+4McMzD0vW+rHkxxe0359etTYCCBL9LgNgPYNaOrJD2D5i jeyLBznGbVikoWW2OUZs5VTtixpk8B+IKQR9hBwqbf09nPon9MRDjsSS+fUb1O5JrtVy 3F1Q== X-Gm-Message-State: AOJu0YxMvDF9Z4BGqM3dU6tsWJ1ZwdNNJoEDznBLttYys+fjUMGYqvgl YiixdzCBHCbs3YvVT3hLfU8moUsmWiPPG/orxLqwD4QmXYdjkMh6ImphPcnp+Y0= X-Google-Smtp-Source: AGHT+IF4+LUhP0g/9YJ7YhuuFE5ZYZEhnJFlqdsUbpxgT5uNDQ/9YEAlGlL6+jOgnpmMApQnrgCtdA== X-Received: by 2002:a17:907:30cd:b0:a30:de41:2c with SMTP id vl13-20020a17090730cd00b00a30de41002cmr447163ejb.161.1706105720026; Wed, 24 Jan 2024 06:15:20 -0800 (PST) Received: from ttritton.c.googlers.com.com (64.227.90.34.bc.googleusercontent.com. [34.90.227.64]) by smtp.gmail.com with ESMTPSA id vu3-20020a170907a64300b00a2d7f63dd71sm12399097ejc.29.2024.01.24.06.15.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 06:15:19 -0800 (PST) From: Terry Tritton To: keescook@chromium.org, luto@amacapital.net, wad@chromium.org, shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, peter.griffin@linaro.org, kernel-team@android.com, bettyzhou@google.com, Terry Tritton Subject: [PATCH 2/3] selftests/seccomp: Change the syscall used in KILL_THREAD test Date: Wed, 24 Jan 2024 14:13:56 +0000 Message-ID: <20240124141357.1243457-3-terry.tritton@linaro.org> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog In-Reply-To: <20240124141357.1243457-1-terry.tritton@linaro.org> References: <20240124141357.1243457-1-terry.tritton@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The Bionic version of pthread_create used on Android calls the prctl function to give the stack and thread local storage a useful name. This will cause the KILL_THREAD test to fail as it will kill the thread as soon as it is created. change the test to use getpid instead of prctl. Signed-off-by: Terry Tritton --- tools/testing/selftests/seccomp/seccomp_bpf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/= selftests/seccomp/seccomp_bpf.c index 5e705674b706..da11b95b8872 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -784,7 +784,7 @@ void *kill_thread(void *data) bool die =3D (bool)data; =20 if (die) { - prctl(PR_GET_SECCOMP, 0, 0, 0, 0); + syscall(__NR_getpid); return (void *)SIBLING_EXIT_FAILURE; } =20 @@ -803,11 +803,11 @@ void kill_thread_or_group(struct __test_metadata *_me= tadata, { pthread_t thread; void *status; - /* Kill only when calling __NR_prctl. */ + /* Kill only when calling __NR_getpid. */ struct sock_filter filter_thread[] =3D { BPF_STMT(BPF_LD|BPF_W|BPF_ABS, offsetof(struct seccomp_data, nr)), - BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_prctl, 0, 1), + BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_getpid, 0, 1), BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_KILL_THREAD), BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW), }; @@ -819,7 +819,7 @@ void kill_thread_or_group(struct __test_metadata *_meta= data, struct sock_filter filter_process[] =3D { BPF_STMT(BPF_LD|BPF_W|BPF_ABS, offsetof(struct seccomp_data, nr)), - BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_prctl, 0, 1), + BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_getpid, 0, 1), BPF_STMT(BPF_RET|BPF_K, kill), BPF_STMT(BPF_RET|BPF_K, SECCOMP_RET_ALLOW), }; --=20 2.43.0.429.g432eaa2c6b-goog