|
|
d8307d |
commit 2339d6a55eb7a7e040ae888e906adc49eeb59eab
|
|
|
d8307d |
Author: H.J. Lu <hjl.tools@gmail.com>
|
|
|
d8307d |
Date: Wed Sep 12 08:40:59 2018 -0700
|
|
|
d8307d |
|
|
|
d8307d |
i386: Use ENTRY and END in start.S [BZ #23606]
|
|
|
d8307d |
|
|
|
d8307d |
Wrapping the _start function with ENTRY and END to insert ENDBR32 at
|
|
|
d8307d |
function entry when CET is enabled. Since _start now includes CFI,
|
|
|
d8307d |
without "cfi_undefined (eip)", unwinder may not terminate at _start
|
|
|
d8307d |
and we will get
|
|
|
d8307d |
|
|
|
d8307d |
Program received signal SIGSEGV, Segmentation fault.
|
|
|
d8307d |
0xf7dc661e in ?? () from /lib/libgcc_s.so.1
|
|
|
d8307d |
Missing separate debuginfos, use: dnf debuginfo-install libgcc-8.2.1-3.0.fc28.i686
|
|
|
d8307d |
(gdb) bt
|
|
|
d8307d |
#0 0xf7dc661e in ?? () from /lib/libgcc_s.so.1
|
|
|
d8307d |
#1 0xf7dc7c18 in _Unwind_Backtrace () from /lib/libgcc_s.so.1
|
|
|
d8307d |
#2 0xf7f0d809 in __GI___backtrace (array=array@entry=0xffffc7d0,
|
|
|
d8307d |
size=size@entry=20) at ../sysdeps/i386/backtrace.c:127
|
|
|
d8307d |
#3 0x08049254 in compare (p1=p1@entry=0xffffcad0, p2=p2@entry=0xffffcad4)
|
|
|
d8307d |
at backtrace-tst.c:12
|
|
|
d8307d |
#4 0xf7e2a28c in msort_with_tmp (p=p@entry=0xffffca5c, b=b@entry=0xffffcad0,
|
|
|
d8307d |
n=n@entry=2) at msort.c:65
|
|
|
d8307d |
#5 0xf7e29f64 in msort_with_tmp (n=2, b=0xffffcad0, p=0xffffca5c)
|
|
|
d8307d |
at msort.c:53
|
|
|
d8307d |
#6 msort_with_tmp (p=p@entry=0xffffca5c, b=b@entry=0xffffcad0, n=n@entry=5)
|
|
|
d8307d |
at msort.c:53
|
|
|
d8307d |
#7 0xf7e29f64 in msort_with_tmp (n=5, b=0xffffcad0, p=0xffffca5c)
|
|
|
d8307d |
at msort.c:53
|
|
|
d8307d |
#8 msort_with_tmp (p=p@entry=0xffffca5c, b=b@entry=0xffffcad0, n=n@entry=10)
|
|
|
d8307d |
at msort.c:53
|
|
|
d8307d |
#9 0xf7e29f64 in msort_with_tmp (n=10, b=0xffffcad0, p=0xffffca5c)
|
|
|
d8307d |
at msort.c:53
|
|
|
d8307d |
#10 msort_with_tmp (p=p@entry=0xffffca5c, b=b@entry=0xffffcad0, n=n@entry=20)
|
|
|
d8307d |
at msort.c:53
|
|
|
d8307d |
#11 0xf7e2a5b6 in msort_with_tmp (n=20, b=0xffffcad0, p=0xffffca5c)
|
|
|
d8307d |
at msort.c:297
|
|
|
d8307d |
#12 __GI___qsort_r (b=b@entry=0xffffcad0, n=n@entry=20, s=s@entry=4,
|
|
|
d8307d |
cmp=cmp@entry=0x8049230 <compare>, arg=arg@entry=0x0) at msort.c:297
|
|
|
d8307d |
#13 0xf7e2a84d in __GI_qsort (b=b@entry=0xffffcad0, n=n@entry=20, s=s@entry=4,
|
|
|
d8307d |
cmp=cmp@entry=0x8049230 <compare>) at msort.c:308
|
|
|
d8307d |
#14 0x080490f6 in main (argc=2, argv=0xffffcbd4) at backtrace-tst.c:39
|
|
|
d8307d |
|
|
|
d8307d |
FAIL: debug/backtrace-tst
|
|
|
d8307d |
|
|
|
d8307d |
[BZ #23606]
|
|
|
d8307d |
* sysdeps/i386/start.S: Include <sysdep.h>
|
|
|
d8307d |
(_start): Use ENTRY/END to insert ENDBR32 at entry when CET is
|
|
|
d8307d |
enabled. Add cfi_undefined (eip).
|
|
|
d8307d |
|
|
|
d8307d |
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
|
|
d8307d |
|
|
|
d8307d |
(cherry picked from commit 5a274db4ea363d6b0b92933f085a92daaf1be2f2)
|
|
|
d8307d |
|
|
|
d8307d |
diff --git a/sysdeps/i386/start.S b/sysdeps/i386/start.S
|
|
|
d8307d |
index 91035fa83fb7ee38..e35e9bd31b2cea30 100644
|
|
|
d8307d |
--- a/sysdeps/i386/start.S
|
|
|
d8307d |
+++ b/sysdeps/i386/start.S
|
|
|
d8307d |
@@ -52,10 +52,11 @@
|
|
|
d8307d |
NULL
|
|
|
d8307d |
*/
|
|
|
d8307d |
|
|
|
d8307d |
- .text
|
|
|
d8307d |
- .globl _start
|
|
|
d8307d |
- .type _start,@function
|
|
|
d8307d |
-_start:
|
|
|
d8307d |
+#include <sysdep.h>
|
|
|
d8307d |
+
|
|
|
d8307d |
+ENTRY (_start)
|
|
|
d8307d |
+ /* Clearing frame pointer is insufficient, use CFI. */
|
|
|
d8307d |
+ cfi_undefined (eip)
|
|
|
d8307d |
/* Clear the frame pointer. The ABI suggests this be done, to mark
|
|
|
d8307d |
the outermost frame obviously. */
|
|
|
d8307d |
xorl %ebp, %ebp
|
|
|
d8307d |
@@ -131,6 +132,7 @@ _start:
|
|
|
d8307d |
1: movl (%esp), %ebx
|
|
|
d8307d |
ret
|
|
|
d8307d |
#endif
|
|
|
d8307d |
+END (_start)
|
|
|
d8307d |
|
|
|
d8307d |
/* To fulfill the System V/i386 ABI we need this symbol. Yuck, it's so
|
|
|
d8307d |
meaningless since we don't support machines < 80386. */
|