public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns
@ 2026-01-27 22:51 luca.boccassi
  2026-02-06  2:51 ` kernel test robot
  2026-02-12 17:01 ` Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: luca.boccassi @ 2026-01-27 22:51 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: christian

From: Luca Boccassi <luca.boccassi@gmail.com>

Currently it is not possible to distinguish between the case where a
process has already exited and the case where a process is in a
different namespace, as both return -ESRCH.
glibc's pidfd_getpid() procfs-based implementation returns -EREMOTE
in the latter, so that distinguishing the two is possible, as the
fdinfo in procfs will list '0' as the PID in that case:

https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/pidfd_getpid.c;h=860829cf07da2267484299ccb02861822c0d07b4;hb=HEAD#l121

Change the error code so that the kernel also returns -EREMOTE in
that case.

Fixes: 7477d7dce48a ("pidfs: allow to retrieve exit information")

Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
More context: https://sourceware.org/pipermail/libc-alpha/2026-January/174506.html

 fs/pidfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/pidfs.c b/fs/pidfs.c
index 1e20e36e0ed5..d18c51513f6c 100644
--- a/fs/pidfs.c
+++ b/fs/pidfs.c
@@ -329,7 +329,7 @@ static long pidfd_info(struct file *file, unsigned int cmd, unsigned long arg)
 	 * namespace hierarchy.
 	 */
 	if (!pid_in_current_pidns(pid))
