summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/prelink
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2018-08-16 10:25:46 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-08-16 22:40:27 +0100
commit0f327c393f613dabf4535a71638e47e57b21c521 (patch)
treeb2acb6a91a9ec4a6822a1ffc7567676ad533bcde /meta/recipes-devtools/prelink
parentc66512c2d5432787db5d4b2743d4eb8bcc7e99c2 (diff)
downloadpoky-0f327c393f613dabf4535a71638e47e57b21c521.tar.gz
prelink: use ehdr.e_shstrndx as index rather than ehdr.e_shnum
[YOCTO #12791] According to struct elf32_hd, the e_shnum is section header number, and the index is e_shstrndx, not e_shnum. This can fix segmention fault when handle libqb.so.0.18.2 from libqb_1.0.3. It fails to handle libqb.so.0.18.2 and get errors: Symbol section index outside of section numbers Then segmentation fault, this is because the e_shnum is 34, while e_shstrndx is 27 (it would be 33 when no errors), I've checked several elf files to confirm that the ones after e_shstrndx is NULL, so use e_shstrndx should be correct. Fixed: MACHINE="qemux86-64" IMAGE_INSTALL_append = " libqb" #libqp is from meta-openembedded $ bitbake core-image-minimal Segmention fault (From OE-Core rev: b7c291ee6532cba845ee6bfbbaa21076a2b2cbe5) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/prelink')
-rw-r--r--meta/recipes-devtools/prelink/prelink/0001-src-dso.c-use-ehdr.e_shstrndx-as-index.patch39
-rw-r--r--meta/recipes-devtools/prelink/prelink_git.bb4
2 files changed, 42 insertions, 1 deletions
diff --git a/meta/recipes-devtools/prelink/prelink/0001-src-dso.c-use-ehdr.e_shstrndx-as-index.patch b/meta/recipes-devtools/prelink/prelink/0001-src-dso.c-use-ehdr.e_shstrndx-as-index.patch
new file mode 100644
index 0000000000..d2cd1a70e2
--- /dev/null
+++ b/meta/recipes-devtools/prelink/prelink/0001-src-dso.c-use-ehdr.e_shstrndx-as-index.patch
@@ -0,0 +1,39 @@
1From 107290910ff846532d944ddb78edda436bb6ae63 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Wed, 15 Aug 2018 17:53:43 +0800
4Subject: [PATCH] src/dso.c: use ehdr.e_shstrndx as index
5
6According to struct elf32_hd, the e_shnum is section header number, and the
7index is e_shstrndx, not e_shnum.
8
9This can fix segmention fault when handle libqb.so.0.18.2 from libqb_1.0.3.
10It fails to handle libqb.so.0.18.2 and get errors:
11Symbol section index outside of section numbers
12
13Then segmentation fault, this is because the e_shnum is 34, while e_shstrndx is
1427 (it would be 33 when no errors), I've checked several elf files to confirm
15that the ones after e_shstrndx is NULL, so use e_shstrndx should be correct.
16
17Upstream-Status: Submitted [https://lists.yoctoproject.org/pipermail/yocto/2018-August/042240.html]
18
19Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
20---
21 src/dso.c | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
23
24diff --git a/src/dso.c b/src/dso.c
25index ae5e04d..c59d81f 100644
26--- a/src/dso.c
27+++ b/src/dso.c
28@@ -1659,7 +1659,7 @@ close_dso_1 (DSO *dso)
29 {
30 int i;
31
32- for (i = 1; i < dso->ehdr.e_shnum; ++i)
33+ for (i = 1; i < dso->ehdr.e_shstrndx; ++i)
34 {
35 Elf_Scn *scn = dso->scn[i];
36 Elf_Data *data = NULL;
37--
382.7.4
39
diff --git a/meta/recipes-devtools/prelink/prelink_git.bb b/meta/recipes-devtools/prelink/prelink_git.bb
index 0f6d16e005..c5eaedd4d9 100644
--- a/meta/recipes-devtools/prelink/prelink_git.bb
+++ b/meta/recipes-devtools/prelink/prelink_git.bb
@@ -31,7 +31,9 @@ SRC_URI = "git://git.yoctoproject.org/prelink-cross.git;branch=cross_prelink \
31 file://prelink.conf \ 31 file://prelink.conf \
32 file://prelink.cron.daily \ 32 file://prelink.cron.daily \
33 file://prelink.default \ 33 file://prelink.default \
34 file://macros.prelink" 34 file://macros.prelink \
35 file://0001-src-dso.c-use-ehdr.e_shstrndx-as-index.patch \
36"
35UPSTREAM_CHECK_COMMITS = "1" 37UPSTREAM_CHECK_COMMITS = "1"
36 38
37TARGET_OS_ORIG := "${TARGET_OS}" 39TARGET_OS_ORIG := "${TARGET_OS}"