1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
commit 821e6ff6299aa39e841ca50e1ae8a98e3554fd5f
Author: Alan Modra <amodra@gmail.com>
Date: Wed Oct 12 09:41:33 2016 +1030
BFD_FAKE_SECTION macro params
Order NAME, IDX, FLAGS as per STD_SECTION macro.
* section.c (BFD_FAKE_SECTION): Reorder parameters. Formatting.
(STD_SECTION): Adjust to suit.
* elf.c (_bfd_elf_large_com_section): Likewise.
* bfd-in2.h: Regenerate.
Upstream-Status: Backport
CVE: CVE-2017-8394
Signed-off-by: Thiruvadi Rajaraman <trajaraman@mvista.com>
Index: git/bfd/bfd-in2.h
===================================================================
--- git.orig/bfd/bfd-in2.h 2017-09-20 12:54:42.423465338 +0530
+++ git/bfd/bfd-in2.h 2017-09-20 13:02:48.000000000 +0530
@@ -1767,9 +1767,9 @@
#define bfd_section_removed_from_list(ABFD, S) \
((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S))
-#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
+#define BFD_FAKE_SECTION(SEC, SYM, NAME, IDX, FLAGS) \
/* name, id, index, next, prev, flags, user_set_vma, */ \
- { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
+ { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
\
/* linker_mark, linker_has_input, gc_mark, decompress_status, */ \
0, 0, 1, 0, \
Index: git/bfd/elf.c
===================================================================
--- git.orig/bfd/elf.c 2017-09-20 12:54:44.503474440 +0530
+++ git/bfd/elf.c 2017-09-20 13:02:48.000000000 +0530
@@ -10984,10 +10984,12 @@
return n;
}
-/* It is only used by x86-64 so far. */
+/* It is only used by x86-64 so far.
+ ??? This repeats *COM* id of zero. sec->id is supposed to be unique,
+ but current usage would allow all of _bfd_std_section to be zero. t*/
asection _bfd_elf_large_com_section
- = BFD_FAKE_SECTION (_bfd_elf_large_com_section,
- SEC_IS_COMMON, NULL, "LARGE_COMMON", 0);
+ = BFD_FAKE_SECTION (_bfd_elf_large_com_section, NULL,
+ "LARGE_COMMON", 0, SEC_IS_COMMON);
void
_bfd_elf_post_process_headers (bfd * abfd,
Index: git/bfd/section.c
===================================================================
--- git.orig/bfd/section.c 2017-09-20 12:54:43.815471454 +0530
+++ git/bfd/section.c 2017-09-20 13:02:48.000000000 +0530
@@ -700,9 +700,9 @@
.#define bfd_section_removed_from_list(ABFD, S) \
. ((S)->next == NULL ? (ABFD)->section_last != (S) : (S)->next->prev != (S))
.
-.#define BFD_FAKE_SECTION(SEC, FLAGS, SYM, NAME, IDX) \
+.#define BFD_FAKE_SECTION(SEC, SYM, NAME, IDX, FLAGS) \
. {* name, id, index, next, prev, flags, user_set_vma, *} \
-. { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
+. { NAME, IDX, 0, NULL, NULL, FLAGS, 0, \
. \
. {* linker_mark, linker_has_input, gc_mark, decompress_status, *} \
. 0, 0, 1, 0, \
@@ -764,7 +764,7 @@
};
#define STD_SECTION(NAME, IDX, FLAGS) \
- BFD_FAKE_SECTION(_bfd_std_section[IDX], FLAGS, &global_syms[IDX], NAME, IDX)
+ BFD_FAKE_SECTION(_bfd_std_section[IDX], &global_syms[IDX], NAME, IDX, FLAGS)
asection _bfd_std_section[] = {
STD_SECTION (BFD_COM_SECTION_NAME, 0, SEC_IS_COMMON),
|