diff mbox series

selftests/pidfd: (Was: [PATCH] pidfs: cleanup the usage of do_notify_pidfd())

Message ID 20250323174518.GB834@redhat.com (mailing list archive)
State New
Headers show
Series selftests/pidfd: (Was: [PATCH] pidfs: cleanup the usage of do_notify_pidfd()) | expand

Commit Message

Oleg Nesterov March 23, 2025, 5:45 p.m. UTC
Christian,

I had to spend some (a lot;) time to understand why pidfd_info_test
(and more) fails with my patch under qemu on my machine ;) Until I
applied the patch below.

I think it is a bad idea to do the things like

	#ifndef __NR_clone3
	#define __NR_clone3 -1
	#endif

because this can hide a problem. My working laptop runs Fedora-23 which
doesn't have __NR_clone3/etc in /usr/include/. So "make" happily succeeds,
but everything fails and it is not clear why.

Oleg.
---

Comments

Christian Brauner March 23, 2025, 8:36 p.m. UTC | #1
On Sun, Mar 23, 2025 at 06:45:18PM +0100, Oleg Nesterov wrote:
> Christian,
> 
> I had to spend some (a lot;) time to understand why pidfd_info_test
> (and more) fails with my patch under qemu on my machine ;) Until I
> applied the patch below.
> 
> I think it is a bad idea to do the things like
> 
> 	#ifndef __NR_clone3
> 	#define __NR_clone3 -1
> 	#endif
> 
> because this can hide a problem. My working laptop runs Fedora-23 which
> doesn't have __NR_clone3/etc in /usr/include/. So "make" happily succeeds,
> but everything fails and it is not clear why.

Yeah, I agree. You want to send your small patch as a quick fix?
Oleg Nesterov March 23, 2025, 9:17 p.m. UTC | #2
On 03/23, Christian Brauner wrote:
>
> On Sun, Mar 23, 2025 at 06:45:18PM +0100, Oleg Nesterov wrote:
> >
> > I think it is a bad idea to do the things like
> >
> > 	#ifndef __NR_clone3
> > 	#define __NR_clone3 -1
> > 	#endif
> >
> > because this can hide a problem. My working laptop runs Fedora-23 which
> > doesn't have __NR_clone3/etc in /usr/include/. So "make" happily succeeds,
> > but everything fails and it is not clear why.
>
> Yeah, I agree. You want to send your small patch as a quick fix?

OK, will do.

FYI, I have another fixlet,

	exit_info->exit_code = tsk->exit_code;

in pidfs_exit() no longer looks correct with the recent changes.
In fact this was probably wrong after we decided to move pidfs_exit()
to release_task(), but I didn't notice this when I reviewed the last
version of "pidfs: record exit code and cgroupid at exit".

But I need to write the changelog which should explain the uglyness
we already have, and the reason for the change. Perhaps we don't
really care, but I think this should be discussed at least.

Oleg.
diff mbox series

Patch

diff --git a/tools/testing/selftests/clone3/clone3_selftests.h b/tools/testing/selftests/clone3/clone3_selftests.h
index 3d2663fe50ba..eeca8005723f 100644
--- a/tools/testing/selftests/clone3/clone3_selftests.h
+++ b/tools/testing/selftests/clone3/clone3_selftests.h
@@ -16,7 +16,7 @@ 
 #define ptr_to_u64(ptr) ((__u64)((uintptr_t)(ptr)))
 
 #ifndef __NR_clone3
-#define __NR_clone3 -1
+#define __NR_clone3 435
 #endif
 
 struct __clone_args {
diff --git a/tools/testing/selftests/pidfd/pidfd.h b/tools/testing/selftests/pidfd/pidfd.h
index cec22aa11cdf..55bcf81a2b9a 100644
--- a/tools/testing/selftests/pidfd/pidfd.h
+++ b/tools/testing/selftests/pidfd/pidfd.h
@@ -32,19 +32,19 @@ 
 #endif
 
 #ifndef __NR_pidfd_open
-#define __NR_pidfd_open -1
+#define __NR_pidfd_open 434
 #endif
 
 #ifndef __NR_pidfd_send_signal
-#define __NR_pidfd_send_signal -1
+#define __NR_pidfd_send_signal 424
 #endif
 
 #ifndef __NR_clone3
-#define __NR_clone3 -1
+#define __NR_clone3 435
 #endif
 
 #ifndef __NR_pidfd_getfd
-#define __NR_pidfd_getfd -1
+#define __NR_pidfd_getfd 438
 #endif
 
 #ifndef PIDFD_NONBLOCK