From nobody Fri Oct 3 16:44:19 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 DB34534A301 for ; Wed, 27 Aug 2025 13:00:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756299624; cv=none; b=L+YSSqTUuf3r/PFQOFI6cOC/7cnT6g6qkFmvw0Vp7aZbbhRtZmwKLo1AXrKpP7YmUyjN9ziB7kW8SbK+iI0xC30kV8mWwNdTFz2MlAiDlWpDs0i9kko1PtT2VgsGiTSMNq5bwulGBURxu851v4eRiFF+dMemnCb2kNvK9AHSiW8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756299624; c=relaxed/simple; bh=Wj1y8gn/J0QHpIMqAcP/x+ZIF0m6lF8e4xaVbfhkM5s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=muD4qc2nGCmdWf5VdoVMPcarXVB8Tg8ieNnNEM8IumSXmTKPCkjMSh0ixJgmtF7612iuXO7BlEwx0beRjNzTG64Nx5VCpxiKqtAwcVwO1XvaMwXZesF5PIbs8iTK6PNH3Dxh0cauWrfAOKEyki19/sCAEOGlY28Tt256/owx/ZI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=1GVufiW/; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=6spmfgn4; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="1GVufiW/"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="6spmfgn4" From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1756299619; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1OU4TYMbx3gnkGTLvEmo9Pz0rBoJv4uu7FvjyzQJmjk=; b=1GVufiW/0uNd5E+xG1zNYW3jNY7QXvBUh0U1uvYxNDzB85O0e3MtW4JOm577iplrnek/Rj C+7Im9V75o4/TTyZ/bNe23APVBU0c6vMzN7IQTGTVpAAE8XP3VvWduURZNELf3OW8wNsKS 8xpxnrN5kfI7HjBkGjNXHsEUZJTK7MMzGsi64TyJekJOBqHeX1mBai5BsidB8/uS5wHP0i x+aLFwDgW8wBZXfd8KARtOn6tnDORc7M2yMr4HExQNw8aRW3xlJerRpirl67Uo+3C+w+4N 413eEFjItNF7rKWpjVKk+Ww6rGtS7mTjcvICymUzKZ9b5FsIozogps6oNrxbHw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1756299619; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1OU4TYMbx3gnkGTLvEmo9Pz0rBoJv4uu7FvjyzQJmjk=; b=6spmfgn4KO4eAZsZSXgvG95twh2q9edNhNFHuqowKMQUhEHjYOalyxeUC78h4PHXx71fsM 5OgZwjk8hvPQEnDA== To: linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Andr=C3=A9=20Almeida?= , Darren Hart , Davidlohr Bueso , Ingo Molnar , Juri Lelli , Peter Zijlstra , Thomas Gleixner , Valentin Schneider , Borislav Petkov , Waiman Long , Sebastian Andrzej Siewior Subject: [PATCH 1/5] selftests/futex: Remove the -g parameter from futex_priv_hash Date: Wed, 27 Aug 2025 15:00:07 +0200 Message-ID: <20250827130011.677600-2-bigeasy@linutronix.de> In-Reply-To: <20250827130011.677600-1-bigeasy@linutronix.de> References: <20250827130011.677600-1-bigeasy@linutronix.de> 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 -g parameter was meant to the test the immutable global hash instead the private hash which has been made immutable. The global hash is tested as part at the end of the regular test. The immutable private hash been removed. Remove last traces of the immutable private hash. Fixes: 16adc7f136dc1 ("selftests/futex: Remove support for IMMUTABLE") Signed-off-by: Sebastian Andrzej Siewior Reviewed-by: Andr=C3=A9 Almeida --- tools/testing/selftests/futex/functional/futex_priv_hash.c | 1 - tools/testing/selftests/futex/functional/run.sh | 1 - 2 files changed, 2 deletions(-) diff --git a/tools/testing/selftests/futex/functional/futex_priv_hash.c b/t= ools/testing/selftests/futex/functional/futex_priv_hash.c index aea001ac49460..ec032faca6a91 100644 --- a/tools/testing/selftests/futex/functional/futex_priv_hash.c +++ b/tools/testing/selftests/futex/functional/futex_priv_hash.c @@ -132,7 +132,6 @@ static void usage(char *prog) { printf("Usage: %s\n", prog); printf(" -c Use color\n"); - printf(" -g Test global hash instead intead local immutable \n"); printf(" -h Display this help message\n"); printf(" -v L Verbosity level: %d=3DQUIET %d=3DCRITICAL %d=3DINFO\n", VQUIET, VCRITICAL, VINFO); diff --git a/tools/testing/selftests/futex/functional/run.sh b/tools/testin= g/selftests/futex/functional/run.sh index 81739849f2994..5470088dc4dfb 100755 --- a/tools/testing/selftests/futex/functional/run.sh +++ b/tools/testing/selftests/futex/functional/run.sh @@ -85,7 +85,6 @@ echo =20 echo ./futex_priv_hash $COLOR -./futex_priv_hash -g $COLOR =20 echo ./futex_numa_mpol $COLOR --=20 2.50.1 From nobody Fri Oct 3 16:44:19 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 1DC97192B84 for ; Wed, 27 Aug 2025 13:00:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756299624; cv=none; b=UP4E6ldZHl/3FpPmU1F6SIgqB9xGvzkYRHNvhyIUCyfwdT7SE4piet4RPfpSBf8AtcqzHIvK8C+70NKWidcHglQMBQa/2FbUuJy9bKMjr8xGayJ9Gq5cGTczIWr51xLhfLXV5WvNF5pmIYhN4i6Tr6P+1/X+oWYosPNxlSRlKIw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756299624; c=relaxed/simple; bh=HZ4zcuznyaYA5mz+3FMVlFtEKIO6itv+bsJUJaHdWUQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kf0SIDIytXtvLbxbtJNBTDNNoYUAYugSyQwcfmoMliiItfPwNmZLxKrhEtxxTTaPsGyc1ynoWE33nabs4vLdYCKmW6Ma2yAueyvOH0MCli5w6MdRwpBM6JQkirp6j/JFrirF83ujawKF3MyuBx3s8kzbA0G7i0HgwXY5FZ6j5bo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=YpRyIbxI; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=cPe49t71; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="YpRyIbxI"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="cPe49t71" From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1756299620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yt6pNORiBRMKarAJyYXvL7QTT3KKl4VK2drJoxldTRs=; b=YpRyIbxITXK3hM4iUFSuX1MrR2itsuStX3jOycoy4jpD9xXMfu3s1ZGoddfpEb/hi4+G+J fOUWNq0yelg06sjQb8xss1b16NS+TF6F8wJPe4GDlLD8DIz6PKU/OnwUSqj63Xh7eAY+c2 El+k9nhuz53YuQmhYYpMbYRkMq/HG+/rNt7xxt/4hffyDUVvukbM+VCooD3aMDX++Roo15 c35xcRbjyuiLyYI4x69O8XIjBV5Z8D3KPnVrLs25e6lM7gGbwoUkzoBjo/i6aNS1L+oF+4 VzT1SMbc0oZEahtSATsy/GRr+9b0Ab5WkzM8Oln9UOp1c7aRaXbJscpzy/n7FQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1756299620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yt6pNORiBRMKarAJyYXvL7QTT3KKl4VK2drJoxldTRs=; b=cPe49t71HvBt7JlYWs9Hs/9/jONDXbGYxEK44tOOx/2WHfhPtFGLiPRXDrk3eVepMiezEo Ps60lk1yc5HMsPAg== To: linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Andr=C3=A9=20Almeida?= , Darren Hart , Davidlohr Bueso , Ingo Molnar , Juri Lelli , Peter Zijlstra , Thomas Gleixner , Valentin Schneider , Borislav Petkov , Waiman Long , Sebastian Andrzej Siewior Subject: [PATCH 2/5] selftests/futex: Fix some futex_numa_mpol subtests Date: Wed, 27 Aug 2025 15:00:08 +0200 Message-ID: <20250827130011.677600-3-bigeasy@linutronix.de> In-Reply-To: <20250827130011.677600-1-bigeasy@linutronix.de> References: <20250827130011.677600-1-bigeasy@linutronix.de> 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" From: Waiman Long The "Memory out of range" subtest of futex_numa_mpol assumes that memory access outside of the mmap'ed area is invalid. That may not be the case depending on the actual memory layout of the test application. When that subtest was run on an x86-64 system with latest upstream kernel, the test passed as an error was returned from futex_wake(). On another powerpc system, the same subtest failed because futex_wake() returned 0. Bail out! futex2_wake(64, 0x86) should fail, but didn't Looking further into the passed subtest on x86-64, it was found that an -EINVAL was returned instead of -EFAULT. The -EINVAL error was returned because the node value test with FLAGS_NUMA set failed with a node value of 0x7f7f. IOW, the futex memory was accessible and futex_wake() failed because the supposed node number wasn't valid. If that memory location happens to have a very small value (e.g. 0), the test will pass and no error will be returned. Since this subtest is non-deterministic, it is dropped unless we explicitly set a guard page beyond the mmap region. The other problematic test is the "Memory too small" test. The futex_wake() function returns the -EINVAL error code because the given futex address isn't 8-byte aligned, not because only 4 of the 8 bytes are valid and the other 4 bytes are not. So proper name of this subtest is changed to "Mis-aligned futex" to reflect the reality. Fixes: 3163369407ba ("selftests/futex: Add futex_numa_mpol") Signed-off-by: Waiman Long Reviewed-by: Sebastian Andrzej Siewior Link: https://lore.kernel.org/r/20250810222742.290485-1-longman@redhat.com Signed-off-by: Sebastian Andrzej Siewior --- tools/testing/selftests/futex/functional/futex_numa_mpol.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/futex/functional/futex_numa_mpol.c b/t= ools/testing/selftests/futex/functional/futex_numa_mpol.c index a9ecfb2d3932a..802c15c821906 100644 --- a/tools/testing/selftests/futex/functional/futex_numa_mpol.c +++ b/tools/testing/selftests/futex/functional/futex_numa_mpol.c @@ -182,12 +182,10 @@ int main(int argc, char *argv[]) if (futex_numa->numa =3D=3D FUTEX_NO_NODE) ksft_exit_fail_msg("NUMA node is left uninitialized\n"); =20 - ksft_print_msg("Memory too small\n"); + /* FUTEX2_NUMA futex must be 8-byte aligned */ + ksft_print_msg("Mis-aligned futex\n"); test_futex(futex_ptr + mem_size - 4, 1); =20 - ksft_print_msg("Memory out of range\n"); - test_futex(futex_ptr + mem_size, 1); - futex_numa->numa =3D FUTEX_NO_NODE; mprotect(futex_ptr, mem_size, PROT_READ); ksft_print_msg("Memory, RO\n"); --=20 2.50.1 From nobody Fri Oct 3 16:44:19 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 1DD6F350D5D for ; Wed, 27 Aug 2025 13:00:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756299624; cv=none; b=F75Wfbk+SU0vQX0JcfrI4MobwtkR9e883AUgWC3A2nDbEBJaLFV8gFdP/OCkzucXu9LqV8lOED/ElXFrLWH14DQraTFonYFlMHQgNtA3yJWQi3F+08LgAm/PtVi87sdLPWgi0XW1b0ioEMyJeSY4UGcT9yTwvXs0X+siZAzcfHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756299624; c=relaxed/simple; bh=mGHLepCtQCEvWNdCKD1LIrK3CPcYLarbvtrKP78/pJE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ehxJjsRtCn3WryZDUX026FmM/spmUGp/KxgrigowUJZLRpDiI8QbgEIjZExati3Nl9cRvzXMUgyT2Qh6N5UlLGMXDmZTRvBb7W427sFZA0csqaZb1vdb7PxkuITQMSS/K40GRXHm3lDBEXlhCBRrKPiKf7ZKpELP8ktPGXlSS5A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=s1m/NoT3; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=C6v8s54U; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="s1m/NoT3"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="C6v8s54U" From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1756299620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5Xjtv3RawB4rRYFQ7stZq2BhYBo38SrKDEASGX4ZpU4=; b=s1m/NoT321CUGWAFY+3YHhjTwo20ap8v4BAPwz51olr5GTXwIZhMgmRMJG5urGvkgOyKvk PZFRnCW+gLqXY5EcIWn4Aw7L3Wk3fjSQ6PR39Dzhs2pdUQ3Bkw12impLP9OfR0veZ7kNcA SOUXFf27WpGDqM9HJu57rayqMyg/w2XVwA+zmyGsEhc3RJbd8q7fWeFHPKDuG8ATkNtk5x QfI1a/rRyvY/SGvNXvnjiOnnFbS3KoUrfhMcOWeWI1osjHKOscNowpKYu2Pl2owzJtO4WS th2Vf9Dc/IBbvGWmii8gM+37USS2+lXod/9ZsoDXh/wIcHVe+djWAFC81CGByA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1756299620; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5Xjtv3RawB4rRYFQ7stZq2BhYBo38SrKDEASGX4ZpU4=; b=C6v8s54U0JlCRICNxOP2EoyCRFI0e6p3fbSmXIgu0Y8YWjQKESYfaZglfAd0rGeAMC/3kI 2H/XxKfzEWvZ0MAQ== To: linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Andr=C3=A9=20Almeida?= , Darren Hart , Davidlohr Bueso , Ingo Molnar , Juri Lelli , Peter Zijlstra , Thomas Gleixner , Valentin Schneider , Borislav Petkov , Waiman Long , Nai-Chen Cheng , Sebastian Andrzej Siewior Subject: [PATCH 3/5] selftests/futex: fix format-security warnings in futex_priv_hash Date: Wed, 27 Aug 2025 15:00:09 +0200 Message-ID: <20250827130011.677600-4-bigeasy@linutronix.de> In-Reply-To: <20250827130011.677600-1-bigeasy@linutronix.de> References: <20250827130011.677600-1-bigeasy@linutronix.de> 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" From: Nai-Chen Cheng Fix format-security warnings by using proper format strings when passing message variables to ksft_exit_fail_msg(), ksft_test_result_pass(), and ksft_test_result_skip() function. This prevents potential security issues and eliminates compiler warnings when building with -Wformat-security. Signed-off-by: Nai-Chen Cheng Link: https://lore.kernel.org/r/20250812005048.59892-1-bleach1827@gmail.com Signed-off-by: Sebastian Andrzej Siewior --- .../selftests/futex/functional/futex_priv_hash.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/futex/functional/futex_priv_hash.c b/t= ools/testing/selftests/futex/functional/futex_priv_hash.c index ec032faca6a91..ffd60d03a992b 100644 --- a/tools/testing/selftests/futex/functional/futex_priv_hash.c +++ b/tools/testing/selftests/futex/functional/futex_priv_hash.c @@ -192,10 +192,10 @@ int main(int argc, char *argv[]) futex_slots1 =3D futex_hash_slots_get(); if (futex_slots1 <=3D 0) { ksft_print_msg("Current hash buckets: %d\n", futex_slots1); - ksft_exit_fail_msg(test_msg_auto_create); + ksft_exit_fail_msg("%s", test_msg_auto_create); } =20 - ksft_test_result_pass(test_msg_auto_create); + ksft_test_result_pass("%s", test_msg_auto_create); =20 online_cpus =3D sysconf(_SC_NPROCESSORS_ONLN); ret =3D pthread_barrier_init(&barrier_main, NULL, MAX_THREADS + 1); @@ -236,11 +236,11 @@ int main(int argc, char *argv[]) } ksft_print_msg("Expected increase of hash buckets but got: %d -> %d\n", futex_slots1, futex_slotsn); - ksft_exit_fail_msg(test_msg_auto_inc); + ksft_exit_fail_msg("%s", test_msg_auto_inc); } - ksft_test_result_pass(test_msg_auto_inc); + ksft_test_result_pass("%s", test_msg_auto_inc); } else { - ksft_test_result_skip(test_msg_auto_inc); + ksft_test_result_skip("%s", test_msg_auto_inc); } ret =3D pthread_mutex_unlock(&global_lock); =20 --=20 2.50.1 From nobody Fri Oct 3 16:44:19 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 2E2FA350D68 for ; Wed, 27 Aug 2025 13:00:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756299625; cv=none; b=cFXnxzApOe5XlgoHsUuhTUV3s963FfvVxRgIBGtTOxq8SVL/44EdphO5hBsIlqVEK6zX0PETKQc6ANTdPTsk0U2TjzHGTDMonVSWmybe4oGOlWW84ikdC0Se0PufytMQqredsiOSNfIubxLIW1NiHzBqknA/wcH0RydTjtMt99s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756299625; c=relaxed/simple; bh=O3AhWn94wsXGAp86y1AsA0NZFEADYxt/dkM7qJD6TzQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OO96fa+1ax6NfSYvVsgh1sgmidmmMg6pT1dVqo9mSSCmELyR6/Qpbo51BGJHXhsD0Q8TKG+vMNQoLFYXBKb6oY7MTywgJ1l1uVAee7Ue2Sl/3xPACgrnioOKLhIPsloX8tw5JJ4mCAvVu2MHjLWMu+RDe0B5z7GvYzHWyF7wO9s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=wvpqKMtu; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=jRx2PEIe; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="wvpqKMtu"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="jRx2PEIe" From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1756299621; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WB6FFSOhPnIA8CFfbKPevdZs4Nwx7FbW8ef3Pc1GPAk=; b=wvpqKMtugebNKK6XrT4f8aORyqfmYIwhNgAN2xahlpwkEh0NP2rCPAvhuCFEyQlpxrc8py bDz4q0thn/T5iHfbM7wmvQiKl4N4JGMcZ9IxJkkMfUIQhlkYwRRLyxDcgvLJDCLvS9L/hI mVqovdXT3slm3odeJvLosXGhrFgbqTCjPX9/PaX4IuJGDOytBajGPIjLdEFIyoy3lX1ew8 Kg2pCliGxMPbzNW+WjSDpmvqDyw3P/9zHHkXvKujlG+985jlx6yVscZgD1jrDMYJIMPMEG 6p3JP6SYOZhyV7C0ZywEm2AmulYOfjsLYE0gQ0wesBdk/FvnyU9FCfbZPRCSCQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1756299621; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WB6FFSOhPnIA8CFfbKPevdZs4Nwx7FbW8ef3Pc1GPAk=; b=jRx2PEIeXPdiaPdQwGB41BkVu3WK613RVV9FPtXZftJPPFzC8Qssc9rLQeFvH0mtvvFgSG KTZAc433pC9yukAg== To: linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Andr=C3=A9=20Almeida?= , Darren Hart , Davidlohr Bueso , Ingo Molnar , Juri Lelli , Peter Zijlstra , Thomas Gleixner , Valentin Schneider , Borislav Petkov , Waiman Long , Gopi Krishna Menon , Sebastian Andrzej Siewior Subject: [PATCH 4/5] selftests/futex: fix typos and grammar in futex_priv_hash Date: Wed, 27 Aug 2025 15:00:10 +0200 Message-ID: <20250827130011.677600-5-bigeasy@linutronix.de> In-Reply-To: <20250827130011.677600-1-bigeasy@linutronix.de> References: <20250827130011.677600-1-bigeasy@linutronix.de> 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" From: Gopi Krishna Menon Fix multiple typos and small grammar issues in help text, comments and test messages in futex_priv_hash test. Signed-off-by: Gopi Krishna Menon Link: https://lore.kernel.org/r/20250819155755.4665-1-krishnagopi487@gmail.= com Signed-off-by: Sebastian Andrzej Siewior Reviewed-by: Andr=C3=A9 Almeida --- .../testing/selftests/futex/functional/futex_priv_hash.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/futex/functional/futex_priv_hash.c b/t= ools/testing/selftests/futex/functional/futex_priv_hash.c index ffd60d03a992b..95f01603a6813 100644 --- a/tools/testing/selftests/futex/functional/futex_priv_hash.c +++ b/tools/testing/selftests/futex/functional/futex_priv_hash.c @@ -188,7 +188,7 @@ int main(int argc, char *argv[]) if (ret !=3D 0) ksft_exit_fail_msg("pthread_join() failed: %d, %m\n", ret); =20 - /* First thread, has to initialiaze private hash */ + /* First thread, has to initialize private hash */ futex_slots1 =3D futex_hash_slots_get(); if (futex_slots1 <=3D 0) { ksft_print_msg("Current hash buckets: %d\n", futex_slots1); @@ -256,17 +256,17 @@ int main(int argc, char *argv[]) =20 futex_hash_slots_set_verify(2); join_max_threads(); - ksft_test_result(counter =3D=3D MAX_THREADS, "Created of waited for %d of= %d threads\n", + ksft_test_result(counter =3D=3D MAX_THREADS, "Created and waited for %d o= f %d threads\n", counter, MAX_THREADS); counter =3D 0; - /* Once the user set something, auto reisze must be disabled */ + /* Once the user set something, auto resize must be disabled */ ret =3D pthread_barrier_init(&barrier_main, NULL, MAX_THREADS); =20 create_max_threads(thread_lock_fn); join_max_threads(); =20 ret =3D futex_hash_slots_get(); - ksft_test_result(ret =3D=3D 2, "No more auto-resize after manaul setting,= got %d\n", + ksft_test_result(ret =3D=3D 2, "No more auto-resize after manual setting,= got %d\n", ret); =20 futex_hash_slots_set_must_fail(1 << 29); --=20 2.50.1 From nobody Fri Oct 3 16:44:19 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 B47F6352072 for ; Wed, 27 Aug 2025 13:00:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756299626; cv=none; b=EP9rjHjSKi6+SlXocWDg42ZBR6cufGHNf8w87AS5Li1MEpEm4XcHCOWEgTT3md+6aHEIqotrrzh0zaD4t03Y2Ay9qwJrLlcwQ6e83Qf6OsbUwbZcUmEzam0tsR5qU/Vetmr+qa5QZV8cjd1jX7tlwUhsRNCbABWIgQk+YOboBHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756299626; c=relaxed/simple; bh=TfFEfr5s064S3vJCTGQQHgqn9d+T4y0vFjYbEftXXqw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G/JF7hwCYweVB0pkRbeCcXSAa1C8tTvKAmrFVk2laWWVK3Y0UsckO0eW7t23vLNf5hQo18MYYSb4j4ISpXP0CmuNMCzEXXgkw3pROhl6RrbEYjljJBec2NHZuSlKcecjZy+K6Ezpxg1pnOTiwfgvsq8QsdrmITXrEVV06SzF+FM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=wgn52CyE; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=JRXfaBpH; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="wgn52CyE"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="JRXfaBpH" From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1756299622; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mDGRB9Y+2+cEKCn+VJWaTdBnPH653Bxj7PgTKgx67QY=; b=wgn52CyEi2JAth9QiC7hYJQVqGgoYu6NxcjTypJb9nf4xs2oialhgaJoOYPIS7DGwPu8oo 6KydDjUAKZbGnezATHGO3p3Emirz5sP2kpdA9VNmQKNPAeqkWIMe23NSlAkAqPKNPT1KFM W0eD8pJCL7uLrUIZMjTYjj2a4c39fJ/Pi/AyGYUf8a6mrYykyryQVEEDdVxPYqe5Qha2E9 rHt40FIBDQJet136pGjCgRJKriX/EjUf94Oj0HcG2L1B2ToBwwXXZpKtuZxSDSsVpSU4dD j9ufmmQTDB41ksHEYBb/w91bjD0tbGIoVKXPhPF9w4Ex0fdcKP7FVsqJQyKEqA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1756299622; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mDGRB9Y+2+cEKCn+VJWaTdBnPH653Bxj7PgTKgx67QY=; b=JRXfaBpHP9J9/8ZgDF6kxQmp6hDlm+LcBFmVTcAcddNIKt2uOjSUA/pWKvdM0sxHZMPmee pPEDZ+P16uS8WwAg== To: linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Andr=C3=A9=20Almeida?= , Darren Hart , Davidlohr Bueso , Ingo Molnar , Juri Lelli , Peter Zijlstra , Thomas Gleixner , Valentin Schneider , Borislav Petkov , Waiman Long , Dan Carpenter , Anders Roxell , Sebastian Andrzej Siewior Subject: [PATCH 5/5] selftests/futex: fix futex_wait() for 32bit ARM Date: Wed, 27 Aug 2025 15:00:11 +0200 Message-ID: <20250827130011.677600-6-bigeasy@linutronix.de> In-Reply-To: <20250827130011.677600-1-bigeasy@linutronix.de> References: <20250827130011.677600-1-bigeasy@linutronix.de> 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" From: Dan Carpenter On 32bit ARM systems gcc-12 will use 32bit timestamps while gcc-13 and later will use 64bit timestamps. The problem is that SYS_futex will continue pointing at the 32bit system call. This makes the futex_wait test fail like this: waiter failed errno 110 not ok 1 futex_wake private returned: 0 Success waiter failed errno 110 not ok 2 futex_wake shared (page anon) returned: 0 Success waiter failed errno 110 not ok 3 futex_wake shared (file backed) returned: 0 Success Instead of compiling differently depending on the gcc version, use the -D_FILE_OFFSET_BITS=3D64 -D_TIME_BITS=3D64 options to ensure that we are building with 64bit timestamps. Then use ifdefs to make SYS_futex point to the 64bit system call. Signed-off-by: Dan Carpenter Tested-by: Anders Roxell Link: https://lore.kernel.org/r/ebd4a415169f9a3153bbd3c1fe6244511c9d1cb3.17= 56217858.git.dan.carpenter@linaro.org Signed-off-by: Sebastian Andrzej Siewior Reviewed-by: Andr=C3=A9 Almeida --- tools/testing/selftests/futex/functional/Makefile | 2 +- tools/testing/selftests/futex/include/futextest.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/futex/functional/Makefile b/tools/test= ing/selftests/futex/functional/Makefile index 8cfb87f7f7c50..ddfa61d857b9b 100644 --- a/tools/testing/selftests/futex/functional/Makefile +++ b/tools/testing/selftests/futex/functional/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 INCLUDES :=3D -I../include -I../../ $(KHDR_INCLUDES) -CFLAGS :=3D $(CFLAGS) -g -O2 -Wall -pthread $(INCLUDES) $(KHDR_INCLUDES) +CFLAGS :=3D $(CFLAGS) -g -O2 -Wall -pthread -D_FILE_OFFSET_BITS=3D64 -D_TI= ME_BITS=3D64 $(INCLUDES) $(KHDR_INCLUDES) LDLIBS :=3D -lpthread -lrt -lnuma =20 LOCAL_HDRS :=3D \ diff --git a/tools/testing/selftests/futex/include/futextest.h b/tools/test= ing/selftests/futex/include/futextest.h index 7a5fd1d5355e7..3d48e9789d9fe 100644 --- a/tools/testing/selftests/futex/include/futextest.h +++ b/tools/testing/selftests/futex/include/futextest.h @@ -58,6 +58,17 @@ typedef volatile u_int32_t futex_t; #define SYS_futex SYS_futex_time64 #endif =20 +/* + * On 32bit systems if we use "-D_FILE_OFFSET_BITS=3D64 -D_TIME_BITS=3D64"= or if + * we are using a newer compiler then the size of the timestamps will be 6= 4bit, + * however, the SYS_futex will still point to the 32bit futex system call. + */ +#if __SIZEOF_POINTER__ =3D=3D 4 && defined(SYS_futex_time64) && \ + defined(_TIME_BITS) && _TIME_BITS =3D=3D 64 +# undef SYS_futex +# define SYS_futex SYS_futex_time64 +#endif + /** * futex() - SYS_futex syscall wrapper * @uaddr: address of first futex --=20 2.50.1