diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-10-01 18:20:06 +0100 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2021-01-28 04:41:47 -1000 |
commit | 4e698300a602b484bd70e76dfc66fb2e420f7fe4 (patch) | |
tree | 406c1189126b068a0403cb307139ab5e29ba130e /meta/recipes-devtools | |
parent | 09da51d69e1ead6dc7b41034f1dee05e1c98078b (diff) | |
download | openembedded-core-contrib-4e698300a602b484bd70e76dfc66fb2e420f7fe4.tar.gz |
pseudo: Fix xattr segfault
Fix a NULL pointer dereference exposed by the path ignore code in
xattr handling.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 929a27bf6cbca94d1141d2094ae0c915d93bd3f4)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r-- | meta/recipes-devtools/pseudo/files/xattr_fix.patch | 40 | ||||
-rw-r--r-- | meta/recipes-devtools/pseudo/pseudo_git.bb | 1 |
2 files changed, 41 insertions, 0 deletions
diff --git a/meta/recipes-devtools/pseudo/files/xattr_fix.patch b/meta/recipes-devtools/pseudo/files/xattr_fix.patch new file mode 100644 index 0000000000..61d0030b10 --- /dev/null +++ b/meta/recipes-devtools/pseudo/files/xattr_fix.patch @@ -0,0 +1,40 @@ + +In the xattr handling functions, if result is NULL, which it can be +with the path ignore code, there is a NULL pointer dereference and +segfault. Everywhere else checks result first, this appears to just +be an omission. + +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> +Upstream-Status: Pending + +Index: git/ports/linux/xattr/pseudo_wrappers.c +=================================================================== +--- git.orig/ports/linux/xattr/pseudo_wrappers.c ++++ git/ports/linux/xattr/pseudo_wrappers.c +@@ -134,7 +134,7 @@ static ssize_t shared_getxattr(const cha + pseudo_debug(PDBGF_XATTR, "getxattr(%s [fd %d], %s)\n", + path ? path : "<no path>", fd, name); + pseudo_msg_t *result = pseudo_client_op(OP_GET_XATTR, 0, fd, -1, path, &buf, name); +- if (result->result != RESULT_SUCCEED) { ++ if (!result || result->result != RESULT_SUCCEED) { + errno = ENOATTR; + return -1; + } +@@ -254,7 +254,7 @@ static int shared_setxattr(const char *p + static ssize_t shared_listxattr(const char *path, int fd, char *list, size_t size) { + RC_AND_BUF + pseudo_msg_t *result = pseudo_client_op(OP_LIST_XATTR, 0, fd, -1, path, &buf); +- if (result->result != RESULT_SUCCEED) { ++ if (!result || result->result != RESULT_SUCCEED) { + pseudo_debug(PDBGF_XATTR, "listxattr: no success.\n"); + errno = ENOATTR; + return -1; +@@ -276,7 +276,7 @@ static int shared_removexattr(const char + RC_AND_BUF + pseudo_msg_t *result = pseudo_client_op(OP_REMOVE_XATTR, 0, fd, -1, path, &buf, name); + +- if (result->result != RESULT_SUCCEED) { ++ if (!result || result->result != RESULT_SUCCEED) { + /* docs say ENOATTR, but I don't have one */ + errno = ENOENT; + return -1; diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb index a5e79ec9a5..7857b4f1b1 100644 --- a/meta/recipes-devtools/pseudo/pseudo_git.bb +++ b/meta/recipes-devtools/pseudo/pseudo_git.bb @@ -6,6 +6,7 @@ SRC_URI = "git://git.yoctoproject.org/pseudo;branch=oe-core \ file://add_ignore_paths.patch \ file://abort_on_mismatch.patch \ file://track_link_fds.patch \ + file://xattr_fix.patch \ file://fallback-passwd \ file://fallback-group \ " |