pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns
PATCH 1/1 pidfs: return -EREMOTE when PIDFD_GET_INFO is called on another ns
From: Luca Boccassi <[email protected]>
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:
Change the error code so that the kernel also returns -EREMOTE in that case.
---
More context: https://sourceware.org/pipermail/libc-alpha/2026-January/174506.html
fs/pidfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/pidfs.c +1 -1
@@ -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 ) {
Signature · 1 line
2.47.3
kernel test robot
build botkernel test robot noticed "ltp.ioctl_pidfd06.fail" on:
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/[email protected]/
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 <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]
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/[email protected]
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Christian Brauner
maintainerQuoted 65 lines · kernel test robot
Hello,
kernel test robot noticed "ltp.ioctl_pidfd06.fail" on:
commit:
16cc0cf19e0b75a336cbf619d208e22b351bd430("[PATCH] pidfs: return-EREMOTEwhenPIDFD_GET_INFOis 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/[email protected]/
patch subject: [PATCH] pidfs: return-EREMOTEwhenPIDFD_GET_INFOis called on another nsin testcase: ltp
version:
with following parameters:disk: 1SSD fs: btrfs test: syscalls-00/ioctl_pidfd06config: 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 <[email protected]>
| Closes: https://lore.kernel.org/oe-lkp/[email protected]2026-02-03 16:33:15 kirk -U ltp -f temp_single_test --env TMPDIR=/fs/sdb1/tmpdirHost information
Hostname: lkp-ivb-d04 Python: 3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0] Directory: /tmp/kirk.root/tmppqdrj0byConnecting 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
Quoted 2 lines
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.
Quoted 8 lines · On Tue, Jan 27, 2026 at 10:51:37PM +0000, [email protected] wrote:
From: Luca Boccassi <[email protected]>
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'spidfd_getpid()procfs-based implementation returns-EREMOTEin 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
Christian Brauner
maintainerQuoted 18 lines · Mark Brown
Quoted 8 lines · On Tue, Jan 27, 2026 at 10:51:37PM +0000, [email protected] wrote:
From: Luca Boccassi <[email protected]>
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'spidfd_getpid()procfs-based implementation returns-EREMOTEin 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:
Quoted 6 lines
Verify that
ioctl()doesn't allow to obtain the exit status of an isolated process viaPIDFD_INFO_EXITin 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. :)