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