Gentoo Archives: gentoo-commits

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