Gentoo Archives: gentoo-commits

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