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>] [day] [month] [year] [list]
Message-ID: <20250506213535.5235-1-moonhee.lee.ca@gmail.com>
Date: Tue,  6 May 2025 14:35:35 -0700
From: Moon Hee Lee <moonhee.lee.ca@...il.com>
To: brauner@...nel.org,
	shuah@...nel.org
Cc: linux-kernel@...r.kernel.org,
	linux-kselftest@...r.kernel.org,
	skhan@...uxfoundation.org,
	linux-kernel-mentees@...ts.linux.dev,
	Moon Hee Lee <moonhee.lee.ca@...il.com>
Subject: [PATCH v2] selftests: pid_namespace: Fix missing mount headers in pid_max.c

Fix compilation errors in pid_max.c by including <sys/mount.h>, which
provides definitions for mount(), umount2(), MS_PRIVATE, MS_REC, and
MNT_DETACH.

Without this header, the build fails with implicit declarations and
undefined constants during selftest compilation.

Changes since v1:
- Included example build errors below for clarity

Compile error:
pid_max.c: In function ‘pid_max_cb’:
pid_max.c:42:15: warning: implicit declaration of function ‘mount’ [-Wimplicit-function-declaration]
   42 |         ret = mount("", "/", NULL, MS_PRIVATE | MS_REC, 0);
      |               ^~~~~
pid_max.c:42:36: error: ‘MS_PRIVATE’ undeclared; did you mean ‘MAP_PRIVATE’?
pid_max.c:42:49: error: ‘MS_REC’ undeclared
pid_max.c:48:9: warning: implicit declaration of function ‘umount2’
pid_max.c:48:26: error: ‘MNT_DETACH’ undeclared

[...output trimmed for brevity...]

make: *** [../lib.mk:222: /linux_mainline/tools/testing/selftests/pid_namespace/pid_max] Error 1

Signed-off-by: Moon Hee Lee <moonhee.lee.ca@...il.com>
---
 tools/testing/selftests/pid_namespace/pid_max.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/pid_namespace/pid_max.c b/tools/testing/selftests/pid_namespace/pid_max.c
index 51c414faabb0..972bedc475f1 100644
--- a/tools/testing/selftests/pid_namespace/pid_max.c
+++ b/tools/testing/selftests/pid_namespace/pid_max.c
@@ -11,6 +11,7 @@
 #include <string.h>
 #include <syscall.h>
 #include <sys/wait.h>
+#include <sys/mount.h>
 
 #include "../kselftest_harness.h"
 #include "../pidfd/pidfd.h"
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