diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2016-08-17 14:31:25 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2016-08-22 16:43:26 +0000 |
commit | 60f9d69e016b11c468c98ea75ba0a60c44afbbc4 (patch) | |
tree | ecb49581a9e41a37943c22cd9ef3f63451b20ee7 /import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch | |
parent | e18c61205e0234b03697129c20cc69c9b3940efc (diff) | |
download | blackbird-openbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.tar.gz blackbird-openbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.zip |
yocto-poky: Move to import-layers subdir
We are going to import additional layers, so create a subdir to
hold all of the layers that we import with git-subtree.
Change-Id: I6f732153a22be8ca663035c518837e3cc5ec0799
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch')
-rw-r--r-- | import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch new file mode 100644 index 000000000..23b445c9e --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-devtools/gcc/gcc-4.9/0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch @@ -0,0 +1,66 @@ +From a22a222c8f9299f6c07a0274388ade7d4ab8c28d Mon Sep 17 00:00:00 2001 +From: Paul Gortmaker <paul.gortmaker@windriver.com> +Date: Fri, 20 Jun 2014 16:41:08 -0400 +Subject: [PATCH] gcc: fix segfault from calling free on non-malloc'd area + +We see the following on a 32bit gcc installed on 64 bit host: + + Reading symbols from ./i586-pokymllib32-linux-gcc...done. + (gdb) run + Starting program: x86-pokymllib32-linux/lib32-gcc/4.9.0-r0/image/usr/bin/i586-pokymllib32-linux-gcc + + Program received signal SIGSEGV, Segmentation fault. + 0xf7e957e0 in free () from /lib/i386-linux-gnu/libc.so.6 + (gdb) bt + #0 0xf7e957e0 in free () from /lib/i386-linux-gnu/libc.so.6 + #1 0x0804b73c in set_multilib_dir () at gcc-4.9.0/gcc/gcc.c:7827 + #2 main (argc=1, argv=0xffffd504) at gcc-4.9.0/gcc/gcc.c:6688 + (gdb) + +The problem arises because we conditionally assign the pointer we +eventually free, and the conditional may assign the pointer to the +non-malloc'd internal string "." which fails when we free it here: + + if (multilib_dir == NULL && multilib_os_dir != NULL + && strcmp (multilib_os_dir, ".") == 0) + { + free (CONST_CAST (char *, multilib_os_dir)); + ... + +As suggested by Jakub, ensure the "." case is also malloc'd via +xstrdup() and hence the pointer for the "." case can be freed. + +Cc: Jakub Jelinek <jakub@redhat.com> +Cc: Jeff Law <law@redhat.com> +Cc: Matthias Klose <doko@ubuntu.com> +CC: Tobias Burnus <burnus@net-b.de> +Upstream-Status: Accepted [ https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02069.html ] +Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> + +diff --git a/gcc/gcc.c b/gcc/gcc.c +index 9ac18e60d801..168acf7eb0c9 100644 +--- a/gcc/gcc.c ++++ b/gcc/gcc.c +@@ -7790,10 +7790,15 @@ set_multilib_dir (void) + q2++; + if (*q2 == ':') + ml_end = q2; +- new_multilib_os_dir = XNEWVEC (char, ml_end - q); +- memcpy (new_multilib_os_dir, q + 1, ml_end - q - 1); +- new_multilib_os_dir[ml_end - q - 1] = '\0'; +- multilib_os_dir = *new_multilib_os_dir ? new_multilib_os_dir : "."; ++ if (ml_end - q == 1) ++ multilib_os_dir = xstrdup ("."); ++ else ++ { ++ new_multilib_os_dir = XNEWVEC (char, ml_end - q); ++ memcpy (new_multilib_os_dir, q + 1, ml_end - q - 1); ++ new_multilib_os_dir[ml_end - q - 1] = '\0'; ++ multilib_os_dir = new_multilib_os_dir; ++ } + + if (q2 < end && *q2 == ':') + { +-- +1.9.2 + |