Skip to contentSkip to conversation

pseudo abort with req '/proc/self/fd/3'

bitbake-devel Sam Liddicott 2 participants 6 messages Feb 28, 2024 – Mar 28, 2025 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Despite my hints I don't think it is safe to use dev_t as part of the key because I don't think it is guaranteed to be consistent across reboots or even remounts for the case where temporary file system mounts (e.g. overlayfs) might be in use for the build workspace or subdirs.

(I am using bind mounting in a mount namespace during bitbake to make sure all workspaces appear as the same path in order to get better caching of sstate artifacts compile and install steps).

So maybe we want to limit pseudo caching only to the workdir filesystem by default, but certainly exclude /proc /dev etc

Sam

Quoted 42 lines · On Wed, 28 Feb 2024, 15:32 Sam Liddicott via lists.openembedded.org, <sam=…

On a kirkstone build I just got an unexpected and reproducible do_install abort:

| abort()ing pseudo client by server request. See
https://wiki.yoctoproject.org/wiki/Pseudo_Abort for more details on this. ... path mismatch [1 link]: ino 594677 db '/.../common/config/private' req '/proc/self/fd/3'
A conflict with /proc is most surprising, why is that even in the pseudo database?

Adding this line to the global config fixed it consistently:
PSEUDO_IGNORE_PATHS:append=",/proc,/dev,/sys"

But I wondered how there was a conflict, and then I looked again at the abort message.

Is it possible that pseudo only uses inode number without the dev node as the key?