-		return -ESRCH;
+		return -EREMOTE;
 
 	attr = READ_ONCE(pid->attr);
 	if (mask & PIDFD_INFO_EXIT) {
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns
  2026-01-27 22:51 [PATCH] pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns luca.boccassi
@ 2026-02-06  2:51 ` kernel test robot
  2026-02-06 12:24   ` Christian Brauner
  2026-02-12 17:01 ` Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: kernel test robot @ 2026-02-06  2:51 UTC (permalink / raw)
  To: luca.boccassi; +Cc: oe-lkp, lkp, linux-fsdevel, ltp, christian, oliver.sang



Hello,

kernel test robot noticed "ltp.ioctl_pidfd06.fail" on:

commit: 16cc0cf19e0b75a336cbf619d208e22b351bd430 ("[PATCH] pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns")
url: https://github.com/intel-lab-lkp/linux/commits/luca-boccassi-gmail-com/pidfs-return-EREMOTE-when-PIDFD_GET_INFO-is-called-on-another-ns/20260128-065425
base: https://git.kernel.org/cgit/linux/kernel/git/vfs/vfs.git vfs.all
patch link: https://lore.kernel.org/all/20260127225209.2293342-1-luca.boccassi@gmail.com/
patch subject: [PATCH] pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns

in testcase: ltp
version: 
with following parameters:

	disk: 1SSD
	fs: btrfs
	test: syscalls-00/ioctl_pidfd06



config: x86_64-rhel-9.4-ltp
compiler: gcc-14
test machine: 4 threads 1 sockets Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz (Ivy Bridge) with 8G memory

(please refer to attached dmesg/kmsg for entire log/backtrace)


If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <oliver.sang@intel.com>
| Closes: https://lore.kernel.org/oe-lkp/202602061056.b94e9170-lkp@intel.com


2026-02-03 16:33:15 kirk -U ltp -f temp_single_test --env TMPDIR=/fs/sdb1/tmpdir
Host information

	Hostname:   lkp-ivb-d04
	Python:     3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0]
	Directory:  /tmp/kirk.root/tmppqdrj0by

Connecting to SUT: default

Starting suite: temp_single_test
---------------------------------
^[[1;37mioctl_pidfd06: ^[[0m^[[1;31mfail^[[0m | ^[[1;33mtainted^[[0m  (0.034s)
                                                                                                                                
Execution time: 0.100s

	Suite:       temp_single_test
	Total runs:  1
	Runtime:     0.034s
	Passed:      0
	Failed:      1
	Skipped:     0
	Broken:      0
	Warnings:    0
	Kernel:      Linux 6.19.0-rc5-00159-g16cc0cf19e0b #1 SMP PREEMPT_DYNAMIC Tue Feb  3 23:56:34 CST 2026
	Machine:     unknown
	Arch:        x86_64
	RAM:         6899592 kB
	Swap:        0 kB
	Distro:      debian 13

Disconnecting from SUT: default
Session stopped



The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20260206/202602061056.b94e9170-lkp@intel.com



-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns
  2026-02-06  2:51 ` kernel test robot
@ 2026-02-06 12:24   ` Christian Brauner
  0 siblings, 0 replies; 5+ messages in thread
From: Christian Brauner @ 2026-02-06 12:24 UTC (permalink / raw)
  To: kernel test robot
  Cc: luca.boccassi, oe-lkp, lkp, linux-fsdevel, ltp, christian

On Fri, Feb 06, 2026 at 10:51:24AM +0800, kernel test robot wrote:
> 
> 
> Hello,
> 
> kernel test robot noticed "ltp.ioctl_pidfd06.fail" on:
> 
> commit: 16cc0cf19e0b75a336cbf619d208e22b351bd430 ("[PATCH] pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns")
> url: https://github.com/intel-lab-lkp/linux/commits/luca-boccassi-gmail-com/pidfs-return-EREMOTE-when-PIDFD_GET_INFO-is-called-on-another-ns/20260128-065425
> base: https://git.kernel.org/cgit/linux/kernel/git/vfs/vfs.git vfs.all
> patch link: https://lore.kernel.org/all/20260127225209.2293342-1-luca.boccassi@gmail.com/
> patch subject: [PATCH] pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns
> 
> in testcase: ltp
> version: 
> with following parameters:
> 
> 	disk: 1SSD
> 	fs: btrfs
> 	test: syscalls-00/ioctl_pidfd06
> 
> 
> 
> config: x86_64-rhel-9.4-ltp
> compiler: gcc-14
> test machine: 4 threads 1 sockets Intel(R) Core(TM) i3-3220 CPU @ 3.30GHz (Ivy Bridge) with 8G memory
> 
> (please refer to attached dmesg/kmsg for entire log/backtrace)
> 
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <oliver.sang@intel.com>
> | Closes: https://lore.kernel.org/oe-lkp/202602061056.b94e9170-lkp@intel.com
> 
> 
> 2026-02-03 16:33:15 kirk -U ltp -f temp_single_test --env TMPDIR=/fs/sdb1/tmpdir
> Host information
> 
> 	Hostname:   lkp-ivb-d04
> 	Python:     3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0]
> 	Directory:  /tmp/kirk.root/tmppqdrj0by
> 
> Connecting to SUT: default
> 
> Starting suite: temp_single_test
> ---------------------------------
> ^[[1;37mioctl_pidfd06: ^[[0m^[[1;31mfail^[[0m | ^[[1;33mtainted^[[0m  (0.034s)
>                                                                                                                                 
> Execution time: 0.100s
> 
> 	Suite:       temp_single_test
> 	Total runs:  1
> 	Runtime:     0.034s
> 	Passed:      0
> 	Failed:      1
> 	Skipped:     0
> 	Broken:      0
> 	Warnings:    0
> 	Kernel:      Linux 6.19.0-rc5-00159-g16cc0cf19e0b #1 SMP PREEMPT_DYNAMIC Tue Feb  3 23:56:34 CST 2026
> 	Machine:     unknown
> 	Arch:        x86_64
> 	RAM:         6899592 kB
> 	Swap:        0 kB
> 	Distro:      debian 13
> 
> Disconnecting from SUT: default
> Session stopped

Thanks! This is an intentional change in behavior and only affects
systemd which is happy to adapt to that change.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns
  2026-01-27 22:51 [PATCH] pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns luca.boccassi
  2026-02-06  2:51 ` kernel test robot
@ 2026-02-12 17:01 ` Mark Brown
  2026-02-14 12:27   ` Christian Brauner
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Brown @ 2026-02-12 17:01 UTC (permalink / raw)
  To: luca.boccassi; +Cc: linux-fsdevel, christian

[-- Attachment #1: Type: text/plain, Size: 3677 bytes --]

On Tue, Jan 27, 2026 at 10:51:37PM +0000, luca.boccassi@gmail.com wrote:
> From: Luca Boccassi <luca.boccassi@gmail.com>
> 
> Currently it is not possible to distinguish between the case where a
> process has already exited and the case where a process is in a
> different namespace, as both return -ESRCH.
> glibc's pidfd_getpid() procfs-based implementation returns -EREMOTE
> in the latter, so that distinguishing the two is possible, as the
> fdinfo in procfs will list '0' as the PID in that case:

This is in today's next and is triggering a failure in the LTP pidfd06
testcase:

  ioctl_pidfd06.c:44: TFAIL: ioctl(pidfd, PIDFD_GET_INFO, info) expected ESRCH: EREMOTE (66)

which is the change that the changelog says will be introduced however
the commit log for the LTP test says:

    Verify that ioctl() doesn't allow to obtain the exit status of an
    isolated process via PIDFD_INFO_EXIT in within an another isolated
    process, which doesn't have any parent connection.

which does sound like there might actually be a problem but I've made no
effort to investigate.

Full log:

  https://lava.sirena.org.uk/scheduler/job/2451827#L4882

bisect log:

# bad: [af98e93c5c39e6d0b87b42f0a32dd3066f795718] Add linux-next specific files for 20260212
# good: [710dadb69a145f40658bc82ec9552d835d680223] Merge branch 'for-linux-next-fixes' of https://gitlab.freedesktop.org/drm/misc/kernel.git
# good: [40210c2b11a873ff64a812c2d2600f529f01a83e] rust: seq_file: replace `kernel::c_str!` with C-Strings
# good: [b3c78bc53630d14a5770451ede3a30e7052f3b8b] nfsd: do not allow exporting of special kernel filesystems
# good: [a39162f77f49b618df5a721a1e48d8b903280fbd] exportfs: clarify the documentation of open()/permission() expotrfs ops
git bisect start 'af98e93c5c39e6d0b87b42f0a32dd3066f795718' '710dadb69a145f40658bc82ec9552d835d680223' '40210c2b11a873ff64a812c2d2600f529f01a83e' 'b3c78bc53630d14a5770451ede3a30e7052f3b8b' 'a39162f77f49b618df5a721a1e48d8b903280fbd'
# test job: [40210c2b11a873ff64a812c2d2600f529f01a83e] https://lava.sirena.org.uk/scheduler/job/2450238
# test job: [b3c78bc53630d14a5770451ede3a30e7052f3b8b] https://lava.sirena.org.uk/scheduler/job/2450361
# test job: [a39162f77f49b618df5a721a1e48d8b903280fbd] https://lava.sirena.org.uk/scheduler/job/2450244
# test job: [af98e93c5c39e6d0b87b42f0a32dd3066f795718] https://lava.sirena.org.uk/scheduler/job/2451827
# bad: [af98e93c5c39e6d0b87b42f0a32dd3066f795718] Add linux-next specific files for 20260212
git bisect bad af98e93c5c39e6d0b87b42f0a32dd3066f795718
# test job: [0320ace7394a2fc7d1b81c25d1f1c7cf02ff3479] https://lava.sirena.org.uk/scheduler/job/2450155
# bad: [0320ace7394a2fc7d1b81c25d1f1c7cf02ff3479] Merge branch 'deferred.misc-7.0' into vfs.all
git bisect bad 0320ace7394a2fc7d1b81c25d1f1c7cf02ff3479
# test job: [ab89060fbc92edd6e852bf0f533f29140afabe0e] https://lava.sirena.org.uk/scheduler/job/2450267
# bad: [ab89060fbc92edd6e852bf0f533f29140afabe0e] pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns
git bisect bad ab89060fbc92edd6e852bf0f533f29140afabe0e
# first bad commit: [ab89060fbc92edd6e852bf0f533f29140afabe0e] pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns
# test job: [72c395024dac5e215136cbff793455f065603b06] https://lava.sirena.org.uk/scheduler/job/2444162
# good: [72c395024dac5e215136cbff793455f065603b06] Merge tag 'docs-7.0' of git://git.kernel.org/pub/scm/linux/kernel/git/docs/linux
git bisect good 72c395024dac5e215136cbff793455f065603b06
# first bad commit: [ab89060fbc92edd6e852bf0f533f29140afabe0e] pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns
  2026-02-12 17:01 ` Mark Brown
@ 2026-02-14 12:27   ` Christian Brauner
  0 siblings, 0 replies; 5+ messages in thread
From: Christian Brauner @ 2026-02-14 12:27 UTC (permalink / raw)
  To: Mark Brown; +Cc: luca.boccassi, linux-fsdevel, christian

On Thu, Feb 12, 2026 at 05:01:42PM +0000, Mark Brown wrote:
> On Tue, Jan 27, 2026 at 10:51:37PM +0000, luca.boccassi@gmail.com wrote:
> > From: Luca Boccassi <luca.boccassi@gmail.com>
> > 
> > Currently it is not possible to distinguish between the case where a
> > process has already exited and the case where a process is in a
> > different namespace, as both return -ESRCH.
> > glibc's pidfd_getpid() procfs-based implementation returns -EREMOTE
> > in the latter, so that distinguishing the two is possible, as the
> > fdinfo in procfs will list '0' as the PID in that case:
> 
> This is in today's next and is triggering a failure in the LTP pidfd06
> testcase:
> 
>   ioctl_pidfd06.c:44: TFAIL: ioctl(pidfd, PIDFD_GET_INFO, info) expected ESRCH: EREMOTE (66)
> 
> which is the change that the changelog says will be introduced however
> the commit log for the LTP test says:
> 
>     Verify that ioctl() doesn't allow to obtain the exit status of an
>     isolated process via PIDFD_INFO_EXIT in within an another isolated
>     process, which doesn't have any parent connection.
> 
> which does sound like there might actually be a problem but I've made no
> effort to investigate.

Thanks for reporting. This is an intentional change. :)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-02-14 12:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-27 22:51 [PATCH] pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns luca.boccassi
2026-02-06  2:51 ` kernel test robot
2026-02-06 12:24   ` Christian Brauner
2026-02-12 17:01 ` Mark Brown
2026-02-14 12:27   ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox