diff options
Diffstat (limited to 'meta/recipes-devtools/rpm/rpm/debugedit-segv.patch')
-rw-r--r-- | meta/recipes-devtools/rpm/rpm/debugedit-segv.patch | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/meta/recipes-devtools/rpm/rpm/debugedit-segv.patch b/meta/recipes-devtools/rpm/rpm/debugedit-segv.patch deleted file mode 100644 index c83c8b5f3f..0000000000 --- a/meta/recipes-devtools/rpm/rpm/debugedit-segv.patch +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | During the recalculation of the buildid, it's necessary to change the word | ||
2 | back to the original endian. However, if we do this in-place, we've also | ||
3 | affected the headers that we're also working on. The side effect of this is | ||
4 | we can no longer rely on 'sh_type' as it may have been changed. | ||
5 | |||
6 | This patch ensures that any time we translate the loaded data to the machine | ||
7 | format, we only do it in a backup copy and never the original copy. | ||
8 | |||
9 | Note: in all other places a backup copy was used, just not buildid processing. | ||
10 | |||
11 | Also the process (...) function was modified to verify the data is not | ||
12 | NULL as well. This is an extra check and is not strictly necessary. | ||
13 | |||
14 | Upstream-Status: Submitted [RPM5 maintainer] | ||
15 | |||
16 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> | ||
17 | |||
18 | Index: rpm/tools/debugedit.c | ||
19 | =================================================================== | ||
20 | --- rpm.orig/tools/debugedit.c | ||
21 | +++ rpm/tools/debugedit.c | ||
22 | @@ -1403,7 +1403,8 @@ static inline void process (hashFunction | ||
23 | const void *data, size_t size) | ||
24 | { | ||
25 | memchunk chunk = { .data = (void *) data, .size = size }; | ||
26 | - hashFunctionContextUpdateMC (ctx, &chunk); | ||
27 | + if (data != NULL && size != 0) | ||
28 | + hashFunctionContextUpdateMC (ctx, &chunk); | ||
29 | } | ||
30 | |||
31 | /* Compute a fresh build ID bit-string from the editted file contents. */ | ||
32 | @@ -1456,14 +1457,16 @@ handle_build_id (DSO *dso, Elf_Data *bui | ||
33 | GElf_Ehdr ehdr; | ||
34 | GElf_Phdr phdr; | ||
35 | GElf_Shdr shdr; | ||
36 | - } u; | ||
37 | - Elf_Data x = { .d_version = EV_CURRENT, .d_buf = &u }; | ||
38 | - | ||
39 | - x.d_type = ELF_T_EHDR; | ||
40 | - x.d_size = sizeof u.ehdr; | ||
41 | - u.ehdr = dso->ehdr; | ||
42 | - u.ehdr.e_phoff = u.ehdr.e_shoff = 0; | ||
43 | - if (elf64_xlatetom (&x, &x, dso->ehdr.e_ident[EI_DATA]) == NULL) | ||
44 | + } u1, u2; | ||
45 | + Elf_Data src = { .d_version = EV_CURRENT, .d_buf = &u1 }; | ||
46 | + Elf_Data dest = { .d_version = EV_CURRENT, .d_buf = &u2 }; | ||
47 | + | ||
48 | + src.d_type = ELF_T_EHDR; | ||
49 | + src.d_size = sizeof u1.ehdr; | ||
50 | + dest.d_size = sizeof u2.ehdr; | ||
51 | + u1.ehdr = dso->ehdr; | ||
52 | + u1.ehdr.e_phoff = u1.ehdr.e_shoff = 0; | ||
53 | + if (elf64_xlatetom (&dest, &src, dso->ehdr.e_ident[EI_DATA]) == NULL) | ||
54 | { | ||
55 | bad: | ||
56 | fprintf (stderr, "Failed to compute header checksum: %s\n", | ||
57 | @@ -1471,29 +1474,31 @@ handle_build_id (DSO *dso, Elf_Data *bui | ||
58 | exit (1); | ||
59 | } | ||
60 | |||
61 | - x.d_type = ELF_T_PHDR; | ||
62 | - x.d_size = sizeof u.phdr; | ||
63 | + src.d_type = ELF_T_PHDR; | ||
64 | + src.d_size = sizeof u1.phdr; | ||
65 | + dest.d_size = sizeof u2.phdr; | ||
66 | for (i = 0; i < dso->ehdr.e_phnum; ++i) | ||
67 | { | ||
68 | - if (gelf_getphdr (dso->elf, i, &u.phdr) == NULL) | ||
69 | + if (gelf_getphdr (dso->elf, i, &u1.phdr) == NULL) | ||
70 | goto bad; | ||
71 | - if (elf64_xlatetom (&x, &x, dso->ehdr.e_ident[EI_DATA]) == NULL) | ||
72 | + if (elf64_xlatetom (&dest, &src, dso->ehdr.e_ident[EI_DATA]) == NULL) | ||
73 | goto bad; | ||
74 | - process (&ctx, x.d_buf, x.d_size); | ||
75 | + process (&ctx, dest.d_buf, dest.d_size); | ||
76 | } | ||
77 | |||
78 | - x.d_type = ELF_T_SHDR; | ||
79 | - x.d_size = sizeof u.shdr; | ||
80 | + src.d_type = ELF_T_SHDR; | ||
81 | + src.d_size = sizeof u1.shdr; | ||
82 | + dest.d_size = sizeof u2.shdr; | ||
83 | for (i = 0; i < dso->ehdr.e_shnum; ++i) | ||
84 | if (dso->scn[i] != NULL) | ||
85 | { | ||
86 | - u.shdr = dso->shdr[i]; | ||
87 | - u.shdr.sh_offset = 0; | ||
88 | - if (elf64_xlatetom (&x, &x, dso->ehdr.e_ident[EI_DATA]) == NULL) | ||
89 | + u1.shdr = dso->shdr[i]; | ||
90 | + u1.shdr.sh_offset = 0; | ||
91 | + if (elf64_xlatetom (&dest, &src, dso->ehdr.e_ident[EI_DATA]) == NULL) | ||
92 | goto bad; | ||
93 | - process (&ctx, x.d_buf, x.d_size); | ||
94 | + process (&ctx, dest.d_buf, dest.d_size); | ||
95 | |||
96 | - if (u.shdr.sh_type != SHT_NOBITS) | ||
97 | + if (u1.shdr.sh_type != SHT_NOBITS) | ||
98 | { | ||
99 | Elf_Data *d = elf_rawdata (dso->scn[i], NULL); | ||
100 | if (d == NULL) | ||