From 41e9481acba8a9f3b41ea70f785bf0a99d8480b0 Mon Sep 17 00:00:00 2001 From: fly_fzc <2385803914@qq.com> Date: Fri, 1 Sep 2023 14:46:59 +0800 Subject: [PATCH] Use upstream patch for Fix error of parsing object file perms --- ...ectly-decode-ar_mode-as-octal-string.patch | 42 +++++++++++++------ elfutils.spec | 10 ++++- 2 files changed, 38 insertions(+), 14 deletions(-) rename Fix-error-of-parsing-object-file-perms.patch => backport-libelf-Correctly-decode-ar_mode-as-octal-string.patch (38%) diff --git a/Fix-error-of-parsing-object-file-perms.patch b/backport-libelf-Correctly-decode-ar_mode-as-octal-string.patch similarity index 38% rename from Fix-error-of-parsing-object-file-perms.patch rename to backport-libelf-Correctly-decode-ar_mode-as-octal-string.patch index cf487ab..6f2513d 100644 --- a/Fix-error-of-parsing-object-file-perms.patch +++ b/backport-libelf-Correctly-decode-ar_mode-as-octal-string.patch @@ -1,21 +1,37 @@ -From 9e18fcfeb2c8ff471c11da58b05215e219be20fd Mon Sep 17 00:00:00 2001 -From: yixiangzhike -Date: Tue, 16 Aug 2022 09:49:35 +0800 -Subject: [PATCH] fix error of parsing object file perms +From ee188125b10d1588a0536af033d7b7b1bbbaafaf Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Sun, 28 Aug 2022 19:51:13 +0200 +Subject: [PATCH] libelf: Correctly decode ar_mode as octal string +ar_mode is encoded as an octal ascii string, not decimal. Add a new +OCT_FIELD macro to decode it. + +https://sourceware.org/bugzilla/show_bug.cgi?id=28729 + +Signed-off-by: Mark Wielaard --- - libelf/elf_begin.c | 20 +++++++++++++++++++- - 1 file changed, 19 insertions(+), 1 deletion(-) + libelf/elf_begin.c | 25 +++++++++++++++++++++++-- + 1 files changed, 23 insertions(+), 2 deletions(-) diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c -index 17d9b1f..581d8ef 100644 +index 17d9b1f3..71eb3594 100644 --- a/libelf/elf_begin.c +++ b/libelf/elf_begin.c -@@ -997,10 +997,28 @@ __libelf_next_arhdr_wrlock (Elf *elf) +@@ -977,7 +977,8 @@ __libelf_next_arhdr_wrlock (Elf *elf) + atoll depending on the size of the types. We are also prepared + for the case where the whole field in the `struct ar_hdr' is + filled in which case we cannot simply use atol/l but instead have +- to create a temporary copy. */ ++ to create a temporary copy. Note that all fields use decimal ++ encoding, except ar_mode which uses octal. */ + + #define INT_FIELD(FIELD) \ + do \ +@@ -997,10 +998,30 @@ __libelf_next_arhdr_wrlock (Elf *elf) } \ while (0) -+#define INT_FIELD_HN(FIELD, HN) \ ++#define OCT_FIELD(FIELD) \ + do \ + { \ + char buf[sizeof (ar_hdr->FIELD) + 1]; \ @@ -27,9 +43,11 @@ index 17d9b1f..581d8ef 100644 + string = buf; \ + } \ + if (sizeof (elf_ar_hdr->FIELD) <= sizeof (long int)) \ -+ elf_ar_hdr->FIELD = (__typeof (elf_ar_hdr->FIELD)) strtol (string, NULL, HN); \ ++ elf_ar_hdr->FIELD \ ++ = (__typeof (elf_ar_hdr->FIELD)) strtol (string, NULL, 8); \ + else \ -+ elf_ar_hdr->FIELD = (__typeof (elf_ar_hdr->FIELD)) strtoll (string, NULL, HN); \ ++ elf_ar_hdr->FIELD \ ++ = (__typeof (elf_ar_hdr->FIELD)) strtoll (string, NULL, 8); \ + } \ + while (0) + @@ -37,7 +55,7 @@ index 17d9b1f..581d8ef 100644 INT_FIELD (ar_uid); INT_FIELD (ar_gid); - INT_FIELD (ar_mode); -+ INT_FIELD_HN (ar_mode, 8); ++ OCT_FIELD (ar_mode); INT_FIELD (ar_size); if (elf_ar_hdr->ar_size < 0) diff --git a/elfutils.spec b/elfutils.spec index 9e03871..5e0033f 100644 --- a/elfutils.spec +++ b/elfutils.spec @@ -1,7 +1,7 @@ # -*- rpm-spec from http://elfutils.org/ -*- Name: elfutils Version: 0.185 -Release: 17 +Release: 18 Summary: A collection of utilities and DSOs to handle ELF files and DWARF data URL: http://elfutils.org/ License: GPLv3+ and (GPLv2+ or LGPLv3+) @@ -9,7 +9,7 @@ Source: ftp://sourceware.org/pub/elfutils/%{version}/elfutils-%{version}.tar.bz2 Patch0: backport-elfclassify-Fix-no-stdin-flag.patch Patch1: Fix-segfault-in-eu-ar-m.patch -Patch2: Fix-error-of-parsing-object-file-perms.patch +Patch2: backport-libelf-Correctly-decode-ar_mode-as-octal-string.patch Patch3: Fix-issue-of-moving-files-by-ar-or-br.patch Patch4: Get-instance-correctly-for-eu-ar-N-option.patch Patch5: elfutils-Add-sw64-architecture.patch @@ -267,6 +267,12 @@ exit 0 %systemd_postun_with_restart debuginfod.service %changelog +* Fri Sep 01 2023 fuanan - 0.185-18 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:Use upstream patch for Fix error of parsing object file perms + * Mon Dec 5 2022 linzhuorong - 0.185-17 - Type:bugfix - ID:NA -- Gitee