diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-10-03 12:02:36 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-10-07 11:18:38 +0100 |
commit | bd34ad3c2a6f0a930b23322169e47d36e9f65299 (patch) | |
tree | e4350695f3c41265cdc1d619603b3b49793cea2e /meta/recipes-devtools | |
parent | 958447ff2f130ece0e3f40eb2b5df5ed61f77366 (diff) | |
download | poky-bd34ad3c2a6f0a930b23322169e47d36e9f65299.tar.gz |
pseudo: Add may unlink patch
Mark files which are unlinked (nlink == 0) but open with fd's as
"may-unlink" to avoid problematic database entries.
(From OE-Core rev: e1e481f3608c05ab14c61bf45cd0837d7287b6a5)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r-- | meta/recipes-devtools/pseudo/files/mayunlink.patch | 37 | ||||
-rw-r--r-- | meta/recipes-devtools/pseudo/pseudo_git.bb | 1 |
2 files changed, 38 insertions, 0 deletions
diff --git a/meta/recipes-devtools/pseudo/files/mayunlink.patch b/meta/recipes-devtools/pseudo/files/mayunlink.patch new file mode 100644 index 0000000000..9d54e40dd9 --- /dev/null +++ b/meta/recipes-devtools/pseudo/files/mayunlink.patch | |||
@@ -0,0 +1,37 @@ | |||
1 | Some operations may call unlink() on an open fd, then call fchown/fchmod/fstat | ||
2 | on that fd. This would currently readd its entry to the database, which | ||
3 | is necessary to preserve its permissions information however since that | ||
4 | file will be lost when it is closed, we don't want the DB entry to persist. | ||
5 | Marking it as may_unlink means the code will know its likely been deleted | ||
6 | and ignore the entry later, giving improved behaviour that simple path | ||
7 | mismatch warnings. We can use an nlink of zero to detect this. | ||
8 | |||
9 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
10 | Upstream-Status: Pending | ||
11 | |||
12 | Index: git/pseudo.c | ||
13 | =================================================================== | ||
14 | --- git.orig/pseudo.c | ||
15 | +++ git/pseudo.c | ||
16 | @@ -1100,6 +1100,21 @@ pseudo_op(pseudo_msg_t *msg, const char | ||
17 | break; | ||
18 | } | ||
19 | |||
20 | + switch (msg->op) { | ||
21 | + case OP_FCHOWN: /* FALLTHROUGH */ | ||
22 | + case OP_FCHMOD: /* FALLTHROUGH */ | ||
23 | + case OP_FSTAT: | ||
24 | + if (!found_path && !found_ino && (msg->nlink == 0)) { | ||
25 | + /* If nlink is 0 for an fchown/fchmod/fstat, we probably have an fd which is | ||
26 | + * unlinked and we don't want to do inode/path matching against it. Marking it | ||
27 | + * as may unlink gives the right hints in the database to ensure we | ||
28 | + * handle correctly whilst maintaining the permissions whilst the | ||
29 | + * file exists for the fd. */ | ||
30 | + pdb_may_unlink_file(msg, msg->client); | ||
31 | + } | ||
32 | + break; | ||
33 | + } | ||
34 | + | ||
35 | op_exit: | ||
36 | /* in the case of an exact match, we just used the pointer | ||
37 | * rather than allocating space. | ||
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb index 7857b4f1b1..c5040f5f7f 100644 --- a/meta/recipes-devtools/pseudo/pseudo_git.bb +++ b/meta/recipes-devtools/pseudo/pseudo_git.bb | |||
@@ -7,6 +7,7 @@ SRC_URI = "git://git.yoctoproject.org/pseudo;branch=oe-core \ | |||
7 | file://abort_on_mismatch.patch \ | 7 | file://abort_on_mismatch.patch \ |
8 | file://track_link_fds.patch \ | 8 | file://track_link_fds.patch \ |
9 | file://xattr_fix.patch \ | 9 | file://xattr_fix.patch \ |
10 | file://mayunlink.patch \ | ||
10 | file://fallback-passwd \ | 11 | file://fallback-passwd \ |
11 | file://fallback-group \ | 12 | file://fallback-group \ |
12 | " | 13 | " |