diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-10-15 17:50:52 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-10-16 10:53:10 +0100 |
| commit | df545375a48efcd0d658cf03b6b994e3235eb7a6 (patch) | |
| tree | 53c1adfdc820447c196369e18f498aad6180ee7d /meta | |
| parent | c410bccc9c746ee2475d0f8dbdf410996adb8be4 (diff) | |
| download | poky-df545375a48efcd0d658cf03b6b994e3235eb7a6.tar.gz | |
patchelf: Update 0.18.0 -> 0.18.0+git
Patchelf hasn't released since 2023 but does have fixes on its master branch. We've been
seeing segfaults on relocated qemu-img binaries from qemu-system-native in some cases
and using an updated patchelf does seem to avoid these.
The patches have all be applied upstream.
https://github.com/NixOS/patchelf/commit/0e338941fc730c1e7080ca04fc1ee18b9ae2854b is 2/3 combined
License-Update: Change http -> https
[https://github.com/NixOS/patchelf/commit/30da44915ec3d22e27dad457dd585e985f576986]
[YOCTO #16003]
(From OE-Core rev: ec616d5ab1d3147a2634a0506111e88964da3fad)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/recipes-devtools/patchelf/patchelf/0001-Set-interpreter-only-when-necessary.patch | 31 | ||||
| -rw-r--r-- | meta/recipes-devtools/patchelf/patchelf/0002-align-startOffset-with-p_align-instead-of-pagesize-f.patch | 42 | ||||
| -rw-r--r-- | meta/recipes-devtools/patchelf/patchelf/0003-make-LOAD-segment-extensions-based-on-p_align-instea.patch | 32 | ||||
| -rw-r--r-- | meta/recipes-devtools/patchelf/patchelf_git.bb (renamed from meta/recipes-devtools/patchelf/patchelf_0.18.0.bb) | 9 |
4 files changed, 4 insertions, 110 deletions
diff --git a/meta/recipes-devtools/patchelf/patchelf/0001-Set-interpreter-only-when-necessary.patch b/meta/recipes-devtools/patchelf/patchelf/0001-Set-interpreter-only-when-necessary.patch deleted file mode 100644 index 9a8216b3fe..0000000000 --- a/meta/recipes-devtools/patchelf/patchelf/0001-Set-interpreter-only-when-necessary.patch +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | From f5df94952e87eaa390e5c845bc48fdb3dbc31cc2 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Yuta Hayama <hayama@lineo.co.jp> | ||
| 3 | Date: Fri, 21 Jul 2023 10:47:02 +0900 | ||
| 4 | Subject: [PATCH] Set interpreter only when necessary | ||
| 5 | |||
| 6 | If the given interpreter is already set, nothing needs to be done. | ||
| 7 | As with modifySoname(), it skips unnecessary processing. | ||
| 8 | |||
| 9 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
| 10 | --- | ||
| 11 | Upstream-Status: Submitted [https://github.com/NixOS/patchelf/pull/508] | ||
| 12 | |||
| 13 | src/patchelf.cc | 5 +++++ | ||
| 14 | 1 file changed, 5 insertions(+) | ||
| 15 | |||
| 16 | diff --git a/src/patchelf.cc b/src/patchelf.cc | ||
| 17 | index 86429c4..e562c49 100644 | ||
| 18 | --- a/src/patchelf.cc | ||
| 19 | +++ b/src/patchelf.cc | ||
| 20 | @@ -1460,6 +1460,11 @@ void ElfFile<ElfFileParamNames>::modifySoname(sonameMode op, const std::string & | ||
| 21 | template<ElfFileParams> | ||
| 22 | void ElfFile<ElfFileParamNames>::setInterpreter(const std::string & newInterpreter) | ||
| 23 | { | ||
| 24 | + if (getInterpreter() == newInterpreter) { | ||
| 25 | + debug("given interpreter is already set\n"); | ||
| 26 | + return; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | std::string & section = replaceSection(".interp", newInterpreter.size() + 1); | ||
| 30 | setSubstr(section, 0, newInterpreter + '\0'); | ||
| 31 | changed = true; | ||
diff --git a/meta/recipes-devtools/patchelf/patchelf/0002-align-startOffset-with-p_align-instead-of-pagesize-f.patch b/meta/recipes-devtools/patchelf/patchelf/0002-align-startOffset-with-p_align-instead-of-pagesize-f.patch deleted file mode 100644 index 7906f0f73b..0000000000 --- a/meta/recipes-devtools/patchelf/patchelf/0002-align-startOffset-with-p_align-instead-of-pagesize-f.patch +++ /dev/null | |||
| @@ -1,42 +0,0 @@ | |||
| 1 | From 1198329b922f3cdddc3e87a7c81d7730b646c088 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Yuta Hayama <hayama@lineo.co.jp> | ||
| 3 | Date: Fri, 28 Jul 2023 16:22:31 +0900 | ||
| 4 | Subject: [PATCH] align startOffset with p_align instead of pagesize for | ||
| 5 | compatibility | ||
| 6 | |||
| 7 | According to the ELF specification, the alignment of loadable process segments | ||
| 8 | should satisfy (p_vaddr mod pagesize) == (p_offset mod pagesize). However, | ||
| 9 | glibc earlier than 2.35 incorrectly requires that the LOAD segment be (p_vaddr | ||
| 10 | mod p_align) == (p_offset mod p_align), and will output the error message | ||
| 11 | "ELF load command address/offset not properly aligned" if this is not met. | ||
| 12 | |||
| 13 | Since there are many systems that use glibc earlier than 2.35, it is preferable | ||
| 14 | that newly added LOAD segments satisfy (p_vaddr mod p_align) == (p_offset mod | ||
| 15 | p_align) for compatibility. | ||
| 16 | |||
| 17 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
| 18 | --- | ||
| 19 | Upstream-Status: Submitted [https://github.com/NixOS/patchelf/pull/510] | ||
| 20 | |||
| 21 | src/patchelf.cc | 8 +++++++- | ||
| 22 | 1 file changed, 7 insertions(+), 1 deletion(-) | ||
| 23 | |||
| 24 | diff --git a/src/patchelf.cc b/src/patchelf.cc | ||
| 25 | index 82b4b46..6edb81a 100644 | ||
| 26 | --- a/src/patchelf.cc | ||
| 27 | +++ b/src/patchelf.cc | ||
| 28 | @@ -843,7 +843,13 @@ void ElfFile<ElfFileParamNames>::rewriteSectionsLibrary() | ||
| 29 | neededSpace += headerTableSpace; | ||
| 30 | debug("needed space is %d\n", neededSpace); | ||
| 31 | |||
| 32 | - Elf_Off startOffset = roundUp(fileContents->size(), getPageSize()); | ||
| 33 | + /* glibc earlier than 2.35 requires that the LOAD segment satisfies | ||
| 34 | + (p_vaddr mod p_align) == (p_offset mod p_align). | ||
| 35 | + The ELF specification requires that loadable process segments satisfy | ||
| 36 | + (p_vaddr mod pagesize) == (p_offset mod pagesize), so glibc is probably | ||
| 37 | + wrong, but here startOffset is calculated according to p_align for | ||
| 38 | + compatibility. */ | ||
| 39 | + Elf_Off startOffset = roundUp(fileContents->size(), alignStartPage); | ||
| 40 | |||
| 41 | // In older version of binutils (2.30), readelf would check if the dynamic | ||
| 42 | // section segment is strictly smaller than the file (and not same size). | ||
diff --git a/meta/recipes-devtools/patchelf/patchelf/0003-make-LOAD-segment-extensions-based-on-p_align-instea.patch b/meta/recipes-devtools/patchelf/patchelf/0003-make-LOAD-segment-extensions-based-on-p_align-instea.patch deleted file mode 100644 index 37eaf992d8..0000000000 --- a/meta/recipes-devtools/patchelf/patchelf/0003-make-LOAD-segment-extensions-based-on-p_align-instea.patch +++ /dev/null | |||
| @@ -1,32 +0,0 @@ | |||
| 1 | From 299ad5766921d593e11a42a8e4dec55b4b350876 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Yuta Hayama <hayama@lineo.co.jp> | ||
| 3 | Date: Mon, 31 Jul 2023 11:58:49 +0900 | ||
| 4 | Subject: [PATCH] make LOAD segment extensions based on p_align instead of | ||
| 5 | pagesize | ||
| 6 | |||
| 7 | Since the p_align of the LOAD segment is no longer pagesize, the actual p_align | ||
| 8 | value is used to calculate for the LOAD segment extension. | ||
| 9 | |||
| 10 | If calculated with pagesize, new LOAD segment may be added even though the | ||
| 11 | existing LOAD segment can be extended. | ||
| 12 | |||
| 13 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
| 14 | --- | ||
| 15 | Upstream-Status: Submitted [https://github.com/NixOS/patchelf/pull/510] | ||
| 16 | |||
| 17 | src/patchelf.cc | 2 +- | ||
| 18 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 19 | |||
| 20 | diff --git a/src/patchelf.cc b/src/patchelf.cc | ||
| 21 | index 6edb81a..86429c4 100644 | ||
| 22 | --- a/src/patchelf.cc | ||
| 23 | +++ b/src/patchelf.cc | ||
| 24 | @@ -885,7 +885,7 @@ void ElfFile<ElfFileParamNames>::rewriteSectionsLibrary() | ||
| 25 | rdi(lastSeg.p_type) == PT_LOAD && | ||
| 26 | rdi(lastSeg.p_flags) == (PF_R | PF_W) && | ||
| 27 | rdi(lastSeg.p_align) == alignStartPage) { | ||
| 28 | - auto segEnd = roundUp(rdi(lastSeg.p_offset) + rdi(lastSeg.p_memsz), getPageSize()); | ||
| 29 | + auto segEnd = roundUp(rdi(lastSeg.p_offset) + rdi(lastSeg.p_memsz), alignStartPage); | ||
| 30 | if (segEnd == startOffset) { | ||
| 31 | auto newSz = startOffset + neededSpace - rdi(lastSeg.p_offset); | ||
| 32 | wri(lastSeg.p_filesz, wri(lastSeg.p_memsz, newSz)); | ||
diff --git a/meta/recipes-devtools/patchelf/patchelf_0.18.0.bb b/meta/recipes-devtools/patchelf/patchelf_git.bb index 6e86ddbde6..daeae96142 100644 --- a/meta/recipes-devtools/patchelf/patchelf_0.18.0.bb +++ b/meta/recipes-devtools/patchelf/patchelf_git.bb | |||
| @@ -5,13 +5,12 @@ HOMEPAGE = "https://github.com/NixOS/patchelf" | |||
| 5 | LICENSE = "GPL-3.0-only" | 5 | LICENSE = "GPL-3.0-only" |
| 6 | 6 | ||
| 7 | SRC_URI = "git://github.com/NixOS/patchelf;protocol=https;branch=master \ | 7 | SRC_URI = "git://github.com/NixOS/patchelf;protocol=https;branch=master \ |
| 8 | file://0001-Set-interpreter-only-when-necessary.patch \ | ||
| 9 | file://0002-align-startOffset-with-p_align-instead-of-pagesize-f.patch \ | ||
| 10 | file://0003-make-LOAD-segment-extensions-based-on-p_align-instea.patch \ | ||
| 11 | " | 8 | " |
| 12 | SRCREV = "99c24238981b7b1084313aca8f5c493bb46f302c" | 9 | SRCREV = "b49de1b3384e7928bf0df9a889fe5a4e7b3fbddf" |
| 13 | 10 | ||
| 14 | LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" | 11 | PV = "0.18.0+git" |
| 12 | |||
| 13 | LIC_FILES_CHKSUM = "file://COPYING;md5=c678957b0c8e964aa6c70fd77641a71e" | ||
| 15 | 14 | ||
| 16 | inherit autotools | 15 | inherit autotools |
| 17 | 16 | ||
