summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/pseudo/files/efe0be279901006f939cd357ccee47b651c786da.patch
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-04-14 10:07:33 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-04-14 23:25:54 +0100
commitc5269fd2108d66623515291481c4c24e93be805b (patch)
tree6f8d37404a10be228b88d96d4dabc47e6db6343b /meta/recipes-devtools/pseudo/files/efe0be279901006f939cd357ccee47b651c786da.patch
parent0bf9cb2272448adb25d0d9786d069cb004c6c21b (diff)
downloadpoky-c5269fd2108d66623515291481c4c24e93be805b.tar.gz
pseudo: Backport two upstream fixes
Backport fixes from pseudo master for an acl issue and more importantly, a segfault issue with bash which can be triggered by the recent useradd changes. (From OE-Core rev: 949214761998a93fc6b8b009f1cdad0db3bfa5db) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/pseudo/files/efe0be279901006f939cd357ccee47b651c786da.patch')
-rw-r--r--meta/recipes-devtools/pseudo/files/efe0be279901006f939cd357ccee47b651c786da.patch99
1 files changed, 99 insertions, 0 deletions
diff --git a/meta/recipes-devtools/pseudo/files/efe0be279901006f939cd357ccee47b651c786da.patch b/meta/recipes-devtools/pseudo/files/efe0be279901006f939cd357ccee47b651c786da.patch
new file mode 100644
index 0000000000..64fc58c4fe
--- /dev/null
+++ b/meta/recipes-devtools/pseudo/files/efe0be279901006f939cd357ccee47b651c786da.patch
@@ -0,0 +1,99 @@
1From efe0be279901006f939cd357ccee47b651c786da Mon Sep 17 00:00:00 2001
2From: Seebs <seebs@seebs.net>
3Date: Fri, 24 Feb 2017 12:47:38 -0600
4Subject: Don't try to record 0-length posix_acl_default xattrs
5
6Based on a submission from Anton Gerasimov <anton@advancedtelematic.com>
7
8On some systems, with some kernel configs, "cp -a" apparently tries to
9set an empty ACL list, with a valid header but no contents, which causes
10strange and mysterious behavior later if we actually create such an entry.
11So filter that out, also sanity-check a couple of other things.
12
13Signed-off-by: Seebs <seebs@seebs.net>
14
15Upstream-Status: Backport
16
17diff --git a/ChangeLog.txt b/ChangeLog.txt
18index ae2a6e9..a2d30e9 100644
19--- a/ChangeLog.txt
20+++ b/ChangeLog.txt
21@@ -1,3 +1,6 @@
22+2017-02-24:
23+ * (seebs) import posix_acl_default fix from Anton Gerasimov
24+ <anton@advancedtelematic.com>
25 2017-02-01:
26 * (seebs) handle xattr deletion slightly more carefully.
27 * (seebs) tag this as 1.8.2
28diff --git a/ports/linux/xattr/pseudo_wrappers.c b/ports/linux/xattr/pseudo_wrappers.c
29index 46bc053..d69d53e 100644
30--- a/ports/linux/xattr/pseudo_wrappers.c
31+++ b/ports/linux/xattr/pseudo_wrappers.c
32@@ -62,9 +62,9 @@ static int
33 posix_permissions(const acl_header *header, int entries, int *extra, int *mode) {
34 int acl_seen = 0;
35 if (le32(header->version) != 2) {
36- pseudo_diag("Fatal: ACL support no available for header version %d.\n",
37+ pseudo_diag("Fatal: ACL support not available for header version %d.\n",
38 le32(header->version));
39- return 1;
40+ return -1;
41 }
42 *mode = 0;
43 *extra = 0;
44@@ -140,12 +140,38 @@ static int shared_setxattr(const char *path, int fd, const char *name, const voi
45 pseudo_debug(PDBGF_XATTR, "setxattr(%s [fd %d], %s => '%.*s')\n",
46 path ? path : "<no path>", fd, name, (int) size, (char *) value);
47
48+ /* Filter out erroneous sizes for POSIX ACL
49+ * see posix_acl_xattr_count in include/linux/posix_acl_xattr.h of Linux source code */
50+ /* I don't think there's any posix_acl_* values that aren't in this format */
51+ if (!strncmp(name, "system.posix_acl_", 17)) {
52+ // ACL is corrupt, issue an error
53+ if(size < sizeof(acl_header) || (size - sizeof(acl_header)) % sizeof(acl_entry) != 0) {
54+ pseudo_debug(PDBGF_XATTR, "invalid data size for %s: %d\n",
55+ name, (int) size);
56+ errno = EINVAL;
57+ return -1;
58+ }
59+
60+ // ACL is empty, do nothing
61+ if((size - sizeof(acl_header)) / sizeof(acl_entry) == 0) {
62+ /* on some systems, "cp -a" will attempt to clone the
63+ * posix_acl_default entry for a directory (which would specify
64+ * default ACLs for new files in that directory), but if the
65+ * original was empty, we get a header but no entries. With
66+ * real xattr, that ends up being silently discarded, apparently,
67+ * so we discard it too.
68+ */
69+ pseudo_debug(PDBGF_XATTR, "0-length ACL entry %s.\n", name);
70+ return 0;
71+ }
72+ }
73 /* this may be a plain chmod */
74 if (!strcmp(name, "system.posix_acl_access")) {
75 int extra;
76 int mode;
77 int entries = (size - sizeof(acl_header)) / sizeof(acl_entry);
78- if (!posix_permissions(value, entries, &extra, &mode)) {
79+ int res = posix_permissions(value, entries, &extra, &mode);
80+ if (res == 0) {
81 pseudo_debug(PDBGF_XATTR, "posix_acl_access translated to mode %04o. Remaining attribute(s): %d.\n",
82 mode, extra);
83 buf.st_mode = mode;
84@@ -164,8 +190,12 @@ static int shared_setxattr(const char *path, int fd, const char *name, const voi
85 if (!extra) {
86 return 0;
87 }
88+ } else if (res == -1) {
89+ errno = EOPNOTSUPP;
90+ return -1;
91 }
92 }
93+
94 if (!strcmp(name, "user.pseudo_data")) {
95 pseudo_debug(PDBGF_XATTR | PDBGF_XATTRDB, "user.pseudo_data xattribute does not get to go in database.\n");
96 return -1;
97--
98cgit v0.10.2
99