SHA256
3
0
forked from pool/glibc
glibc/unwind-ctor.patch
Andreas Schwab 9a39949079 Accepting request 638790 from home:Andreas_Schwab:Factory
- unwind-ctor.patch: Add missing unwind information to ld.so on powerpc32
  (BZ #23707)
- old-getdents64.patch: Rewrite __old_getdents64 (BZ #23497)
- nss-files-leak.patch: Fix file stream leak in aliases lookup (BZ #23521)
- riscv-feholdexcept-setround.patch: Fix rounding save/restore bug
- pthread-cond-broadcast-waiters-after-spinning.patch: Fix
  waiters-after-spinning case (BZ #23538)
- regex-uninit-memory-access.patch: fix uninitialized memory access (BZ
  #23578)
- spawni-maybe-script-execute.patch: Fix segfault in maybe_script_execute
- gethostid-gethostbyname-failure.patch: Check for NULL value from
  gethostbyname_r (BZ #23679)
- strstr-huge-needle.patch: Fix strstr bug with huge needles (BZ #23637)

OBS-URL: https://build.opensuse.org/request/show/638790
OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=511
2018-09-27 13:22:16 +00:00

132 lines
4.7 KiB
Diff

2018-09-26 Andreas Schwab <schwab@suse.de>
[BZ #23707]
* sysdeps/powerpc/powerpc32/dl-start.S: Add unwind information.
* elf/Makefile (tests): Add tst-unwind-ctor.
(modules-names): Add tst-unwind-ctor-lib.
($(objpfx)tst-unwind-ctor): Depend on
$(objpfx)tst-unwind-ctor-lib.so.
Index: glibc-2.28/elf/Makefile
===================================================================
--- glibc-2.28.orig/elf/Makefile
+++ glibc-2.28/elf/Makefile
@@ -186,7 +186,8 @@ tests += restest1 preloadtest loadfail m
tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \
tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose \
- tst-debug1 tst-main1 tst-absolute-sym tst-absolute-zero tst-big-note
+ tst-debug1 tst-main1 tst-absolute-sym tst-absolute-zero tst-big-note \
+ tst-unwind-ctor
# reldep9
tests-internal += loadtest unload unload2 circleload1 \
neededtest neededtest2 neededtest3 neededtest4 \
@@ -273,7 +274,7 @@ modules-names = testobj1 testobj2 testob
tst-latepthreadmod $(tst-tls-many-dynamic-modules) \
tst-nodelete-dlclose-dso tst-nodelete-dlclose-plugin \
tst-main1mod tst-libc_dlvsym-dso tst-absolute-sym-lib \
- tst-absolute-zero-lib tst-big-note-lib
+ tst-absolute-zero-lib tst-big-note-lib tst-unwind-ctor-lib
ifeq (yes,$(have-mtls-dialect-gnu2))
tests += tst-gnu2-tls1
@@ -1484,3 +1485,5 @@ tst-libc_dlvsym-static-ENV = \
$(objpfx)tst-libc_dlvsym-static.out: $(objpfx)tst-libc_dlvsym-dso.so
$(objpfx)tst-big-note: $(objpfx)tst-big-note-lib.so
+
+$(objpfx)tst-unwind-ctor: $(objpfx)tst-unwind-ctor-lib.so
Index: glibc-2.28/elf/tst-unwind-ctor-lib.c
===================================================================
--- /dev/null
+++ glibc-2.28/elf/tst-unwind-ctor-lib.c
@@ -0,0 +1,42 @@
+/* Unit test for _Unwind_Backtrace in a shared object constructor.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <unwind.h>
+#include <unistd.h>
+
+static _Unwind_Reason_Code
+callback (struct _Unwind_Context *ctx, void *arg)
+{
+ return _URC_NO_REASON;
+}
+
+static void
+__attribute__ ((constructor))
+do_unwind (void)
+{
+ /* Arrange for this test to be killed if _Unwind_Backtrace runs into an
+ endless loop. We cannot use the test driver since the test needs to
+ run in a constructor. */
+ alarm (20);
+ _Unwind_Backtrace (callback, 0);
+}
+
+void
+dummy (void)
+{
+}
Index: glibc-2.28/elf/tst-unwind-ctor.c
===================================================================
--- /dev/null
+++ glibc-2.28/elf/tst-unwind-ctor.c
@@ -0,0 +1,27 @@
+/* Unit test for _Unwind_Backtrace in a shared object constructor.
+ Copyright (C) 2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+extern void dummy (void);
+
+int
+main (void)
+{
+ /* Just call a dummy function in the shared library. The actual test
+ runs in its constructor. */
+ dummy ();
+}
Index: glibc-2.28/sysdeps/powerpc/powerpc32/dl-start.S
===================================================================
--- glibc-2.28.orig/sysdeps/powerpc/powerpc32/dl-start.S
+++ glibc-2.28/sysdeps/powerpc/powerpc32/dl-start.S
@@ -34,6 +34,9 @@ ENTRY(_start)
_dl_start to save the link register). */
li r4,0
addi r1,r1,-16
+ cfi_adjust_cfa_offset (16)
+/* Mark lr as undefined to stop unwinding. */
+ cfi_undefined (lr)
stw r4,0(r1)
bl _dl_start@local