!21 Update to attr-2.5.1

From: @wenchao-hao
Reviewed-by: @liuzhiqiang26
Signed-off-by: @liuzhiqiang26
This commit is contained in:
openeuler-ci-bot 2021-11-24 08:00:47 +00:00 committed by Gitee
commit 75557cc3e5
11 changed files with 6 additions and 397 deletions

View File

@ -1,28 +0,0 @@
From 7caefe0a7206bf0da40fcea66c3292345abf24f9 Mon Sep 17 00:00:00 2001
From: Troy Dawson <tdawson@redhat.com>
Date: Mon, 24 Jul 2017 14:42:06 +0200
Subject: [PATCH 1/7] test: escape left brace in a regex in test/run
... to fix test-suite failure with perl-5.26.0
Bug: https://bugzilla.redhat.com/1473853
---
test/run | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/run b/test/run
index 4b1f8d0..07e916c 100755
--- a/test/run
+++ b/test/run
@@ -106,7 +106,7 @@ for (;;) {
if (defined $line) {
# Substitute %VAR and %{VAR} with environment variables.
$line =~ s[%(\w+)][$ENV{$1}]eg;
- $line =~ s[%{(\w+)}][$ENV{$1}]eg;
+ $line =~ s[%\{(\w+)}][$ENV{$1}]eg;
}
if (defined $line) {
if ($line =~ s/^\s*< ?//) {
--
1.8.3.1

View File

@ -1,37 +0,0 @@
From c6b3d77b1c52af927ddf34230505e4b7d4df0960 Mon Sep 17 00:00:00 2001
From: Andreas Gruenbacher <agruenba@redhat.com>
Date: Mon, 17 Dec 2018 14:33:55 +0100
Subject: [PATCH 2/7] attr_multi, attr_multif: Don't set errno to -EINVAL
When attr_multi or attr_multif are called with an invalid am_opcode,
they fail with errno set to -EINVAL. Instead, the errno value should be
positive.
---
libattr/libattr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libattr/libattr.c b/libattr/libattr.c
index d6668af..8180c3f 100644
--- a/libattr/libattr.c
+++ b/libattr/libattr.c
@@ -391,7 +391,7 @@ attr_single(const char *path, attr_multiop_t *op, int flags)
{
int r = -1;
- errno = -EINVAL;
+ errno = EINVAL;
flags |= op->am_flags;
if (op->am_opcode == ATTR_OP_GET)
r = attr_get(path, op->am_attrname, op->am_attrvalue,
@@ -409,7 +409,7 @@ attr_singlef(const int fd, attr_multiop_t *op, int flags)
{
int r = -1;
- errno = -EINVAL;
+ errno = EINVAL;
flags |= op->am_flags;
if (op->am_opcode == ATTR_OP_GET)
r = attr_getf(fd, op->am_attrname, op->am_attrvalue,
--
1.8.3.1

View File

@ -1,64 +0,0 @@
From 03d0e1ef54dc21e60ead4ec3161c217f3d53a5a7 Mon Sep 17 00:00:00 2001
From: Andreas Gruenbacher <agruenba@redhat.com>
Date: Mon, 17 Dec 2018 14:38:26 +0100
Subject: [PATCH 3/7] attr_list, attr_listf: Guard against unterminated buffer
attr_list and attr_listf can crash when the listxattr, llistxattr, or
flistxattr syscalls incorrectly return an unterminated buffer. Guard
against that by always appending a null character.
---
libattr/libattr.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/libattr/libattr.c b/libattr/libattr.c
index 8180c3f..d550e10 100644
--- a/libattr/libattr.c
+++ b/libattr/libattr.c
@@ -290,7 +290,7 @@ attr_list(const char *path, char *buffer, const int buffersize, int flags,
{
const char *l;
int length, vlength, count = 0;
- char lbuf[MAXLISTLEN];
+ char lbuf[MAXLISTLEN+1];
char name[MAXNAMELEN+16];
int start_offset, end_offset;
@@ -301,11 +301,12 @@ attr_list(const char *path, char *buffer, const int buffersize, int flags,
bzero(buffer, sizeof(attrlist_t));
if (flags & ATTR_DONTFOLLOW)
- length = llistxattr(path, lbuf, sizeof(lbuf));
+ length = llistxattr(path, lbuf, sizeof(lbuf) - 1);
else
- length = listxattr(path, lbuf, sizeof(lbuf));
+ length = listxattr(path, lbuf, sizeof(lbuf) - 1);
if (length <= 0)
return length;
+ lbuf[length] = 0; /* not supposed to be necessary */
start_offset = sizeof(attrlist_t);
end_offset = buffersize & ~(8-1); /* 8 byte align */
@@ -340,7 +341,7 @@ attr_listf(int fd, char *buffer, const int buffersize, int flags,
{
const char *l;
int length, vlength, count = 0;
- char lbuf[MAXLISTLEN];
+ char lbuf[MAXLISTLEN+1];
char name[MAXNAMELEN+16];
int start_offset, end_offset;
@@ -350,9 +351,10 @@ attr_listf(int fd, char *buffer, const int buffersize, int flags,
}
bzero(buffer, sizeof(attrlist_t));
- length = flistxattr(fd, lbuf, sizeof(lbuf));
+ length = flistxattr(fd, lbuf, sizeof(lbuf) - 1);
if (length < 0)
return length;
+ lbuf[length] = 0; /* not supposed to be necessary */
start_offset = sizeof(attrlist_t);
end_offset = buffersize & ~(8-1); /* 8 byte align */
--
1.8.3.1

View File

@ -1,35 +0,0 @@
From e4c006f07f050e0af08602d0064c3420080b7313 Mon Sep 17 00:00:00 2001
From: Jeff Layton <jlayton@kernel.org>
Date: Thu, 13 Jun 2019 10:55:35 -0400
Subject: [PATCH 4/7] getfattr: don't count terminating NULL in
well_enough_printable
If the value is a string with the terminating NUL included in the
length, then don't count that terminating NUL when determining whether
the string is printable. This is consistent with the fact that getfattr
doesn't print the terminating NUL character in --encoding=text (commit
7fed4441e12d).
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
tools/getfattr.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/getfattr.c b/tools/getfattr.c
index 72a8852..0ba5781 100644
--- a/tools/getfattr.c
+++ b/tools/getfattr.c
@@ -110,6 +110,10 @@ int well_enough_printable(const char *value, size_t size)
{
size_t n, nonpr = 0;
+ /* Don't count the NULL terminator if there is one */
+ if (size && !value[size - 1])
+ size--;
+
for (n=0; n < size; n++)
if (!isprint(*value++))
nonpr++;
--
1.8.3.1

View File

@ -1,69 +0,0 @@
From fbf5b460f20273c6bbdebeab0ca7bb75d4ab33a2 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Sun, 11 Aug 2019 16:17:11 -0700
Subject: [PATCH 5/7] attr: Replace bzero with memset
bzero is a deprecated function that is optionally unavailable with
uClibc-ng.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
include/attributes.h | 4 ++--
libattr/libattr.c | 4 ++--
tools/attr.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/attributes.h b/include/attributes.h
index 14beb8f..039c817 100644
--- a/include/attributes.h
+++ b/include/attributes.h
@@ -91,9 +91,9 @@ typedef struct attrlist_ent { /* data from attr_list() */
* Implement a "cursor" for use in successive attr_list() calls.
* It provides a way to find the last attribute that was returned in the
* last attr_list() call so that we can get the next one without missing
- * any. This should be bzero()ed before use and whenever it is desired to
+ * any. This should be zeroed before use and whenever it is desired to
* start over from the beginning of the attribute list. The only valid
- * operation on a cursor is to bzero() it.
+ * operation on a cursor is to zero it.
*/
typedef struct attrlist_cursor {
uint32_t opaque[4]; /* an opaque cookie */
diff --git a/libattr/libattr.c b/libattr/libattr.c
index d550e10..2ebd1c5 100644
--- a/libattr/libattr.c
+++ b/libattr/libattr.c
@@ -298,7 +298,7 @@ attr_list(const char *path, char *buffer, const int buffersize, int flags,
errno = EINVAL;
return -1;
}
- bzero(buffer, sizeof(attrlist_t));
+ memset(buffer, 0, sizeof(attrlist_t));
if (flags & ATTR_DONTFOLLOW)
length = llistxattr(path, lbuf, sizeof(lbuf) - 1);
@@ -349,7 +349,7 @@ attr_listf(int fd, char *buffer, const int buffersize, int flags,
errno = EINVAL;
return -1;
}
- bzero(buffer, sizeof(attrlist_t));
+ memset(buffer, 0, sizeof(attrlist_t));
length = flistxattr(fd, lbuf, sizeof(lbuf) - 1);
if (length < 0)
diff --git a/tools/attr.c b/tools/attr.c
index c8aa0b4..312aef1 100644
--- a/tools/attr.c
+++ b/tools/attr.c
@@ -228,7 +228,7 @@ main(int argc, char **argv)
perror("malloc");
exit(1);
}
- bzero((char *)&cursor, sizeof(cursor));
+ memset(&cursor, 0, sizeof(cursor));
do {
error = attr_list(filename, buffer, BUFSIZE,
attrflags, &cursor);
--
1.8.3.1

View File

@ -1,123 +0,0 @@
From cb937740fa0dddf9c398618035054c657959c783 Mon Sep 17 00:00:00 2001
From: Andreas Gruenbacher <agruenba@redhat.com>
Date: Fri, 17 Aug 2018 14:07:31 +0200
Subject: [PATCH 6/7] Switch back to syscall()
Switch back to syscall() for the *xattr system calls. The current
mechanism of forwarding those calls to glibc breaks libraries like
libfakeroot (fakeroot) and libasan (the gcc address sanitizer; gcc
-fsanitize=address).
Those libraries provide wrappers for functions defined in other shared
libraries, usually glibc, do their own processing, and forward calls to
the original symbols looke dup via dlsym(RTLD_NEXT, "symbol_name"). In
our case, dlsym returns the libattr_*xattr wrappers. However, when our
wrappers try calling glibc, they end up calling the libfakeroot /
libasan wrappers instead because those override the original symbols =>
recursion.
The libattr_*xattr wrappers will only be used when symbols are looked up
at runtime (dlopen / dlsym). Programs linking against libattr will
directly use the glibc provided symbols. Therefore, the slightly worse
performance of syscall() won't affect any of the "normal" users of
libattr.
---
libattr/syscalls.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/libattr/syscalls.c b/libattr/syscalls.c
index 3013aa0..721ad7f 100644
--- a/libattr/syscalls.c
+++ b/libattr/syscalls.c
@@ -22,6 +22,8 @@
#include "config.h"
+#include <unistd.h>
+#include <sys/syscall.h>
#include <sys/xattr.h>
#ifdef HAVE_VISIBILITY_ATTRIBUTE
@@ -31,67 +33,67 @@
int libattr_setxattr(const char *path, const char *name,
void *value, size_t size, int flags)
{
- return setxattr(path, name, value, size, flags);
+ return syscall(__NR_setxattr, path, name, value, size, flags);
}
int libattr_lsetxattr(const char *path, const char *name,
void *value, size_t size, int flags)
{
- return lsetxattr(path, name, value, size, flags);
+ return syscall(__NR_lsetxattr, path, name, value, size, flags);
}
int libattr_fsetxattr(int filedes, const char *name,
void *value, size_t size, int flags)
{
- return fsetxattr(filedes, name, value, size, flags);
+ return syscall(__NR_fsetxattr, filedes, name, value, size, flags);
}
ssize_t libattr_getxattr(const char *path, const char *name,
void *value, size_t size)
{
- return getxattr(path, name, value, size);
+ return syscall(__NR_getxattr, path, name, value, size);
}
ssize_t libattr_lgetxattr(const char *path, const char *name,
void *value, size_t size)
{
- return lgetxattr(path, name, value, size);
+ return syscall(__NR_lgetxattr, path, name, value, size);
}
ssize_t libattr_fgetxattr(int filedes, const char *name,
void *value, size_t size)
{
- return fgetxattr(filedes, name, value, size);
+ return syscall(__NR_fgetxattr, filedes, name, value, size);
}
ssize_t libattr_listxattr(const char *path, char *list, size_t size)
{
- return listxattr(path, list, size);
+ return syscall(__NR_listxattr, path, list, size);
}
ssize_t libattr_llistxattr(const char *path, char *list, size_t size)
{
- return llistxattr(path, list, size);
+ return syscall(__NR_llistxattr, path, list, size);
}
ssize_t libattr_flistxattr(int filedes, char *list, size_t size)
{
- return flistxattr(filedes, list, size);
+ return syscall(__NR_flistxattr, filedes, list, size);
}
int libattr_removexattr(const char *path, const char *name)
{
- return removexattr(path, name);
+ return syscall(__NR_removexattr, path, name);
}
int libattr_lremovexattr(const char *path, const char *name)
{
- return lremovexattr(path, name);
+ return syscall(__NR_lremovexattr, path, name);
}
int libattr_fremovexattr(int filedes, const char *name)
{
- return fremovexattr(filedes, name);
+ return syscall(__NR_fremovexattr, filedes, name);
}
#ifdef HAVE_VISIBILITY_ATTRIBUTE
--
1.8.3.1

View File

@ -1,31 +0,0 @@
From a0be13cb66e2297adce275d4308cae10ac4eb5e9 Mon Sep 17 00:00:00 2001
From: Anakin Zhang <benjamin93@163.com>
Date: Wed, 2 Sep 2020 23:18:56 +0800
Subject: [PATCH] carry security.evm when copy files
security.evm xattr is used to store a file's EVM signature. This xattr is
needed by kernel EVM (Extended Verification Module) to provide file integrity
protection.
This patch is intended to allow carrying security.evm xattr when copying files.
Without this patch, digest lists' security.evm xattr will miss when running
dracut to make new initramfs.
Signed-off-by: Anakin Zhang <benjamin93@163.com>
---
xattr.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xattr.conf b/xattr.conf
index dcbc12c..125fd18 100644
--- a/xattr.conf
+++ b/xattr.conf
@@ -18,4 +18,4 @@ trusted.SGI_DMI_* skip # xfs specific
trusted.SGI_MAC_FILE skip # xfs specific
xfsroot.* skip # xfs specific; obsolete
user.Beagle.* skip # ignore Beagle index data
-security.evm skip # may only be written by kernel
+#security.evm skip # may only be written by kernel
--
2.23.0.windows.1

Binary file not shown.

BIN
attr-2.5.1.tar.gz Normal file

Binary file not shown.

View File

@ -1,21 +1,14 @@
%{!?_licensedir:%global license %%doc} %{!?_licensedir:%global license %%doc}
Name: attr Name: attr
Version: 2.4.48 Version: 2.5.1
Release: 14 Release: 1
Summary: Commands for Manipulating Filesystem Extended Attributes Summary: Commands for Manipulating Filesystem Extended Attributes
License: GPLv2+ AND LGPLv2+ License: GPLv2+ AND LGPLv2+
URL: https://savannah.nongnu.org/projects/attr URL: https://savannah.nongnu.org/projects/attr
Source0: https://download-mirror.savannah.gnu.org/releases/attr/attr-%{version}.tar.gz Source0: https://download-mirror.savannah.gnu.org/releases/attr/attr-%{version}.tar.gz
# fix test-suite failure with perl-5.26.0 (#1473853) # fix test-suite failure with perl-5.26.0 (#1473853)
Patch1: 0001-test-escape-left-brace-in-a-regex-in-test-run.patch Patch1: 0001-bypass-wrong-output-when-enabled-selinux.patch
Patch2: 0002-attr_multi-attr_multif-Don-t-set-errno-to-EINVAL.patch
Patch3: 0003-attr_list-attr_listf-Guard-against-unterminated-buff.patch
Patch4: 0004-getfattr-don-t-count-terminating-NULL-in-well_enough.patch
Patch5: 0005-attr-Replace-bzero-with-memset.patch
Patch6: 0006-Switch-back-to-syscall.patch
Patch7: 0007-bypass-wrong-output-when-enabled-selinux.patch
Patch8: 0008-carry-security.evm-when-copying-files.patch
BuildRequires: gettext, libtool, chrpath, gcc, BuildRequires: gettext, libtool, chrpath, gcc,
Provides: libattr Provides: libattr
@ -102,6 +95,9 @@ fi
%{_mandir}/man3/* %{_mandir}/man3/*
%changelog %changelog
* Tue Nov 16 2021 Wenchao Hao <haowenchao@huawei.com> - 2.5.1-1
- Update to attr-2.5.1
* Fri Jul 30 2021 chenyanpanHW <chenyanpan@huawei.com> - 2.4.48-14 * Fri Jul 30 2021 chenyanpanHW <chenyanpan@huawei.com> - 2.4.48-14
- DESC: delete -Sgit from %autosetup, and delete BuildRequires git - DESC: delete -Sgit from %autosetup, and delete BuildRequires git