All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libcap: fix nativesdk-libcap relocate failure
@ 2021-10-14  8:47 Hongxu Jia
  0 siblings, 0 replies; only message in thread
From: Hongxu Jia @ 2021-10-14  8:47 UTC (permalink / raw)
  To: openembedded-core

./lat-sdk-poky-intel-x86-64-1.0.sh -y -d sdk-3
...
Setting it up...ERROR: could not relocate
/buildarea/raid5/hjia/community/lat_github_090816/build-3/tmp/deploy/sdk/sdk-3/sysroots/x86_64-pokysdk-linux/usr/lib/libpsx.so.2.54, interp size = 93 and 134 is needed.
...

Since upstream libcap applied commit [ee3b25c Support simply executing
the built shared libraries.][1], it manually append interp section to shared
libraries.

Refer the implement of Yocto glibc[2], allocated a 4096 byte .interp section
for nativesdk

[1] https://git.kernel.org/pub/scm/linux/kernel/git/morgan/libcap.git/commit/?id=ee3b25c0a877fa74d1aec88f325ac45b09963c82
[2] meta/recipes-core/glibc/glibc/0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
---
 ...-Raise-the-size-of-arrays-containing.patch | 36 +++++++++++++++++++
 meta/recipes-support/libcap/libcap_2.54.bb    |  3 ++
 2 files changed, 39 insertions(+)
 create mode 100644 meta/recipes-support/libcap/files/0001-nativesdk-libcap-Raise-the-size-of-arrays-containing.patch

diff --git a/meta/recipes-support/libcap/files/0001-nativesdk-libcap-Raise-the-size-of-arrays-containing.patch b/meta/recipes-support/libcap/files/0001-nativesdk-libcap-Raise-the-size-of-arrays-containing.patch
new file mode 100644
index 0000000000..c7bf1a8b8c
--- /dev/null
+++ b/meta/recipes-support/libcap/files/0001-nativesdk-libcap-Raise-the-size-of-arrays-containing.patch
@@ -0,0 +1,36 @@
+From 794cebc5732908636f22a1d9843fed3ae664899a Mon Sep 17 00:00:00 2001
+From: Hongxu Jia <hongxu.jia@windriver.com>
+Date: Thu, 14 Oct 2021 15:57:36 +0800
+Subject: [PATCH] nativesdk-libcap: Raise the size of arrays containing dl
+ paths
+
+This patch puts the dynamic loader path in the binaries, SYSTEM_DIRS strings
+and lengths as well as ld.so.cache path in the dynamic loader to specific
+sections in memory. The sections that contain paths have been allocated a 4096
+byte section, which is the maximum path length in linux. This will allow the
+relocating script to parse the ELF binary, detect the section and easily replace
+the strings in a certain path.
+
+Upstream-Status: Inappropriate [SDK specific]
+
+Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
+---
+ libcap/execable.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libcap/execable.h b/libcap/execable.h
+index 0bcc5d4..6e2a080 100644
+--- a/libcap/execable.h
++++ b/libcap/execable.h
+@@ -23,7 +23,7 @@
+ #endif
+ #define __EXECABLE_H
+ 
+-const char __execable_dl_loader[] __attribute((section(".interp"))) =
++const char __execable_dl_loader[4096] __attribute((section(".interp"))) =
+     SHARED_LOADER ;
+ 
+ static void __execable_parse_args(int *argc_p, char ***argv_p)
+-- 
+2.27.0
+
diff --git a/meta/recipes-support/libcap/libcap_2.54.bb b/meta/recipes-support/libcap/libcap_2.54.bb
index 04362e7032..fe29f05483 100644
--- a/meta/recipes-support/libcap/libcap_2.54.bb
+++ b/meta/recipes-support/libcap/libcap_2.54.bb
@@ -13,6 +13,9 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/libs/security/linux-privs/${BPN}2/${BPN}-${
            file://0001-ensure-the-XATTR_NAME_CAPS-is-defined-when-it-is-use.patch \
            file://0002-tests-do-not-run-target-executables.patch \
            "
+SRC_URI:append:class-nativesdk = " \
+           file://0001-nativesdk-libcap-Raise-the-size-of-arrays-containing.patch \
+           "
 SRC_URI[sha256sum] = "5091b24247999fd7a5e62bd9ac8bc761cda29f9baa0d1a2ca6a46f13891b4f0f"
 
 UPSTREAM_CHECK_URI = "https://www.kernel.org/pub/linux/libs/security/linux-privs/${BPN}2/"
-- 
2.27.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-14  8:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-14  8:47 [PATCH] libcap: fix nativesdk-libcap relocate failure Hongxu Jia

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.