lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260110011641.81278-1-sj@kernel.org>
Date: Fri,  9 Jan 2026 17:16:40 -0800
From: SeongJae Park <sj@...nel.org>
To: Sun Jian <sun.jian.kdev@...il.com>
Cc: SeongJae Park <sj@...nel.org>,
	Shuah Khan <shuah@...nel.org>,
	linux-kselftest@...r.kernel.org,
	linux-mm@...ck.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] selftests/mm: ksm_tests: skip when not run as root

On Fri,  9 Jan 2026 17:43:13 +0800 Sun Jian <sun.jian.kdev@...il.com> wrote:

> ksm_tests writes KSM sysfs knobs under /sys/kernel/mm/ksm, which requires
> root privileges. When run unprivileged, it fails with permission errors
> and reports FAIL, which is misleading.
> 
> Skip the test early when not run as root to avoid false failures.
> 
> Signed-off-by: Sun Jian <sun.jian.kdev@...il.com>
> ---
>  tools/testing/selftests/mm/ksm_tests.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tools/testing/selftests/mm/ksm_tests.c b/tools/testing/selftests/mm/ksm_tests.c
> index a0b48b839d54..c22cd9c61711 100644
> --- a/tools/testing/selftests/mm/ksm_tests.c
> +++ b/tools/testing/selftests/mm/ksm_tests.c
> @@ -766,6 +766,11 @@ int main(int argc, char *argv[])
>  	bool merge_across_nodes = KSM_MERGE_ACROSS_NODES_DEFAULT;
>  	long size_MB = 0;
>  
> +	if (geteuid() != 0) {
> +		printf("# SKIP ksm_tests requires root privileges\n");
> +		return KSFT_SKIP;

What about using ksft_exit_skip() instead, like compaction_test.c does?


Thanks,
SJ

[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