1 |
commit: e08bdc6ca7fec4ff403493157ca3ae663bace3a6 |
2 |
Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 28 20:06:15 2018 +0000 |
4 |
Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 28 20:06:15 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=e08bdc6c |
7 |
|
8 |
ia64 fix ptrace patch |
9 |
|
10 |
1700_ia64_fix_ptrace.patch | 87 ++++++++++++++++++++++++++++++++++++++++++++++ |
11 |
1 file changed, 87 insertions(+) |
12 |
|
13 |
diff --git a/1700_ia64_fix_ptrace.patch b/1700_ia64_fix_ptrace.patch |
14 |
new file mode 100644 |
15 |
index 0000000..6173b05 |
16 |
--- /dev/null |
17 |
+++ b/1700_ia64_fix_ptrace.patch |
18 |
@@ -0,0 +1,87 @@ |
19 |
+From patchwork Fri Feb 2 22:12:24 2018 |
20 |
+Content-Type: text/plain; charset="utf-8" |
21 |
+MIME-Version: 1.0 |
22 |
+Content-Transfer-Encoding: 8bit |
23 |
+Subject: ia64: fix ptrace(PTRACE_GETREGS) (unbreaks strace, gdb) |
24 |
+From: Sergei Trofimovich <slyfox@g.o> |
25 |
+X-Patchwork-Id: 10198159 |
26 |
+Message-Id: <20180202221224.16597-1-slyfox@g.o> |
27 |
+To: Tony Luck <tony.luck@×××××.com>, Fenghua Yu <fenghua.yu@×××××.com>, |
28 |
+ linux-ia64@×××××××××××.org, linux-kernel@×××××××××××.org |
29 |
+Cc: Sergei Trofimovich <slyfox@g.o> |
30 |
+Date: Fri, 2 Feb 2018 22:12:24 +0000 |
31 |
+ |
32 |
+The strace breakage looks like that: |
33 |
+./strace: get_regs: get_regs_error: Input/output error |
34 |
+ |
35 |
+It happens because ia64 needs to load unwind tables |
36 |
+to read certain registers. Unwind tables fail to load |
37 |
+due to GCC quirk on the following code: |
38 |
+ |
39 |
+ extern char __end_unwind[]; |
40 |
+ const struct unw_table_entry *end = (struct unw_table_entry *)table_end; |
41 |
+ table->end = segment_base + end[-1].end_offset; |
42 |
+ |
43 |
+GCC does not generate correct code for this single memory |
44 |
+reference after constant propagation (see https://gcc.gnu.org/PR84184). |
45 |
+Two triggers are required for bad code generation: |
46 |
+- '__end_unwind' has alignment lower (char), than |
47 |
+ 'struct unw_table_entry' (8). |
48 |
+- symbol offset is negative. |
49 |
+ |
50 |
+This commit workarounds it by fixing alignment of '__end_unwind'. |
51 |
+While at it use hidden symbols to generate shorter gp-relative |
52 |
+relocations. |
53 |
+ |
54 |
+CC: Tony Luck <tony.luck@×××××.com> |
55 |
+CC: Fenghua Yu <fenghua.yu@×××××.com> |
56 |
+CC: linux-ia64@×××××××××××.org |
57 |
+CC: linux-kernel@×××××××××××.org |
58 |
+Bug: https://github.com/strace/strace/issues/33 |
59 |
+Bug: https://gcc.gnu.org/PR84184 |
60 |
+Reported-by: Émeric Maschino <emeric.maschino@×××××.com> |
61 |
+Signed-off-by: Sergei Trofimovich <slyfox@g.o> |
62 |
+Tested-by: stanton_arch@××××.com |
63 |
+--- |
64 |
+ arch/ia64/include/asm/sections.h | 1 - |
65 |
+ arch/ia64/kernel/unwind.c | 15 ++++++++++++++- |
66 |
+ 2 files changed, 14 insertions(+), 2 deletions(-) |
67 |
+ |
68 |
+diff --git a/arch/ia64/include/asm/sections.h b/arch/ia64/include/asm/sections.h |
69 |
+index f3481408594e..0fc4f1757a44 100644 |
70 |
+--- a/arch/ia64/include/asm/sections.h |
71 |
++++ b/arch/ia64/include/asm/sections.h |
72 |
+@@ -24,7 +24,6 @@ extern char __start_gate_mckinley_e9_patchlist[], __end_gate_mckinley_e9_patchli |
73 |
+ extern char __start_gate_vtop_patchlist[], __end_gate_vtop_patchlist[]; |
74 |
+ extern char __start_gate_fsyscall_patchlist[], __end_gate_fsyscall_patchlist[]; |
75 |
+ extern char __start_gate_brl_fsys_bubble_down_patchlist[], __end_gate_brl_fsys_bubble_down_patchlist[]; |
76 |
+-extern char __start_unwind[], __end_unwind[]; |
77 |
+ extern char __start_ivt_text[], __end_ivt_text[]; |
78 |
+ |
79 |
+ #undef dereference_function_descriptor |
80 |
+diff --git a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c |
81 |
+index e04efa088902..025ba6700790 100644 |
82 |
+--- a/arch/ia64/kernel/unwind.c |
83 |
++++ b/arch/ia64/kernel/unwind.c |
84 |
+@@ -2243,7 +2243,20 @@ __initcall(create_gate_table); |
85 |
+ void __init |
86 |
+ unw_init (void) |
87 |
+ { |
88 |
+- extern char __gp[]; |
89 |
++ #define __ia64_hidden __attribute__((visibility("hidden"))) |
90 |
++ /* |
91 |
++ * We use hidden symbols to generate more efficient code using |
92 |
++ * gp-relative addressing. |
93 |
++ */ |
94 |
++ extern char __gp[] __ia64_hidden; |
95 |
++ /* |
96 |
++ * Unwind tables need to have proper alignment as init_unwind_table() |
97 |
++ * uses negative offsets against '__end_unwind'. |
98 |
++ * See https://gcc.gnu.org/PR84184 |
99 |
++ */ |
100 |
++ extern const struct unw_table_entry __start_unwind[] __ia64_hidden; |
101 |
++ extern const struct unw_table_entry __end_unwind[] __ia64_hidden; |
102 |
++ #undef __ia64_hidden |
103 |
+ extern void unw_hash_index_t_is_too_narrow (void); |
104 |
+ long i, off; |
105 |
+ |