Signed-off-by: Richard Purdie <[email protected]>
---
 .../pseudo/files/pathlength.patch             | 38 +++++++++++++++++++
 meta/recipes-devtools/pseudo/pseudo_git.bb    |  1 +
 2 files changed, 39 insertions(+)
 create mode 100644 meta/recipes-devtools/pseudo/files/pathlength.patch

diff --git a/meta/recipes-devtools/pseudo/files/pathlength.patch 
b/meta/recipes-devtools/pseudo/files/pathlength.patch
new file mode 100644
index 00000000000..8507b0144cd
--- /dev/null
+++ b/meta/recipes-devtools/pseudo/files/pathlength.patch
@@ -0,0 +1,38 @@
+Crazy shell code (e.g. libtool) can pass in a command pipeline as a path which 
exceeds the max path
+length the system can support (6000+ chars). This will fail in libc or the 
syscall but if we don't
+do something here, we'd segfault before it can do that. Leave path unchanged 
and let libc deal 
+with it.
+
+This was observed with segfaults in libfm:do_install after the libtool 
upgrade. It does depend on
+the length of the local build path too.
+
+Upstream-Status: Pending
+Signed-off-by: Richard Purdie <[email protected]>
+
+Index: git/pseudo_util.c
+===================================================================
+--- git.orig/pseudo_util.c
++++ git/pseudo_util.c
+@@ -810,12 +810,21 @@ pseudo_fix_path(const char *base, const
+               return 0;
+       }
+       newpathlen = pseudo_path_max();
++      pathlen = strlen(path);
++      /* Crazy shell code (e.g. libtool) can pass in a command pipeline as a 
path which exceeds the max path
++       * length the system can support (6000+ chars). This will fail in libc 
or the syscall but if we don't
++       * do something here, we'd segfault before it can do that. Leave path 
unchanged and let libc deal 
++       * with it. 
++       */
++      if ((pathlen + baselen) >= newpathlen) {
++              return path;
++      }
+       if (!pathbufs[pathbuf]) {
+               pathbufs[pathbuf] = malloc(newpathlen);
+       }
+       newpath = pathbufs[pathbuf];
+       pathbuf = (pathbuf + 1) % PATHBUFS;
+-      pathlen = strlen(path);
++
+       /* a trailing slash has special meaning, but processing
+        * trailing slashes is expensive.
+        */
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb 
b/meta/recipes-devtools/pseudo/pseudo_git.bb
index f9e3b469104..f6fa9010c26 100644
--- a/meta/recipes-devtools/pseudo/pseudo_git.bb
+++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
@@ -2,6 +2,7 @@ require pseudo.inc
 
 SRC_URI = "git://git.yoctoproject.org/pseudo;branch=oe-core \
            file://0001-configure-Prune-PIE-flags.patch \
+           file://pathlength.patch \
            file://fallback-passwd \
            file://fallback-group \
            "
-- 
2.32.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#163444): 
https://lists.openembedded.org/g/openembedded-core/message/163444
Mute This Topic: https://lists.openembedded.org/mt/89864757/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to