update to 0.180

This commit is contained in:
zhangguangzhi 2020-08-06 17:27:31 +08:00
parent 0de7616396
commit d100ca1b12
10 changed files with 9 additions and 402 deletions

View File

@ -1,20 +1,12 @@
# -*- rpm-spec from http://elfutils.org/ -*-
Name: elfutils
Version: 0.179
Release: 2
Version: 0.180
Release: 1
Summary: A collection of utilities and DSOs to handle ELF files and DWARF data
URL: http://elfutils.org/
License: GPLv3+ and (GPLv2+ or LGPLv3+)
Source: ftp://sourceware.org/pub/elfutils/%{version}/elfutils-%{version}.tar.bz2
Patch0000: libdwfl-Initialize-bits-to-NULL-in-dwfl_standard_fin.patch
Patch0001: libcpu-Replace-assert-with-goto-invalid_op-for-bad-p.patch
Patch0002: libelf-Fix-double-free-in-__libelf_compress-on-error.patch
Patch0003: libasm-Fix-double-fclose-in-asm_end.patch
Patch0004: libdw-Call-Dwarf-oom_handler-when-malloc-fails-in-__.patch
Patch0005: libdwfl-Fix-double-free-on-failure-path-in-gzip.c.patch
Patch0006: libdwfl-Handle-debugaltlink-in-dwfl_standard_find_de.patch
Provides: elfutils-libelf elfutils-default-yama-scope default-yama-scope elfutils-libs
Obsoletes: elfutils-libelf elfutils-default-yama-scope elfutils-libs
Requires: glibc >= 2.7 libstdc++
@ -112,13 +104,6 @@ such servers to download those files on demand.
%prep
%setup -q
%patch0000 -p1
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch0004 -p1
%patch0005 -p1
%patch0006 -p1
%build
%configure --program-prefix=%{_programprefix}
@ -246,6 +231,9 @@ exit 0
%systemd_postun_with_restart debuginfod.service
%changelog
* Thu Aug 6 2020 zhangguangzhi<zhangguangzhi3@huawei.com> - 0.180-1
- update to 0.180
* Mon Jun 29 2020 gengqihu<gengqihu1@huawei.com> - 0.179-2
- quality enhancement synchronization git patch

4
elfutils.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: git
src_repo: https://sourceware.org/git/elfutils.git
tag_prefix: "^elfutils-"
seperator: "."

View File

