diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-12-15 19:09:44 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-12-15 19:09:44 -0800 |
commit | 37373d9c37a3401c08f22b61de1726b4f584b2e7 (patch) | |
tree | e5facb9e4442f394b13cfe9614fa14d294ec9a3b | |
parent | 1a825a6a0e7eb55c83c06f3c74631c2eeeb7d27f (diff) | |
parent | d4948d19d47f08f926db55f0fb8cb324e43f1c19 (diff) | |
download | linux-37373d9c37a3401c08f22b61de1726b4f584b2e7.tar.gz linux-37373d9c37a3401c08f22b61de1726b4f584b2e7.tar.bz2 linux-37373d9c37a3401c08f22b61de1726b4f584b2e7.zip |
Merge branch 'regset.followup' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull regset updates from Al Viro:
"Dead code removal, mostly.
The only exception is a bit of cleanups on itanic (getting rid of
redundant stack unwinds - each access_uarea() call does it and we call
that 7 times in a row in ptrace_[sg]etregs(), *after* having done it
ourselves in the caller; location where the user registers have been
spilled won't change under us, and we can bloody well just call
access_elf_reg() directly, giving it the unw_frame_info we'd
calculated for our own purposes)"
* 'regset.followup' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
c6x: kill ELF_CORE_COPY_FPREGS
whack-a-mole: USE_ELF_CORE_DUMP
[ia64] ptrace_[sg]etregs(): use access_elf_reg() instead of access_uarea()
[ia64] missed cleanups from switch to regset coredumps
arm: kill dump_task_regs()
-rw-r--r-- | arch/arm/include/asm/elf.h | 4 | ||||
-rw-r--r-- | arch/arm/kernel/process.c | 9 | ||||
-rw-r--r-- | arch/c6x/include/asm/elf.h | 3 | ||||
-rw-r--r-- | arch/csky/include/asm/elf.h | 1 | ||||
-rw-r--r-- | arch/hexagon/include/asm/elf.h | 1 | ||||
-rw-r--r-- | arch/ia64/kernel/process.c | 2 | ||||
-rw-r--r-- | arch/ia64/kernel/ptrace.c | 51 | ||||
-rw-r--r-- | arch/nds32/include/asm/elf.h | 1 |
8 files changed, 28 insertions, 44 deletions
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h index b078d992414b..61941f369861 100644 --- a/arch/arm/include/asm/elf.h +++ b/arch/arm/include/asm/elf.h @@ -111,10 +111,6 @@ extern int elf_check_arch(const struct elf32_hdr *); extern int arm_elf_read_implies_exec(int); #define elf_read_implies_exec(ex,stk) arm_elf_read_implies_exec(stk) -struct task_struct; -int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs); -#define ELF_CORE_COPY_TASK_REGS dump_task_regs - #define CORE_DUMP_USE_REGSET #define ELF_EXEC_PAGESIZE 4096 diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 9f199b1e8383..ee3aee69e444 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -272,15 +272,6 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start, return 0; } -/* - * Fill in the task's elfregs structure for a core dump. - */ -int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs) -{ - elf_core_copy_regs(elfregs, task_pt_regs(t)); - return 1; -} - unsigned long get_wchan(struct task_struct *p) { struct stackframe frame; diff --git a/arch/c6x/include/asm/elf.h b/arch/c6x/include/asm/elf.h index 89b4437c4844..ca88acbf560b 100644 --- a/arch/c6x/include/asm/elf.h +++ b/arch/c6x/include/asm/elf.h @@ -39,8 +39,6 @@ do { \ #define ELF_FDPIC_CORE_EFLAGS 0 -#define ELF_CORE_COPY_FPREGS(...) 0 /* No FPU regs to copy */ - /* * These are used to set parameters in the core dumps. */ @@ -56,7 +54,6 @@ do { \ /* Nothing for now. Need to setup DP... */ #define ELF_PLAT_INIT(_r) -#define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 4096 #define ELF_CORE_COPY_REGS(_dest, _regs) \ diff --git a/arch/csky/include/asm/elf.h b/arch/csky/include/asm/elf.h index e1ec558278bc..eb2cc5a673b5 100644 --- a/arch/csky/include/asm/elf.h +++ b/arch/csky/include/asm/elf.h @@ -50,7 +50,6 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG]; /* * These are used to set parameters in the core dumps. */ -#define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE 4096 #define ELF_CLASS ELFCLASS32 #define ELF_PLAT_INIT(_r, load_addr) { _r->a0 = 0; } diff --git a/arch/hexagon/include/asm/elf.h b/arch/hexagon/include/asm/elf.h index 9efa203e1164..5bfdd9b147fd 100644 --- a/arch/hexagon/include/asm/elf.h +++ b/arch/hexagon/include/asm/elf.h @@ -181,7 +181,6 @@ do { \ */ #define ELF_PLAT_INIT(regs, load_addr) do { } while (0) -#define USE_ELF_CORE_DUMP #define CORE_DUMP_USE_REGSET /* Hrm is this going to cause problems for changing PAGE_SIZE? */ diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index c9ff8796b509..bfb85d905f83 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c @@ -487,7 +487,7 @@ do_copy_task_regs (struct task_struct *task, struct unw_frame_info *info, void * unw_get_ar(info, UNW_AR_SSD, &dst[56]); } -void +static void do_copy_regs (struct unw_frame_info *info, void *arg) { do_copy_task_regs(current, info, arg); diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c index 75c070aed81e..c3490ee2daa5 100644 --- a/arch/ia64/kernel/ptrace.c +++ b/arch/ia64/kernel/ptrace.c @@ -817,8 +817,8 @@ access_nat_bits (struct task_struct *child, struct pt_regs *pt, } static int -access_uarea (struct task_struct *child, unsigned long addr, - unsigned long *data, int write_access); +access_elf_reg(struct task_struct *target, struct unw_frame_info *info, + unsigned long addr, unsigned long *data, int write_access); static long ptrace_getregs (struct task_struct *child, struct pt_all_user_regs __user *ppr) @@ -847,13 +847,13 @@ ptrace_getregs (struct task_struct *child, struct pt_all_user_regs __user *ppr) return -EIO; } - if (access_uarea(child, PT_CR_IPSR, &psr, 0) < 0 - || access_uarea(child, PT_AR_EC, &ec, 0) < 0 - || access_uarea(child, PT_AR_LC, &lc, 0) < 0 - || access_uarea(child, PT_AR_RNAT, &rnat, 0) < 0 - || access_uarea(child, PT_AR_BSP, &bsp, 0) < 0 - || access_uarea(child, PT_CFM, &cfm, 0) - || access_uarea(child, PT_NAT_BITS, &nat_bits, 0)) + if (access_elf_reg(child, &info, ELF_CR_IPSR_OFFSET, &psr, 0) < 0 || + access_elf_reg(child, &info, ELF_AR_EC_OFFSET, &ec, 0) < 0 || + access_elf_reg(child, &info, ELF_AR_LC_OFFSET, &lc, 0) < 0 || + access_elf_reg(child, &info, ELF_AR_RNAT_OFFSET, &rnat, 0) < 0 || + access_elf_reg(child, &info, ELF_AR_BSP_OFFSET, &bsp, 0) < 0 || + access_elf_reg(child, &info, ELF_CFM_OFFSET, &cfm, 0) < 0 || + access_elf_reg(child, &info, ELF_NAT_OFFSET, &nat_bits, 0) < 0) return -EIO; /* control regs */ @@ -972,7 +972,7 @@ ptrace_setregs (struct task_struct *child, struct pt_all_user_regs __user *ppr) struct switch_stack *sw; struct ia64_fpreg fpval; struct pt_regs *pt; - long ret, retval = 0; + long retval = 0; int i; memset(&fpval, 0, sizeof(fpval)); @@ -1097,17 +1097,16 @@ ptrace_setregs (struct task_struct *child, struct pt_all_user_regs __user *ppr) retval |= __get_user(nat_bits, &ppr->nat); - retval |= access_uarea(child, PT_CR_IPSR, &psr, 1); - retval |= access_uarea(child, PT_AR_RSC, &rsc, 1); - retval |= access_uarea(child, PT_AR_EC, &ec, 1); - retval |= access_uarea(child, PT_AR_LC, &lc, 1); - retval |= access_uarea(child, PT_AR_RNAT, &rnat, 1); - retval |= access_uarea(child, PT_AR_BSP, &bsp, 1); - retval |= access_uarea(child, PT_CFM, &cfm, 1); - retval |= access_uarea(child, PT_NAT_BITS, &nat_bits, 1); + retval |= access_elf_reg(child, &info, ELF_CR_IPSR_OFFSET, &psr, 1); + retval |= access_elf_reg(child, &info, ELF_AR_RSC_OFFSET, &rsc, 1); + retval |= access_elf_reg(child, &info, ELF_AR_EC_OFFSET, &ec, 1); + retval |= access_elf_reg(child, &info, ELF_AR_LC_OFFSET, &lc, 1); + retval |= access_elf_reg(child, &info, ELF_AR_RNAT_OFFSET, &rnat, 1); + retval |= access_elf_reg(child, &info, ELF_AR_BSP_OFFSET, &bsp, 1); + retval |= access_elf_reg(child, &info, ELF_CFM_OFFSET, &cfm, 1); + retval |= access_elf_reg(child, &info, ELF_NAT_OFFSET, &nat_bits, 1); - ret = retval ? -EIO : 0; - return ret; + return retval ? -EIO : 0; } void @@ -1150,6 +1149,10 @@ ptrace_disable (struct task_struct *child) user_disable_single_step(child); } +static int +access_uarea (struct task_struct *child, unsigned long addr, + unsigned long *data, int write_access); + long arch_ptrace (struct task_struct *child, long request, unsigned long addr, unsigned long data) @@ -1491,7 +1494,7 @@ struct regset_membuf { int ret; }; -void do_gpregs_get(struct unw_frame_info *info, void *arg) +static void do_gpregs_get(struct unw_frame_info *info, void *arg) { struct regset_membuf *dst = arg; struct membuf to = dst->to; @@ -1524,7 +1527,7 @@ void do_gpregs_get(struct unw_frame_info *info, void *arg) } } -void do_gpregs_set(struct unw_frame_info *info, void *arg) +static void do_gpregs_set(struct unw_frame_info *info, void *arg) { struct regset_getset *dst = arg; @@ -1569,7 +1572,7 @@ void do_gpregs_set(struct unw_frame_info *info, void *arg) #define ELF_FP_OFFSET(i) (i * sizeof(elf_fpreg_t)) -void do_fpregs_get(struct unw_frame_info *info, void *arg) +static void do_fpregs_get(struct unw_frame_info *info, void *arg) { struct task_struct *task = info->task; struct regset_membuf *dst = arg; @@ -1603,7 +1606,7 @@ void do_fpregs_get(struct unw_frame_info *info, void *arg) membuf_zero(&to, 96 * sizeof(reg)); } -void do_fpregs_set(struct unw_frame_info *info, void *arg) +static void do_fpregs_set(struct unw_frame_info *info, void *arg) { struct regset_getset *dst = arg; elf_fpreg_t fpreg, tmp[30]; diff --git a/arch/nds32/include/asm/elf.h b/arch/nds32/include/asm/elf.h index 1c8e56d7013d..1853dc89b8ac 100644 --- a/arch/nds32/include/asm/elf.h +++ b/arch/nds32/include/asm/elf.h @@ -126,7 +126,6 @@ struct elf32_hdr; #define ELF_DATA ELFDATA2LSB #endif #define ELF_ARCH EM_NDS32 -#define USE_ELF_CORE_DUMP #define ELF_EXEC_PAGESIZE PAGE_SIZE /* This is the location that an ET_DYN program is loaded if exec'ed. Typical |