diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2015-10-30 09:48:27 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-11-16 11:39:34 +0000 |
commit | 7b1763a248d96d6a97cbd5ef1115ef7219271548 (patch) | |
tree | 7c474beead36b4fdce83e1c4322a140f06e9e038 /meta/recipes-core/glibc | |
parent | e63e1918ffdf013fbf466ffbd563f7c36647a4c3 (diff) | |
download | poky-7b1763a248d96d6a97cbd5ef1115ef7219271548.tar.gz |
glibc: Fix ld.so / prelink interface for ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA
A bug in glibc 2.22's ld.so interface for the prelink support causes
the displayed values to be incorrect. The included path fixes this
issue.
Clear ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA for prelink
prelink runs ld.so with the environment variable LD_TRACE_PRELINKING
set to dump the relocation type class from _dl_debug_bindings. prelink
has the following relocation type classes:
where ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA has a conflict with
RTYPE_CLASS_TLS.
Since prelink doesn't use ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA, we
should clear the ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA bit when the
DL_DEBUG_PRELINK bit is set.
(From OE-Core rev: 12c86bdcc60c54e587a896b0dceb8bb6cc9ff7e3)
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/glibc')
-rw-r--r-- | meta/recipes-core/glibc/glibc/0028-Clear-ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA-for-prel.patch | 84 | ||||
-rw-r--r-- | meta/recipes-core/glibc/glibc_2.22.bb | 1 |
2 files changed, 85 insertions, 0 deletions
diff --git a/meta/recipes-core/glibc/glibc/0028-Clear-ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA-for-prel.patch b/meta/recipes-core/glibc/glibc/0028-Clear-ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA-for-prel.patch new file mode 100644 index 0000000000..3455df1cff --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0028-Clear-ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA-for-prel.patch | |||
@@ -0,0 +1,84 @@ | |||
1 | From cadaf1336332ca7bcdfe4a400776e5782a20e26d Mon Sep 17 00:00:00 2001 | ||
2 | From: "H.J. Lu" <hjl.tools@gmail.com> | ||
3 | Date: Wed, 28 Oct 2015 07:49:44 -0700 | ||
4 | Subject: [PATCH] Keep only ELF_RTYPE_CLASS_{PLT|COPY} bits for prelink | ||
5 | |||
6 | prelink runs ld.so with the environment variable LD_TRACE_PRELINKING | ||
7 | set to dump the relocation type class from _dl_debug_bindings. prelink | ||
8 | has the following relocation type classes: | ||
9 | |||
10 | #define RTYPE_CLASS_VALID 8 | ||
11 | #define RTYPE_CLASS_PLT (8|1) | ||
12 | #define RTYPE_CLASS_COPY (8|2) | ||
13 | #define RTYPE_CLASS_TLS (8|4) | ||
14 | |||
15 | where ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA has a conflict with | ||
16 | RTYPE_CLASS_TLS. | ||
17 | |||
18 | Since prelink only uses ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY | ||
19 | bits, we should clear the other bits when the DL_DEBUG_PRELINK bit is | ||
20 | set. | ||
21 | |||
22 | [BZ #19178] | ||
23 | * elf/dl-lookup.c (RTYPE_CLASS_VALID): New. | ||
24 | (RTYPE_CLASS_PLT): Likewise. | ||
25 | (RTYPE_CLASS_COPY): Likewise. | ||
26 | (RTYPE_CLASS_TLS): Likewise. | ||
27 | (_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID | ||
28 | to set relocation type class for DL_DEBUG_PRELINK. Keep only | ||
29 | ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits for | ||
30 | DL_DEBUG_PRELINK. | ||
31 | |||
32 | Upstream-Status: submitted (https://sourceware.org/bugzilla/show_bug.cgi?id=19178) | ||
33 | |||
34 | Signed-off-by: Mark Hatle <mark.hatle@windriver.com> | ||
35 | --- | ||
36 | elf/dl-lookup.c | 21 +++++++++++++++++++-- | ||
37 | 1 file changed, 19 insertions(+), 2 deletions(-) | ||
38 | |||
39 | diff --git a/elf/dl-lookup.c b/elf/dl-lookup.c | ||
40 | index 581fb20..6ae6cc3 100644 | ||
41 | --- a/elf/dl-lookup.c | ||
42 | +++ b/elf/dl-lookup.c | ||
43 | @@ -1016,6 +1016,18 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map, | ||
44 | #ifdef SHARED | ||
45 | if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK) | ||
46 | { | ||
47 | +/* ELF_RTYPE_CLASS_XXX must match RTYPE_CLASS_XXX used by prelink with | ||
48 | + LD_TRACE_PRELINKING. */ | ||
49 | +#define RTYPE_CLASS_VALID 8 | ||
50 | +#define RTYPE_CLASS_PLT (8|1) | ||
51 | +#define RTYPE_CLASS_COPY (8|2) | ||
52 | +#define RTYPE_CLASS_TLS (8|4) | ||
53 | +#if ELF_RTYPE_CLASS_PLT != 0 && ELF_RTYPE_CLASS_PLT != 1 | ||
54 | +# error ELF_RTYPE_CLASS_PLT must be 0 or 1! | ||
55 | +#endif | ||
56 | +#if ELF_RTYPE_CLASS_COPY != 0 && ELF_RTYPE_CLASS_COPY != 2 | ||
57 | +# error ELF_RTYPE_CLASS_COPY must be 0 or 2! | ||
58 | +#endif | ||
59 | int conflict = 0; | ||
60 | struct sym_val val = { NULL, NULL }; | ||
61 | |||
62 | @@ -1071,12 +1083,17 @@ _dl_debug_bindings (const char *undef_name, struct link_map *undef_map, | ||
63 | |||
64 | if (value->s) | ||
65 | { | ||
66 | + /* Keep only ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY | ||
67 | + bits since since prelink only uses them. */ | ||
68 | + type_class &= ELF_RTYPE_CLASS_PLT | ELF_RTYPE_CLASS_COPY; | ||
69 | if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info) | ||
70 | == STT_TLS)) | ||
71 | - type_class = 4; | ||
72 | + /* Clear the RTYPE_CLASS_VALID bit in RTYPE_CLASS_TLS. */ | ||
73 | + type_class = RTYPE_CLASS_TLS & ~RTYPE_CLASS_VALID; | ||
74 | else if (__glibc_unlikely (ELFW(ST_TYPE) (value->s->st_info) | ||
75 | == STT_GNU_IFUNC)) | ||
76 | - type_class |= 8; | ||
77 | + /* Set the RTYPE_CLASS_VALID bit. */ | ||
78 | + type_class |= RTYPE_CLASS_VALID; | ||
79 | } | ||
80 | |||
81 | if (conflict | ||
82 | -- | ||
83 | 1.9.3 | ||
84 | |||
diff --git a/meta/recipes-core/glibc/glibc_2.22.bb b/meta/recipes-core/glibc/glibc_2.22.bb index 2494ad7d97..1b23597ef7 100644 --- a/meta/recipes-core/glibc/glibc_2.22.bb +++ b/meta/recipes-core/glibc/glibc_2.22.bb | |||
@@ -39,6 +39,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ | |||
39 | file://0026-eglibc-dl_debug_mask-is-controlled-by-__OPTION_EGLIB.patch \ | 39 | file://0026-eglibc-dl_debug_mask-is-controlled-by-__OPTION_EGLIB.patch \ |
40 | file://0027-eglibc-use-option-groups-Conditionally-exclude-c-tes.patch \ | 40 | file://0027-eglibc-use-option-groups-Conditionally-exclude-c-tes.patch \ |
41 | file://nscd-no-bash.patch \ | 41 | file://nscd-no-bash.patch \ |
42 | file://0028-Clear-ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA-for-prel.patch \ | ||
42 | " | 43 | " |
43 | 44 | ||
44 | SRC_URI += "\ | 45 | SRC_URI += "\ |