@ -1,46 +0,0 @@
From 8c5bd878a940817088fd7907eb9d503ec98d3437 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Sun, 26 Apr 2020 01:20:57 +0200
Subject: [PATCH 2/5] libasm: Fix double fclose in asm_end.
GCC10 -fanalyzer found a double fclose in asm_end. asm_end can call
text_end, which calls fclose and checks for errors, then asm_end
calls __libasm_finictx which can call fclose again (but doesn't
check for errors). Call fflush in text_end instead. fflush will
generate the same error fclose would if something went wrong writing
out the file.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
libasm/ChangeLog | 4 ++++
libasm/asm_end.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/libasm/ChangeLog b/libasm/ChangeLog
index 7b0d3df..2c092ab 100644
--- a/libasm/ChangeLog
+++ b/libasm/ChangeLog
@@ -1,3 +1,7 @@
+2020-04-25 Mark Wielaard <mark@klomp.org>
+
+ * asm_end.c (text_end): Call fflush instead of fclose.
+
2020-01-08 Mark Wielaard <mark@klomp.org>
* libasm.h: Don't include libebl.h. Define an opaque Ebl handle.
diff --git a/libasm/asm_end.c b/libasm/asm_end.c
index 99e9501..3b8582f 100644
--- a/libasm/asm_end.c
+++ b/libasm/asm_end.c
@@ -47,7 +47,7 @@
static int
text_end (AsmCtx_t *ctx __attribute__ ((unused)))
{
- if (fclose (ctx->out.file) != 0)
+ if (fflush (ctx->out.file) != 0)
{
__libasm_seterrno (ASM_E_IOERROR);
return -1;
--
1.8.3.1

View File

@ -1,72 +0,0 @@
From 25d40a626d36c140c8bb309f410f25af2836ec9b Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Thu, 16 Apr 2020 15:41:57 +0200
Subject: [PATCH] libcpu: Replace assert with goto invalid_op for bad prefix.
https://sourceware.org/bugzilla/show_bug.cgi?id=25831
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
libcpu/ChangeLog | 5 +++++
libcpu/i386_disasm.c | 11 +++++++----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog
index 7079651..a8b2b95 100644
--- a/libcpu/ChangeLog
+++ b/libcpu/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-16 Mark Wielaard <mark@klomp.org>
+
+ * i386_disasm.c (i386_disasm): Replace assert with goto invalid_op
+ for bad prefix.
+
2019-12-11 Omar Sandoval <osandov@fb.com>
* Makefile.am (i386_lex_CFLAGS): Add -Wno-implicit-fallthrough.
diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
index 4422ffa..32df8cd 100644
--- a/libcpu/i386_disasm.c
+++ b/libcpu/i386_disasm.c
@@ -407,7 +407,8 @@ i386_disasm (Ebl *ebl __attribute__((unused)),
++curr;
- assert (last_prefix_bit != 0);
+ if (last_prefix_bit == 0)
+ goto invalid_op;
correct_prefix = last_prefix_bit;
}
@@ -445,8 +446,8 @@ i386_disasm (Ebl *ebl __attribute__((unused)),
the input data. */
goto do_ret;
- assert (correct_prefix == 0
- || (prefixes & correct_prefix) != 0);
+ if (correct_prefix != 0 && (prefixes & correct_prefix) == 0)
+ goto invalid_op;
prefixes ^= correct_prefix;
if (0)
@@ -473,7 +474,8 @@ i386_disasm (Ebl *ebl __attribute__((unused)),
if (data == end)
{
- assert (prefixes != 0);
+ if (prefixes == 0)
+ goto invalid_op;
goto print_prefix;
}
@@ -1125,6 +1127,7 @@ i386_disasm (Ebl *ebl __attribute__((unused)),
}
/* Invalid (or at least unhandled) opcode. */
+ invalid_op:
if (prefixes != 0)
goto print_prefix;
/* Make sure we get past the unrecognized opcode if we haven't yet. */
--
1.8.3.1

View File

@ -1,35 +0,0 @@
From 5436c7529dd9b24f62e3df10e30d5da53da16efd Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Sun, 26 Apr 2020 01:41:27 +0200
Subject: [PATCH 3/5] libdw: Call Dwarf oom_handler() when malloc fails in
__libdw_alloc_tail.
GCC10 -fanalyzer found a possibly-NULL dereference after a failed
malloc in __libdw_alloc_tail. In this case we should call the Dwarf
oom_handler as is done in other places where an essential malloc
call fails. The oom_handler cannot return and will likely just abort.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
libdw/libdw_alloc.c | 5 +++++
1 files changed, 5 insertions(+)
diff --git a/libdw/libdw_alloc.c b/libdw/libdw_alloc.c
index e0281a3..b3e5334 100644
--- a/libdw/libdw_alloc.c
+++ b/libdw/libdw_alloc.c
@@ -87,6 +87,11 @@ __libdw_alloc_tail (Dwarf *dbg)
if (result == NULL)
{
result = malloc (dbg->mem_default_size);
+ if (result == NULL)
+ {
+ pthread_rwlock_unlock (&dbg->mem_rwl);
+ dbg->oom_handler();
+ }
result->size = dbg->mem_default_size
- offsetof (struct libdw_memblock, mem);
result->remaining = result->size;
--
1.8.3.1

View File

@ -1,46 +0,0 @@
From a894c63dba7019ceb8f6aa2c3cdcef519c65c92d Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Sun, 26 Apr 2020 02:10:41 +0200
Subject: [PATCH 4/5] libdwfl: Fix double free on failure path in gzip.c.
GCC10 -fanalyzer found a double free when openstream failed. When
openstream fails __libdw_gunzip will call fail, which frees the
state->buffer. But openstream can call zlib_fail, which will also
call fail. Instead of calling zlib_fail, just return the error
that zlib_fail would have returned.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
libdwfl/ChangeLog | 5 +++++
libdwfl/gzip.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 4ddc9ad..daedaed 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-25 Mark Wielaard <mark@klomp.org>
+
+ * gzip.c (open_stream): Return DWFL_E_NOMEM instead of calling
+ zlib_fail.
+
2020-04-16 Mark Wielaard <mark@klomp.org>
* find-debuginfo.c (dwfl_standard_find_debuginfo): Initialize bits
diff --git a/libdwfl/gzip.c b/libdwfl/gzip.c
index 043d0b6..e9988cc 100644
--- a/libdwfl/gzip.c
+++ b/libdwfl/gzip.c
@@ -153,7 +153,7 @@ open_stream (int fd, off_t start_offset, struct unzip_state *state)
if (unlikely (state->zf == NULL))
{
close (d);
- return zlib_fail (state, Z (MEM_ERROR));
+ return DWFL_E_NOMEM;
}
/* From here on, zlib will close D. */
--
1.8.3.1

View File

@ -1,74 +0,0 @@
From b1d2404cc6ca0d9ce786e229a87c24db49163cfe Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Thu, 30 Apr 2020 23:57:26 +0200
Subject: [PATCH 5/5] libdwfl: Handle debugaltlink in
dwfl_standard_find_debuginfo.
When we fall back to the debuginfod client then we need to do the
same trick we do for local lookups in dwfl_build_id_find_debuginfo.
If the debug file (dw) is already set, then we must be looking for
the altfile. But we cannot use the actual file/path name given as
hint. We'll have to lookup the alt file "build-id". Because the
debuginfod client only handles build-ids.
Previously we would use the build-id of the main file which meant
the debuginfod client would give us another copy of the debug file,
which would then be set as its own altfile. This caused lots of
confusion...
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
libdwfl/ChangeLog | 5 +++++
libdwfl/find-debuginfo.c | 23 +++++++++++++++++++++--
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index daedaed..3f9cd66 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-30 Mark Wielaard <mark@klomp.org>
+
+ * find-debuginfo.c (dwfl_standard_find_debuginfo): When mod->dw
+ is already set then try fetching debugaltlink.
+
2020-04-25 Mark Wielaard <mark@klomp.org>
* gzip.c (open_stream): Return DWFL_E_NOMEM instead of calling
diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c
index 2dd11c4..4cfd0b8 100644
--- a/libdwfl/find-debuginfo.c
+++ b/libdwfl/find-debuginfo.c
@@ -398,8 +398,27 @@ dwfl_standard_find_debuginfo (Dwfl_Module *mod,
free (canon);
}
- if (fd < 0 && bits_len > 0)
- fd = __libdwfl_debuginfod_find_debuginfo (mod->dwfl, bits, bits_len);
+ /* Still nothing? Try if we can use the debuginfod client.
+ But note that we might be looking for the alt file.
+ We use the same trick as dwfl_build_id_find_debuginfo.
+ If the debug file (dw) is already set, then we must be
+ looking for the altfile. But we cannot use the actual
+ file/path name given as hint. We'll have to lookup the
+ alt file "build-id". Because the debuginfod client only
+ handles build-ids. */
+ if (fd < 0)
+ {
+ if (mod->dw != NULL)
+ {
+ const char *altname;
+ bits_len = INTUSE(dwelf_dwarf_gnu_debugaltlink) (mod->dw, &altname,
+ (const void **)
+ &bits);
+ }
+
+ if (bits_len > 0)
+ fd = __libdwfl_debuginfod_find_debuginfo (mod->dwfl, bits, bits_len);
+ }
return fd;
}
--
1.8.3.1

View File

@ -1,67 +0,0 @@
From 39f28eaf8c821d71d57ffc759655ec4168d0bead Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Thu, 16 Apr 2020 17:45:31 +0200
Subject: [PATCH 2/2] libdwfl: Initialize bits to NULL in
dwfl_standard_find_debuginfo for LTO.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
GCC10 LTO is too smart (and somewhat cryptic):
find-debuginfo.c: In function dwfl_standard_find_debuginfo:
debuginfod-client.c:85:8: error: bits may be used uninitialized
in this function [-Werror=maybe-uninitialized]
find-debuginfo.c:360:24: note: bits was declared here
lto1: all warnings being treated as errors
So it inlines __libdwfl_debuginfod_find_debuginfo into
dwfl_standard_find_debuginfo and since it cannot see into the
function pointer (*fp_debuginfod_find_debuginfo), it assumes that
build_id_bit (== bits in dwfl_standard_find_debuginfo) will be used
by the called function and it might not be initialized.
But if you read the code the there is a check for build_id_len > 0
to see whether bits is or isn't initialized before using bits.
But gcc isn't smart enough to figure that out.
Maybe that actually should be an heuristic gcc lto should use.
If the callchain I am inlining is so deep that I cannot figure out
maybe-uninitialized variables anymore I should stop inlining.
For now just help GCC out and initialize bits to NULL.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
libdwfl/ChangeLog | 5 +++++
libdwfl/find-debuginfo.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 0b95490..4ddc9ad 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,8 @@
+2020-04-16 Mark Wielaard <mark@klomp.org>
+
+ * find-debuginfo.c (dwfl_standard_find_debuginfo): Initialize bits
+ to NULL.
+
2020-01-24 Mark Wielaard <mark@klomp.org>
* linux-kernel-modules.c (find_kernel_elf): Check release isn't NULL.
diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c
index 4085764..2dd11c4 100644
--- a/libdwfl/find-debuginfo.c
+++ b/libdwfl/find-debuginfo.c
@@ -357,7 +357,7 @@ dwfl_standard_find_debuginfo (Dwfl_Module *mod,
{
/* First try by build ID if we have one. If that succeeds or fails
other than just by finding nothing, that's all we do. */
- const unsigned char *bits;
+ const unsigned char *bits = NULL;
GElf_Addr vaddr;
int bits_len;
if ((bits_len = INTUSE(dwfl_module_build_id) (mod, &bits, &vaddr)) > 0)
--
1.8.3.1

View File

@ -1,45 +0,0 @@
From a5d73b3e51afada171da9781089cd0e8fc9f64a6 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Sat, 25 Apr 2020 01:21:12 +0200
Subject: [PATCH 1/5] libelf: Fix double free in __libelf_compress on error
path.
In commit 2092865a7e589ff805caa47e69ac9630f34d4f2a
"libelf: {de,}compress: ensure zlib resource cleanup" we added a
call to deflate_cleanup to make sure all resources were freed.
As GCC10 -fanalyzer points out that could cause a double free
of out_buf. Fix by removing the free (out_buf) in __libelf_compress.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
libelf/ChangeLog | 4 ++++
libelf/elf_compress.c | 1 -
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 8f79a62..56f5354 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,7 @@
+2020-04-25 Mark Wielaard <mark@klomp.org>
+
+ * elf_compress.c (__libelf_compress): Remove free (out_buf).
+
2020-03-18 Omar Sandoval <osandov@fb.com>
* elf_getphdrnum.c (__elf_getphdrnum_rdlock): Call
diff --git a/libelf/elf_compress.c b/libelf/elf_compress.c
index b1b8968..e5d3d2e 100644
--- a/libelf/elf_compress.c
+++ b/libelf/elf_compress.c
@@ -113,7 +113,6 @@ __libelf_compress (Elf_Scn *scn, size_t hsize, int ei_data,
int zrc = deflateInit (&z, Z_BEST_COMPRESSION);
if (zrc != Z_OK)
{
- free (out_buf);
__libelf_seterrno (ELF_E_COMPRESS_ERROR);
return deflate_cleanup(NULL, NULL);
}
--
1.8.3.1