c6952c
Fix reading and updating (cross-endian) build-id information.
@@ -0,0 +1,91 @@
|
|
1
|
+
diff --git a/tools/debugedit.c b/tools/debugedit.c
|
2
|
+
index 4798c63..47e5bbf 100644
|
3
|
+
--- a/tools/debugedit.c
|
4
|
+
+++ b/tools/debugedit.c
|
5
|
+
@@ -2581,40 +2581,25 @@ main (int argc, char *argv[])
|
6
|
+
break;
|
7
|
+
case SHT_NOTE:
|
8
|
+
if (do_build_id
|
9
|
+
- && build_id == NULL && (dso->shdr[i].sh_flags & SHF_ALLOC))
|
10
|
+
+ && build_id == 0 && (dso->shdr[i].sh_flags & SHF_ALLOC))
|
11
|
+
{
|
12
|
+
/* Look for a build-ID note here. */
|
13
|
+
+ size_t off = 0;
|
14
|
+
+ GElf_Nhdr nhdr;
|
15
|
+
+ size_t name_off;
|
16
|
+
+ size_t desc_off;
|
17
|
+
Elf_Data *data = elf_getdata (elf_getscn (dso->elf, i), NULL);
|
18
|
+
- Elf32_Nhdr nh;
|
19
|
+
- Elf_Data dst =
|
20
|
+
- {
|
21
|
+
- .d_version = EV_CURRENT, .d_type = ELF_T_NHDR,
|
22
|
+
- .d_buf = &nh, .d_size = sizeof nh
|
23
|
+
- };
|
24
|
+
- Elf_Data src = dst;
|
25
|
+
- src.d_buf = data->d_buf;
|
26
|
+
- assert (sizeof (Elf32_Nhdr) == sizeof (Elf64_Nhdr));
|
27
|
+
- while ((char *) data->d_buf + data->d_size -
|
28
|
+
- (char *) src.d_buf > (int) sizeof nh
|
29
|
+
- && elf32_xlatetom (&dst, &src, dso->ehdr.e_ident[EI_DATA]))
|
30
|
+
- {
|
31
|
+
- Elf32_Word len = sizeof nh + nh.n_namesz;
|
32
|
+
- len = (len + 3) & ~3;
|
33
|
+
-
|
34
|
+
- if (nh.n_namesz == sizeof "GNU" && nh.n_type == 3
|
35
|
+
- && !memcmp ((char *) src.d_buf + sizeof nh, "GNU", sizeof "GNU"))
|
36
|
+
- {
|
37
|
+
- build_id = data;
|
38
|
+
- build_id_offset = (char *) src.d_buf + len -
|
39
|
+
- (char *) data->d_buf;
|
40
|
+
- build_id_size = nh.n_descsz;
|
41
|
+
- break;
|
42
|
+
- }
|
43
|
+
-
|
44
|
+
- len += nh.n_descsz;
|
45
|
+
- len = (len + 3) & ~3;
|
46
|
+
- src.d_buf = (char *) src.d_buf + len;
|
47
|
+
- }
|
48
|
+
+ while ((off = gelf_getnote (data, off,
|
49
|
+
+ &nhdr, &name_off, &desc_off)) > 0)
|
50
|
+
+ if (nhdr.n_type == NT_GNU_BUILD_ID
|
51
|
+
+ && nhdr.n_namesz == sizeof "GNU"
|
52
|
+
+ && (memcmp ((char *)data->d_buf + name_off, "GNU",
|
53
|
+
+ sizeof "GNU") == 0))
|
54
|
+
+ {
|
55
|
+
+ build_id = data;
|
56
|
+
+ build_id_offset = desc_off;
|
57
|
+
+ build_id_size = nhdr.n_descsz;
|
58
|
+
+ }
|
59
|
+
}
|
60
|
+
break;
|
61
|
+
default:
|
62
|
+
@@ -2622,6 +2607,20 @@ main (int argc, char *argv[])
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
+ /* Normally we only need to explicitly update the section headers
|
67
|
+
+ and data when any section data changed size. But because of a bug
|
68
|
+
+ in elfutils before 0.169 we will have to update and write out all
|
69
|
+
+ section data if any data has changed (when ELF_F_LAYOUT was
|
70
|
+
+ set). https://sourceware.org/bugzilla/show_bug.cgi?id=21199 */
|
71
|
+
+ bool need_update = need_strp_update || need_stmt_update;
|
72
|
+
+
|
73
|
+
+#if !_ELFUTILS_PREREQ (0, 169)
|
74
|
+
+ /* string replacements or build_id updates don't change section size. */
|
75
|
+
+ need_update = (need_update
|
76
|
+
+ || need_string_replacement
|
77
|
+
+ || (do_build_id && build_id != NULL));
|
78
|
+
+#endif
|
79
|
+
+
|
80
|
+
/* We might have changed the size of some debug sections. If so make
|
81
|
+
sure the section headers are updated and the data offsets are
|
82
|
+
correct. We set ELF_F_LAYOUT above because we don't want libelf
|
83
|
+
@@ -2631,7 +2630,7 @@ main (int argc, char *argv[])
|
84
|
+
anything for the phdrs allocated sections. Keep the offset of
|
85
|
+
allocated sections so they are at the same place in the file. Add
|
86
|
+
unallocated ones after the allocated ones. */
|
87
|
+
- if (dso->phnum != 0 && (need_strp_update || need_stmt_update))
|
88
|
+
+ if (dso->phnum != 0 && need_update)
|
89
|
+
{
|
90
|
+
Elf *elf = dso->elf;
|
91
|
+
GElf_Off last_offset;
|
@@ -29,7 +29,7 @@
|
|
29
29
|
Summary: The RPM package management system
|
30
30
|
Name: rpm
|
31
31
|
Version: %{rpmver}
|
32
|
-
Release: %{?snapver:0.%{snapver}.}
|
32
|
+
Release: %{?snapver:0.%{snapver}.}12%{?dist}
|
33
33
|
Group: System Environment/Base
|
34
34
|
Url: http://www.rpm.org/
|
35
35
|
Source0: http://rpm.org/releases/%{srcdir}/%{name}-%{srcver}.tar.bz2
|
@@ -89,6 +89,7 @@ Patch263: 0014-generateBuildIDs-Fix-error-handling.patch
|
|
89
89
|
Patch264: 0015-reset-buildid-file-attrs.patch
|
90
90
|
Patch265: 0016-debugedit-replace-files.patch
|
91
91
|
Patch266: 0017-do-not-process-buildi-ds-for-noarch.patch
|
92
|
+
Patch267: 0018-update-build-id-endian.patch
|
92
93
|
|
93
94
|
# OpenSSL backend
|
94
95
|
Patch300: 0001-Add-OpenSSL-support-for-digest-and-signatures.patch
|
@@ -593,6 +594,9 @@ exit 0
|
|
593
594
|
%doc doc/librpm/html/*
|
594
595
|
|
595
596
|
%changelog
|
597
|
+
* Fri Mar 17 2017 Mark Wielaard <mjw@redhat.com> - 4.13.0.1-12
|
598
|
+
- Fix reading and updating (cross-endian) build-id information.
|
599
|
+
|
596
600
|
* Fri Mar 17 2017 Mark Wielaard <mjw@redhat.com> - 4.13.0.1-11
|
597
601
|
- Do not process build-ids for noarch packages.
|
598
602
|
|