struct stat {
dev_t st_dev; /* ID of device containing file */
ino_t st_ino; /* Inode number */

I would think that only the combination of both is unique across the system.

If dev_t is not part of the key, then I suggest that all paths are ignored that are not on the same dev_t as the workspace.

Sam

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#15975):
https://lists.openembedded.org/g/bitbake-devel/message/15975
Mute This Topic: https://lists.openembedded.org/mt/104624826/7497305
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 6 lines · Sam Liddicott

Despite my hints I don't think it is safe to use dev_t as part of the key because I don't think it is guaranteed to be consistent across reboots or even remounts for the case where temporary file system mounts (e.g. overlayfs) might be in use for the build workspace or subdirs.

Quoted 6 lines

(I am using bind mounting in a mount namespace during bitbake to make sure all workspaces appear as the same path in order to get better caching of sstate artifacts compile and install steps).

So maybe we want to limit pseudo caching only to the workdir filesystem by default, but certainly exclude /proc /dev etc

Unfortunately it isn't that simple. /proc/ can contain links and references to other places on the system.

Even with your example, /proc/self/fd/3 might be a file in workdir which has been opened by a process and given a file descriptor. If you perform an ownership/mode change on that /proc entry, pseudo does need to intercept it and apply it to the file in workdir.

So whilst /dev and /sys are perhaps arguable, we do have to look at proc.

Cheers,

Richard

#3 lore raw

Won't the symlink target have its own db entry when resolved?

Or if not, how should we cope with the inode clashes across different file systems?

Quoted 29 lines · Richard Purdie
Quoted 6 lines · Sam Liddicott

Despite my hints I don't think it is safe to use dev_t as part of the key because I don't think it is guaranteed to be consistent across reboots or even remounts for the case where temporary file system mounts (e.g. overlayfs) might be in use for the build workspace or subdirs.

Quoted 6 lines

(I am using bind mounting in a mount namespace during bitbake to make sure all workspaces appear as the same path in order to get better caching of sstate artifacts compile and install steps).

So maybe we want to limit pseudo caching only to the workdir filesystem by default, but certainly exclude /proc /dev etc

Unfortunately it isn't that simple. /proc/ can contain links and references to other places on the system.

Even with your example, /proc/self/fd/3 might be a file in workdir which has been opened by a process and given a file descriptor. If you perform an ownership/mode change on that /proc entry, pseudo does need to intercept it and apply it to the file in workdir.

So whilst /dev and /sys are perhaps arguable, we do have to look at proc.

Cheers,

Richard

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

This is becoming a problem for quite a few of our developers who are able to proceed with PSEUDO_IGNORE_PATHS:append=",/proc,/dev,/sys"

I understand that PSEUDO_IGNORE_PATHS refers to the host file system paths, not the pseudo file system paths so how does excluding these cause a problem?

I should add that we are also using the patch from Matt Cowell in 2019:

Quoted 4 lines

From cb69146d18382f272e347338cfc5a8930f693ed6 Mon Sep 17 00:00:00 2001
From: Matt Cowell <[email protected]>
Date: Wed, 17 Apr 2019 15:51:07 -0500
Subject: [PATCH] pseudo_fix_path: do not expand symlinks in /proc

otherwise our recipes fail on access to /dev/fd/3 and /dev/stdout and "files" of that nature, due to pseudo failing to properly resolve symlinks, as discussed here:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=13288#c14

In any case, the general problem exists of how to deal with clashing inodes. Perhaps we are more prone to this issue because we are using user namespaces and mount namespaces to bind mount the build output dir so that it always appears at the same path, so that we get better SSTATE caching, maybe this makes inode clashing more likely.

Sam

Quoted 49 lines · Sam Liddicott via lists.openembedded.org

Won't the symlink target have its own db entry when resolved?

Or if not, how should we cope with the inode clashes across different file systems?

Quoted 22 lines · Richard Purdie
Quoted 6 lines · Sam Liddicott

Despite my hints I don't think it is safe to use dev_t as part of the key because I don't think it is guaranteed to be consistent across reboots or even remounts for the case where temporary file system mounts (e.g. overlayfs) might be in use for the build workspace or subdirs.

Quoted 6 lines

(I am using bind mounting in a mount namespace during bitbake to make sure all workspaces appear as the same path in order to get better caching of sstate artifacts compile and install steps).

So maybe we want to limit pseudo caching only to the workdir filesystem by default, but certainly exclude /proc /dev etc

Unfortunately it isn't that simple. /proc/ can contain links and references to other places on the system.

Even with your example, /proc/self/fd/3 might be a file in workdir which has been opened by a process and given a file descriptor. If you perform an ownership/mode change on that /proc entry, pseudo does need to intercept it and apply it to the file in workdir.

Quoted 7 lines

So whilst /dev and /sys are perhaps arguable, we do have to look at proc.

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#15980):
https://lists.openembedded.org/g/bitbake-devel/message/15980
Mute This Topic: https://lists.openembedded.org/mt/104624826/7497305
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#6 lore raw
Quoted 21 lines · Sam Liddicott

This is becoming a problem for quite a few of our developers who are able to proceed with PSEUDO_IGNORE_PATHS:append=",/proc,/dev,/sys"

I understand that PSEUDO_IGNORE_PATHS refers to the host file system paths, not the pseudo file system paths so how does excluding these cause a problem?

I should add that we are also using the patch from Matt Cowell in 2019:

Quoted 5 lines

From cb69146d18382f272e347338cfc5a8930f693ed6 Mon Sep 17 00:00:00 2001
From: Matt Cowell <[email protected]>
Date: Wed, 17 Apr 2019 15:51:07 -0500
Subject: [PATCH] pseudo_fix_path: do not expand symlinks in /proc

otherwise our recipes fail on access to /dev/fd/3 and /dev/stdout and "files" of that nature, due to pseudo failing to properly resolve symlinks, as discussed
here: https://bugzilla.yoctoproject.org/show_bug.cgi?id=13288#c14

Quoted 5 lines

In any case, the general problem exists of how to deal with clashing inodes. Perhaps we are more prone to this issue because we are using user namespaces and mount namespaces to bind mount the build output dir so that it always appears at the same path, so that we get better SSTATE caching, maybe this makes inode clashing more likely.

This get a bit tricky as you're using a patch we weren't able to merge because of issues, then you're running into issues and needing to add other changes on top. Your workflow sounds to be one the project isn't actively using right now. I can't tell if the original patch required the change, whether it's specific to your workflow or exactly which behaviour we're really trying to fix, or if it is really broken.

I still suspect that some code may open via /proc/self/fd/X and then do chown() or similar on it and we'd then miss data we need. /sys and /dev are arguable and likely less of an issue.

I haven't really used user namespaces/mounts so I don't know what the inode situation is there. Do they persist consistently between executions of bitbake or between processes? I suspect you're right and this is related to that, however since we don't use that and we don't have any examples of that code, it is hard to say.

If the problem is different filesystems clashing, we may need to be more careful about storing filesystem/inode pairs. The hard part is finding an ID for the filesystem that will be consistent as some IDs we could use would change at reboot. That obviously will have a performance impact.

Cheers,

Richard

#7 lore raw

An interesting update from me, with my (now out-of-date) pseudo version:

Without excluding /proc via PSEUDO_IGNORE_PATHS the chown executed by the yocto build-tools tar command causes this pseudo abort:

path mismatch [1 link]: ino 3117695 db '/.../build/build_output/work/all-distro-linux/autoconf-archive/2022.02.11-r0/package/usr/share/info' req '/proc/self/fd/5/./usr/share/info'.

I was expecting that the /proc/self and /proc/self/fd/5 symlinks would be resolved back into the file system and the chown would complete (I should look and see why that didn't happen)

But this becomes is a very re-producible example of my recent problem for which I excluded /proc
but sadly, by excluding /proc, I get:

4132110: chown ignored path, calling real syscall. /.../x86_64-buildtools-extended-nativesdk-standalone-3.4/sysroots/x86_64-pokysdk-linux/usr/bin/tar:
./usr/share: Cannot change ownership to uid 0, gid 0: Invalid argument

Fortunately, the native tar uses a different chown method so for now I can drop the build-tools tar
I think I'm going to have to revisit the problem that this languishing patch was addressing in the context of the most current source, however I'm aware the possible the yocto build-tools (3.4 in this case) are just incompatible with pseudo in the same way that /dev/fd/3 also was, and I just didn't properly understand the failure mechanism at the time.

Sam

Quoted 55 lines · Richard Purdie
Quoted 21 lines · Sam Liddicott

This is becoming a problem for quite a few of our developers who are able to proceed with PSEUDO_IGNORE_PATHS:append=",/proc,/dev,/sys"

I understand that PSEUDO_IGNORE_PATHS refers to the host file system paths, not the pseudo file system paths so how does excluding these cause a problem?

I should add that we are also using the patch from Matt Cowell in 2019:

Quoted 5 lines

From cb69146d18382f272e347338cfc5a8930f693ed6 Mon Sep 17 00:00:00 2001
From: Matt Cowell <[email protected]>
Date: Wed, 17 Apr 2019 15:51:07 -0500
Subject: [PATCH] pseudo_fix_path: do not expand symlinks in /proc

otherwise our recipes fail on access to /dev/fd/3 and /dev/stdout and "files" of that nature, due to pseudo failing to properly resolve symlinks, as discussed
here: https://bugzilla.yoctoproject.org/show_bug.cgi?id=13288#c14

Quoted 5 lines

In any case, the general problem exists of how to deal with clashing inodes. Perhaps we are more prone to this issue because we are using user namespaces and mount namespaces to bind mount the build output dir so that it always appears at the same path, so that we get better SSTATE caching, maybe this makes inode clashing more likely.

This get a bit tricky as you're using a patch we weren't able to merge because of issues, then you're running into issues and needing to add other changes on top. Your workflow sounds to be one the project isn't actively using right now. I can't tell if the original patch required the change, whether it's specific to your workflow or exactly which behaviour we're really trying to fix, or if it is really broken.

I still suspect that some code may open via /proc/self/fd/X and then do chown() or similar on it and we'd then miss data we need. /sys and /dev are arguable and likely less of an issue.

I haven't really used user namespaces/mounts so I don't know what the inode situation is there. Do they persist consistently between executions of bitbake or between processes? I suspect you're right and this is related to that, however since we don't use that and we don't have any examples of that code, it is hard to say.

If the problem is different filesystems clashing, we may need to be more careful about storing filesystem/inode pairs. The hard part is finding an ID for the filesystem that will be consistent as some IDs we could use would change at reboot. That obviously will have a performance impact.

Cheers,

Richard