diff options
Diffstat (limited to 'meta/recipes-devtools/pseudo/files/efe0be279901006f939cd357ccee47b651c786da.patch')
| -rw-r--r-- | meta/recipes-devtools/pseudo/files/efe0be279901006f939cd357ccee47b651c786da.patch | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/meta/recipes-devtools/pseudo/files/efe0be279901006f939cd357ccee47b651c786da.patch b/meta/recipes-devtools/pseudo/files/efe0be279901006f939cd357ccee47b651c786da.patch deleted file mode 100644 index 64fc58c4fe..0000000000 --- a/meta/recipes-devtools/pseudo/files/efe0be279901006f939cd357ccee47b651c786da.patch +++ /dev/null | |||
| @@ -1,99 +0,0 @@ | |||
| 1 | From efe0be279901006f939cd357ccee47b651c786da Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Seebs <seebs@seebs.net> | ||
| 3 | Date: Fri, 24 Feb 2017 12:47:38 -0600 | ||
| 4 | Subject: Don't try to record 0-length posix_acl_default xattrs | ||
| 5 | |||
| 6 | Based on a submission from Anton Gerasimov <anton@advancedtelematic.com> | ||
| 7 | |||
| 8 | On some systems, with some kernel configs, "cp -a" apparently tries to | ||
| 9 | set an empty ACL list, with a valid header but no contents, which causes | ||
| 10 | strange and mysterious behavior later if we actually create such an entry. | ||
| 11 | So filter that out, also sanity-check a couple of other things. | ||
| 12 | |||
| 13 | Signed-off-by: Seebs <seebs@seebs.net> | ||
| 14 | |||
| 15 | Upstream-Status: Backport | ||
| 16 | |||
| 17 | diff --git a/ChangeLog.txt b/ChangeLog.txt | ||
| 18 | index 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 | ||
| 28 | diff --git a/ports/linux/xattr/pseudo_wrappers.c b/ports/linux/xattr/pseudo_wrappers.c | ||
| 29 | index 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 | -- | ||
| 98 | cgit v0.10.2 | ||
| 99 | |||
