($INBOX_DIR/description missing)
 help / color / mirror / Atom feed
From: Robert Kovacsics <robert.kovacsics@carallon.com>
To: "openembedded-core@lists.openembedded.org"
	<openembedded-core@lists.openembedded.org>
Subject: [OE-core][PATCH 1/1] sdk: Fix path length limit to match reserved size
Date: Thu, 9 May 2024 17:49:07 +0000	[thread overview]
Message-ID: <CWLP265MB2690EFA16882F3682871EE78EDE62@CWLP265MB2690.GBRP265.PROD.OUTLOOK.COM> (raw)

[-- Attachment #1: Type: text/plain, Size: 1110 bytes --]

Hi,

I was just reading over the code, trying to figure out how the SDK/eSDK installer works, and the following stood out to me as a potential bug: meta/recipes-core/meta/uninative-tarball.bb uses `patchelf` to reserve 1024 bytes in the ELF interpreter section, but the check in meta/files/toolchain-shar-extract.sh is against paths 2048 bytes long.

If I understand correctly, this is because the ELF patching is actually done by the python script scripts/relocate_sdk.py -- presumably because patchelf itself is compiled as a dynamically linked executable, so will refer to `/usr/local/oe-sdk/hardcoded-buildpath/lib/ld-linux*.so`. (I did quickly check, it seems possible to build patchelf statically but that then requires musl I believe.)

Anyway, this just stood out to me as being wrong, but as it wasn't a bug I experienced, perhaps I misunderstood something.

Robert Kovacsics (1):
  sdk: Fix path length limit to match reserved size

 meta/files/toolchain-shar-extract.sh        | 4 +++-
 meta/recipes-core/meta/uninative-tarball.bb | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-sdk-Fix-path-length-limit-to-match-reserved-size.patch --]
[-- Type: text/x-patch; name="0001-sdk-Fix-path-length-limit-to-match-reserved-size.patch", Size: 1695 bytes --]

From 395a3bc51bf0520a838d38ac31012106f19b134d Mon Sep 17 00:00:00 2001
From: Robert Kovacsics <robert.kovacsics@carallon.com>
Date: Thu, 9 May 2024 14:28:17 +0100
Subject: [OE-core][PATCH 1/1] sdk: Fix path length limit to match reserved
 size

---
 meta/files/toolchain-shar-extract.sh        | 4 +++-
 meta/recipes-core/meta/uninative-tarball.bb | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
index 4386b985bb..89d30005fd 100644
--- a/meta/files/toolchain-shar-extract.sh
+++ b/meta/files/toolchain-shar-extract.sh
@@ -164,7 +164,9 @@ else
 fi
 
 # limit the length for target_sdk_dir, ensure the relocation behaviour in relocate_sdk.py has right result.
-if [ ${#target_sdk_dir} -gt 2048 ]; then
+# This is due to ELF interpreter being set to 'a'*1024 in
+# meta/recipes-core/meta/uninative-tarball.bb
+if [ ${#target_sdk_dir} -gt 1024 ]; then
 	echo "Error: The target directory path is too long!!!"
 	exit 1
 fi
diff --git a/meta/recipes-core/meta/uninative-tarball.bb b/meta/recipes-core/meta/uninative-tarball.bb
index 7eebcaf11a..0fd01fdb64 100644
--- a/meta/recipes-core/meta/uninative-tarball.bb
+++ b/meta/recipes-core/meta/uninative-tarball.bb
@@ -58,6 +58,8 @@ fakeroot archive_sdk() {
 	DEST="./${SDK_ARCH}-${SDK_OS}"
 	mv sysroots/${SDK_SYS} $DEST
 	rm sysroots -rf
+	# There is a check in meta/files/toolchain-shar-extract.sh -- make sure to
+	# keep that check up to date if changing the `1024`
 	patchelf --set-interpreter ${@''.join('a' for n in range(1024))} $DEST/usr/bin/patchelf
 	mv $DEST/usr/bin/patchelf $DEST/usr/bin/patchelf-uninative
 	${SDK_ARCHIVE_CMD}
-- 
2.44.0


                 reply	other threads:[~2024-05-09 17:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CWLP265MB2690EFA16882F3682871EE78EDE62@CWLP265MB2690.GBRP265.PROD.OUTLOOK.COM \
    --to=robert.kovacsics@carallon.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).