summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-12 18:41:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-12 18:41:33 -0400
commit5f26f1143678d0fed8115afdcc0de99ee7cc9675 (patch)
tree726136c95d9e517ec53846c0b5ad424c71fa6497
parentaabfea8dc91cf5b220d2ed85e8f6395a9b140371 (diff)
parent7f3a8dff1219fba3076fe207972d1d7893c099bb (diff)
Merge tag 'asm-generic-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
Pull asm-generic updates from Arnd Bergmann: "The asm-generic changes for 5.3 consist of a cleanup series to remove ptrace.h from Christoph Hellwig, who explains: 'asm-generic/ptrace.h is a little weird in that it doesn't actually implement any functionality, but it provided multiple layers of macros that just implement trivial inline functions. We implement those directly in the few architectures and be off with a much simpler design.' at https://lore.kernel.org/lkml/20190624054728.30966-1-hch@lst.de/" * tag 'asm-generic-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: asm-generic: remove ptrace.h x86: don't use asm-generic/ptrace.h sh: don't use asm-generic/ptrace.h powerpc: don't use asm-generic/ptrace.h arm64: don't use asm-generic/ptrace.h
-rw-r--r--MAINTAINERS1
-rw-r--r--arch/arm64/include/asm/ptrace.h31
-rw-r--r--arch/mips/include/asm/ptrace.h5
-rw-r--r--arch/powerpc/include/asm/ptrace.h29
-rw-r--r--arch/sh/include/asm/ptrace.h29
-rw-r--r--arch/x86/include/asm/ptrace.h30
-rw-r--r--include/asm-generic/ptrace.h73
7 files changed, 91 insertions, 107 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 16a17fe87fe6..c7d42239d8d9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -12930,7 +12930,6 @@ F: include/linux/regset.h
12930F: include/linux/tracehook.h 12930F: include/linux/tracehook.h
12931F: include/uapi/linux/ptrace.h 12931F: include/uapi/linux/ptrace.h
12932F: include/uapi/linux/ptrace.h 12932F: include/uapi/linux/ptrace.h
12933F: include/asm-generic/ptrace.h
12934F: kernel/ptrace.c 12933F: kernel/ptrace.c
12935F: arch/*/ptrace*.c 12934F: arch/*/ptrace*.c
12936F: arch/*/*/ptrace*.c 12935F: arch/*/*/ptrace*.c
diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h
index 81693244f58d..b1dd039023ef 100644
--- a/arch/arm64/include/asm/ptrace.h
+++ b/arch/arm64/include/asm/ptrace.h
@@ -223,11 +223,12 @@ static inline void forget_syscall(struct pt_regs *regs)
223#define fast_interrupts_enabled(regs) \ 223#define fast_interrupts_enabled(regs) \
224 (!((regs)->pstate & PSR_F_BIT)) 224 (!((regs)->pstate & PSR_F_BIT))
225 225
226#define GET_USP(regs) \ 226static inline unsigned long user_stack_pointer(struct pt_regs *regs)
227 (!compat_user_mode(regs) ? (regs)->sp : (regs)->compat_sp) 227{
228 228 if (compat_user_mode(regs))
229#define SET_USP(ptregs, value) \ 229 return regs->compat_sp;
230 (!compat_user_mode(regs) ? ((regs)->sp = value) : ((regs)->compat_sp = value)) 230 return regs->sp;
231}
231 232
232extern int regs_query_register_offset(const char *name); 233extern int regs_query_register_offset(const char *name);
233extern unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, 234extern unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
@@ -326,13 +327,20 @@ static inline unsigned long regs_get_kernel_argument(struct pt_regs *regs,
326struct task_struct; 327struct task_struct;
327int valid_user_regs(struct user_pt_regs *regs, struct task_struct *task); 328int valid_user_regs(struct user_pt_regs *regs, struct task_struct *task);
328 329
329#define GET_IP(regs) ((unsigned long)(regs)->pc) 330static inline unsigned long instruction_pointer(struct pt_regs *regs)
330#define SET_IP(regs, value) ((regs)->pc = ((u64) (value))) 331{
331 332 return regs->pc;
332#define GET_FP(ptregs) ((unsigned long)(ptregs)->regs[29]) 333}
333#define SET_FP(ptregs, value) ((ptregs)->regs[29] = ((u64) (value))) 334static inline void instruction_pointer_set(struct pt_regs *regs,
335 unsigned long val)
336{
337 regs->pc = val;
338}
334 339
335#include <asm-generic/ptrace.h> 340static inline unsigned long frame_pointer(struct pt_regs *regs)
341{
342 return regs->regs[29];
343}
336 344
337#define procedure_link_pointer(regs) ((regs)->regs[30]) 345#define procedure_link_pointer(regs) ((regs)->regs[30])
338 346
@@ -342,7 +350,6 @@ static inline void procedure_link_pointer_set(struct pt_regs *regs,
342 procedure_link_pointer(regs) = val; 350 procedure_link_pointer(regs) = val;
343} 351}
344 352
345#undef profile_pc
346extern unsigned long profile_pc(struct pt_regs *regs); 353extern unsigned long profile_pc(struct pt_regs *regs);
347 354
348#endif /* __ASSEMBLY__ */ 355#endif /* __ASSEMBLY__ */
diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h
index b6578611dddb..1e76774b36dd 100644
--- a/arch/mips/include/asm/ptrace.h
+++ b/arch/mips/include/asm/ptrace.h
@@ -56,11 +56,6 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
56 return regs->regs[31]; 56 return regs->regs[31];
57} 57}
58 58
59/*
60 * Don't use asm-generic/ptrace.h it defines FP accessors that don't make
61 * sense on MIPS. We rather want an error if they get invoked.
62 */
63
64static inline void instruction_pointer_set(struct pt_regs *regs, 59static inline void instruction_pointer_set(struct pt_regs *regs,
65 unsigned long val) 60 unsigned long val)
66{ 61{
diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
index faa5a338ac5a..feee1b21bbd5 100644
--- a/arch/powerpc/include/asm/ptrace.h
+++ b/arch/powerpc/include/asm/ptrace.h
@@ -111,18 +111,33 @@ struct pt_regs
111 111
112#ifndef __ASSEMBLY__ 112#ifndef __ASSEMBLY__
113 113
114#define GET_IP(regs) ((regs)->nip) 114static inline unsigned long instruction_pointer(struct pt_regs *regs)
115#define GET_USP(regs) ((regs)->gpr[1]) 115{
116#define GET_FP(regs) (0) 116 return regs->nip;
117#define SET_FP(regs, val) 117}
118
119static inline void instruction_pointer_set(struct pt_regs *regs,
120 unsigned long val)
121{
122 regs->nip = val;
123}
124
125static inline unsigned long user_stack_pointer(struct pt_regs *regs)
126{
127 return regs->gpr[1];
128}
129
130static inline unsigned long frame_pointer(struct pt_regs *regs)
131{
132 return 0;
133}
118 134
119#ifdef CONFIG_SMP 135#ifdef CONFIG_SMP
120extern unsigned long profile_pc(struct pt_regs *regs); 136extern unsigned long profile_pc(struct pt_regs *regs);
121#define profile_pc profile_pc 137#else
138#define profile_pc(regs) instruction_pointer(regs)
122#endif 139#endif
123 140
124#include <asm-generic/ptrace.h>
125
126#define kernel_stack_pointer(regs) ((regs)->gpr[1]) 141#define kernel_stack_pointer(regs) ((regs)->gpr[1])
127static inline int is_syscall_success(struct pt_regs *regs) 142static inline int is_syscall_success(struct pt_regs *regs)
128{ 143{
diff --git a/arch/sh/include/asm/ptrace.h b/arch/sh/include/asm/ptrace.h
index 9143c7babcbe..6c89e3e04cee 100644
--- a/arch/sh/include/asm/ptrace.h
+++ b/arch/sh/include/asm/ptrace.h
@@ -16,8 +16,31 @@
16#define user_mode(regs) (((regs)->sr & 0x40000000)==0) 16#define user_mode(regs) (((regs)->sr & 0x40000000)==0)
17#define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15]) 17#define kernel_stack_pointer(_regs) ((unsigned long)(_regs)->regs[15])
18 18
19#define GET_FP(regs) ((regs)->regs[14]) 19static inline unsigned long instruction_pointer(struct pt_regs *regs)
20#define GET_USP(regs) ((regs)->regs[15]) 20{
21 return regs->pc;
22}
23static inline void instruction_pointer_set(struct pt_regs *regs,
24 unsigned long val)
25{
26 regs->pc = val;
27}
28
29static inline unsigned long frame_pointer(struct pt_regs *regs)
30{
31 return regs->regs[14];
32}
33
34static inline unsigned long user_stack_pointer(struct pt_regs *regs)
35{
36 return regs->regs[15];
37}
38
39static inline void user_stack_pointer_set(struct pt_regs *regs,
40 unsigned long val)
41{
42 regs->regs[15] = val;
43}
21 44
22#define arch_has_single_step() (1) 45#define arch_has_single_step() (1)
23 46
@@ -112,7 +135,5 @@ static inline unsigned long profile_pc(struct pt_regs *regs)
112 135
113 return pc; 136 return pc;
114} 137}
115#define profile_pc profile_pc
116 138
117#include <asm-generic/ptrace.h>
118#endif /* __ASM_SH_PTRACE_H */ 139#endif /* __ASM_SH_PTRACE_H */
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 78cf265c5b58..332eb3525867 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -98,7 +98,6 @@ struct cpuinfo_x86;
98struct task_struct; 98struct task_struct;
99 99
100extern unsigned long profile_pc(struct pt_regs *regs); 100extern unsigned long profile_pc(struct pt_regs *regs);
101#define profile_pc profile_pc
102 101
103extern unsigned long 102extern unsigned long
104convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs); 103convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs);
@@ -170,11 +169,32 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
170 return regs->sp; 169 return regs->sp;
171} 170}
172 171
173#define GET_IP(regs) ((regs)->ip) 172static inline unsigned long instruction_pointer(struct pt_regs *regs)
174#define GET_FP(regs) ((regs)->bp) 173{
175#define GET_USP(regs) ((regs)->sp) 174 return regs->ip;
175}
176
177static inline void instruction_pointer_set(struct pt_regs *regs,
178 unsigned long val)
179{
180 regs->ip = val;
181}
182
183static inline unsigned long frame_pointer(struct pt_regs *regs)
184{
185 return regs->bp;
186}
176 187
177#include <asm-generic/ptrace.h> 188static inline unsigned long user_stack_pointer(struct pt_regs *regs)
189{
190 return regs->sp;
191}
192
193static inline void user_stack_pointer_set(struct pt_regs *regs,
194 unsigned long val)
195{
196 regs->sp = val;
197}
178 198
179/* Query offset/name of register from its name/offset */ 199/* Query offset/name of register from its name/offset */
180extern int regs_query_register_offset(const char *name); 200extern int regs_query_register_offset(const char *name);
diff --git a/include/asm-generic/ptrace.h b/include/asm-generic/ptrace.h
deleted file mode 100644
index ab16b6cb1028..000000000000
--- a/include/asm-generic/ptrace.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Common low level (register) ptrace helpers
4 *
5 * Copyright 2004-2011 Analog Devices Inc.
6 */
7
8#ifndef __ASM_GENERIC_PTRACE_H__
9#define __ASM_GENERIC_PTRACE_H__
10
11#ifndef __ASSEMBLY__
12
13/* Helpers for working with the instruction pointer */
14#ifndef GET_IP
15#define GET_IP(regs) ((regs)->pc)
16#endif
17#ifndef SET_IP
18#define SET_IP(regs, val) (GET_IP(regs) = (val))
19#endif
20
21static inline unsigned long instruction_pointer(struct pt_regs *regs)
22{
23 return GET_IP(regs);
24}
25static inline void instruction_pointer_set(struct pt_regs *regs,
26 unsigned long val)
27{
28 SET_IP(regs, val);
29}
30
31#ifndef profile_pc
32#define profile_pc(regs) instruction_pointer(regs)
33#endif
34
35/* Helpers for working with the user stack pointer */
36#ifndef GET_USP
37#define GET_USP(regs) ((regs)->usp)
38#endif
39#ifndef SET_USP
40#define SET_USP(regs, val) (GET_USP(regs) = (val))
41#endif
42
43static inline unsigned long user_stack_pointer(struct pt_regs *regs)
44{
45 return GET_USP(regs);
46}
47static inline void user_stack_pointer_set(struct pt_regs *regs,
48 unsigned long val)
49{
50 SET_USP(regs, val);
51}
52
53/* Helpers for working with the frame pointer */
54#ifndef GET_FP
55#define GET_FP(regs) ((regs)->fp)
56#endif
57#ifndef SET_FP
58#define SET_FP(regs, val) (GET_FP(regs) = (val))
59#endif
60
61static inline unsigned long frame_pointer(struct pt_regs *regs)
62{
63 return GET_FP(regs);
64}
65static inline void frame_pointer_set(struct pt_regs *regs,
66 unsigned long val)
67{
68 SET_FP(regs, val);
69}
70
71#endif /* __ASSEMBLY__ */
72
73#endif