use ptrace_request in the remaining architectures
Subsystems (2)
PATCH 1/1 use ptrace_request in the remaining architectures
Use ptrace_request in the three remaining architectures that didn't use it (m68knommu, h8300, microblaze). This means:
- ptrace_request now handles PTRACE_{PEEK,POKE}{TEXT,DATA} and PTRACE_DETATCH calls that were previously called directly, or in case of h8300 even open coded.
- adds new support for PTRACE_SETOPTIONS/PTRACE_GETEVENTMSG/ PTRACE_GETSIGINFO/PTRACE_SETSIGINFO
arch/microblaze/kernel/ptrace.c +1 -26
@@ -78,26 +78,6 @@ long arch_ptrace(struct task_struct *chiunsigned long copied;switch (request) { -case PTRACE_PEEKTEXT :/* read word at location addr. */ -case PTRACE_PEEKDATA : -pr_debug ("PEEKTEXT/PEEKDATA at %08lX\n" , addr); - copied =access_process_vm (child, addr, &val,sizeof (val),0 ); - rval = -EIO ; -if (copied !=sizeof (val)) -break ; - rval =put_user (val, (unsigned long *)data); -break ; - -case PTRACE_POKETEXT :/* write the word at location addr. */ -case PTRACE_POKEDATA : -pr_debug ("POKETEXT/POKEDATA to %08lX\n" , addr); - rval =0 ; -if (access_process_vm (child, addr, &data,sizeof (data),1 ) - ==sizeof (data)) -break ; - rval = -EIO ; -break ; -/* Read/write the word at location ADDR in the registers. */ case PTRACE_PEEKUSR :case PTRACE_POKEUSR :
@@ -167,13 +147,8 @@ long arch_ptrace(struct task_struct *chiwake_up_process (child);break ; -case PTRACE_DETACH :/* detach a process that was attached. */ -pr_debug ("PTRACE_DETACH\n" ); - rval =ptrace_detach (child, data); -break ;default : -/* rval = ptrace_request(child, request, addr, data); noMMU */ - rval = -EIO ; + rval =ptrace_request (child, request, addr, data); }return rval; }
arch/h8300/kernel/ptrace.c +1 -29
@@ -42,14 +42,6 @@ extern void h8300_enable_trace(struct ta* in exit.c or in signal.c. */ -inline -static int read_long (struct task_struct * tsk,unsigned long addr, -unsigned long * result) -{ - *result = *(unsigned long *)addr; -return 0 ; -} -void ptrace_disable (struct task_struct *child) {h8300_disable_trace (child);
@@ -60,17 +52,6 @@ long arch_ptrace(struct task_struct *chiint ret;switch (request) { -case PTRACE_PEEKTEXT :/* read word at location addr. */ -case PTRACE_PEEKDATA : { -unsigned long tmp; - - ret =read_long (child, addr, &tmp); -if (ret <0 ) -break ; - ret =put_user (tmp, (unsigned long *) data); -break ; - } -/* read the word at location addr in the USER area. */ case PTRACE_PEEKUSR : {unsigned long tmp =0 ;
@@ -109,11 +90,6 @@ long arch_ptrace(struct task_struct *chi }/* when I and D space are separate, this will have to be fixed. */ -case PTRACE_POKETEXT :/* write the word at location addr. */ -case PTRACE_POKEDATA : - ret =generic_ptrace_pokedata (child, addr, data); -break ; -case PTRACE_POKEUSR :/* write the word at location addr in the USER area */ if ((addr &3 ) || addr <0 || addr >=sizeof (struct user )) { ret = -EIO ;
@@ -175,10 +151,6 @@ long arch_ptrace(struct task_struct *chibreak ; } -case PTRACE_DETACH :/* detach a process that was attached. */ - ret =ptrace_detach (child, data); -break ; -case PTRACE_GETREGS : {/* Get all gp regs from the child. */ int i;unsigned long tmp;
@@ -210,7 +182,7 @@ long arch_ptrace(struct task_struct *chi }default : - ret = -EIO ; + ret =ptrace_request (child, request, addr, data);break ; }return ret;
arch/m68knommu/kernel/ptrace.c +1 -17
@@ -116,12 +116,6 @@ long arch_ptrace(struct task_struct *chiint ret;switch (request) { -/* when I and D space are separate, these will need to be fixed. */ -case PTRACE_PEEKTEXT :/* read word at location addr. */ -case PTRACE_PEEKDATA : - ret =generic_ptrace_peekdata (child, addr, data); -break ; -/* read the word at location addr in the USER area. */ case PTRACE_PEEKUSR : {unsigned long tmp;
@@ -160,12 +154,6 @@ long arch_ptrace(struct task_struct *chibreak ; } -/* when I and D space are separate, this will have to be fixed. */ -case PTRACE_POKETEXT :/* write the word at location addr. */ -case PTRACE_POKEDATA : - ret =generic_ptrace_pokedata (child, addr, data); -break ; -case PTRACE_POKEUSR :/* write the word at location addr in the USER area */ ret = -EIO ; if ((addr & 3) || addr < 0 ||
@@ -258,10 +246,6 @@ long arch_ptrace(struct task_struct *chibreak ; } -case PTRACE_DETACH :/* detach a process that was attached. */ - ret =ptrace_detach (child, data); -break ; -case PTRACE_GETREGS : {/* Get all gp regs from the child. */ int i;unsigned long tmp;
@@ -320,7 +304,7 @@ long arch_ptrace(struct task_struct *chi#endif default : - ret = -EIO ; + ret =ptrace_request (child, request, addr, data);break ; }return ret;
Quoted 11 lines · Christoph Hellwig
Use
ptrace_requestin the three remaining architectures that didn't use it (m68knommu, h8300, microblaze). This means:-
ptrace_requestnow handles PTRACE_{PEEK,POKE}{TEXT,DATA} andPTRACE_DETATCHcalls that were previously called directly, or in case of h8300 even open coded.
- adds new support for PTRACE_SETOPTIONS/PTRACE_GETEVENTMSG/ PTRACE_GETSIGINFO/PTRACE_SETSIGINFOSigned-off-by Christoph Hellwig <[email protected]>
Quoted 166 lines
Index:
linux-2.6/arch/microblaze/kernel/ptrace.c
===================================================================arch/microblaze/kernel/ptrace.c +1
-26@@ -78,26 +78,6 @@ long arch_ptrace(struct task_struct *chiunsigned long copied;switch (request) { -case PTRACE_PEEKTEXT :/* read word at location addr. */ -case PTRACE_PEEKDATA : -pr_debug ("PEEKTEXT/PEEKDATA at %08lX\n" , addr); - copied =access_process_vm (child, addr, &val,sizeof (val),0 ); - rval = -EIO ; -if (copied !=sizeof (val)) -break ; - rval =put_user (val, (unsigned long *)data); -break ; - -case PTRACE_POKETEXT :/* write the word at location addr. */ -case PTRACE_POKEDATA : -pr_debug ("POKETEXT/POKEDATA to %08lX\n" , addr); - rval =0 ; -if (access_process_vm (child, addr, &data,sizeof (data),1 ) - ==sizeof (data)) -break ; - rval = -EIO ; -break ; -/* Read/write the word at location ADDR in the registers. */ case PTRACE_PEEKUSR :case PTRACE_POKEUSR :@@ -167,13 +147,8 @@ long arch_ptrace(struct task_struct *chiwake_up_process (child);break ; -case PTRACE_DETACH :/* detach a process that was attached. */ -pr_debug ("PTRACE_DETACH\n" ); - rval =ptrace_detach (child, data); -break ;default : -/* rval = ptrace_request(child, request, addr, data); noMMU */ - rval = -EIO ; + rval =ptrace_request (child, request, addr, data); }return rval; }Index:
linux-2.6/arch/h8300/kernel/ptrace.c
===================================================================arch/h8300/kernel/ptrace.c +1
-29@@ -42,14 +42,6 @@ extern void h8300_enable_trace(struct ta* in exit.c or in signal.c. */ -inline -static int read_long (struct task_struct * tsk,unsigned long addr, -unsigned long * result) -{ - *result = *(unsigned long *)addr; -return 0 ; -} -void ptrace_disable (struct task_struct *child) {h8300_disable_trace (child);@@ -60,17 +52,6 @@ long arch_ptrace(struct task_struct *chiint ret;switch (request) { -case PTRACE_PEEKTEXT :/* read word at location addr. */ -case PTRACE_PEEKDATA : { -unsigned long tmp; - - ret =read_long (child, addr, &tmp); -if (ret <0 ) -break ; - ret =put_user (tmp, (unsigned long *) data); -break ; - } -/* read the word at location addr in the USER area. */ case PTRACE_PEEKUSR : {unsigned long tmp =0 ;@@ -109,11 +90,6 @@ long arch_ptrace(struct task_struct *chi }/* when I and D space are separate, this will have to be fixed. */ -case PTRACE_POKETEXT :/* write the word at location addr. */ -case PTRACE_POKEDATA : - ret =generic_ptrace_pokedata (child, addr, data); -break ; -case PTRACE_POKEUSR :/* write the word at location addr in the USER area */ if ((addr &3 ) || addr <0 || addr >=sizeof (struct user )) { ret = -EIO ;@@ -175,10 +151,6 @@ long arch_ptrace(struct task_struct *chibreak ; } -case PTRACE_DETACH :/* detach a process that was attached. */ - ret =ptrace_detach (child, data); -break ; -case PTRACE_GETREGS : {/* Get all gp regs from the child. */ int i;unsigned long tmp;@@ -210,7 +182,7 @@ long arch_ptrace(struct task_struct *chi }default : - ret = -EIO ; + ret =ptrace_request (child, request, addr, data);break ; }return ret;Index:
linux-2.6/arch/m68knommu/kernel/ptrace.c
===================================================================arch/m68knommu/kernel/ptrace.c +1
-17@@ -116,12 +116,6 @@ long arch_ptrace(struct task_struct *chiint ret;switch (request) { -/* when I and D space are separate, these will need to be fixed. */ -case PTRACE_PEEKTEXT :/* read word at location addr. */ -case PTRACE_PEEKDATA : - ret =generic_ptrace_peekdata (child, addr, data); -break ; -/* read the word at location addr in the USER area. */ case PTRACE_PEEKUSR : {unsigned long tmp;@@ -160,12 +154,6 @@ long arch_ptrace(struct task_struct *chibreak ; } -/* when I and D space are separate, this will have to be fixed. */ -case PTRACE_POKETEXT :/* write the word at location addr. */ -case PTRACE_POKEDATA : - ret =generic_ptrace_pokedata (child, addr, data); -break ; -case PTRACE_POKEUSR :/* write the word at location addr in the USER area */ ret = -EIO ; if ((addr & 3) || addr < 0 ||@@ -258,10 +246,6 @@ long arch_ptrace(struct task_struct *chibreak ; } -case PTRACE_DETACH :/* detach a process that was attached. */ - ret =ptrace_detach (child, data); -break ; -case PTRACE_GETREGS : {/* Get all gp regs from the child. */ int i;unsigned long tmp;@@ -320,7 +304,7 @@ long arch_ptrace(struct task_struct *chi#endif default : - ret = -EIO ; + ret =ptrace_request (child, request, addr, data);break ; }return ret;
Signature · 5 lines
------------------------------------------------------------------------ Greg Ungerer -- Principal Engineer EMAIL: [email protected] SnapGear Group, McAfee PHONE: +61 7 3435 2888 8 Gardner Close FAX: +61 7 3217 5323 Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
Quoted 177 lines · Christoph Hellwig
Use
ptrace_requestin the three remaining architectures that didn't use it (m68knommu, h8300, microblaze). This means:-
ptrace_requestnow handles PTRACE_{PEEK,POKE}{TEXT,DATA} andPTRACE_DETATCHcalls that were previously called directly, or in case of h8300 even open coded.
- adds new support for PTRACE_SETOPTIONS/PTRACE_GETEVENTMSG/ PTRACE_GETSIGINFO/PTRACE_SETSIGINFOSigned-off-by Christoph Hellwig <[email protected]>Index:
linux-2.6/arch/microblaze/kernel/ptrace.c
===================================================================arch/microblaze/kernel/ptrace.c +1
-26@@ -78,26 +78,6 @@ long arch_ptrace(struct task_struct *chiunsigned long copied;switch (request) { -case PTRACE_PEEKTEXT :/* read word at location addr. */ -case PTRACE_PEEKDATA : -pr_debug ("PEEKTEXT/PEEKDATA at %08lX\n" , addr); - copied =access_process_vm (child, addr, &val,sizeof (val),0 ); - rval = -EIO ; -if (copied !=sizeof (val)) -break ; - rval =put_user (val, (unsigned long *)data); -break ; - -case PTRACE_POKETEXT :/* write the word at location addr. */ -case PTRACE_POKEDATA : -pr_debug ("POKETEXT/POKEDATA to %08lX\n" , addr); - rval =0 ; -if (access_process_vm (child, addr, &data,sizeof (data),1 ) - ==sizeof (data)) -break ; - rval = -EIO ; -break ; -/* Read/write the word at location ADDR in the registers. */ case PTRACE_PEEKUSR :case PTRACE_POKEUSR :@@ -167,13 +147,8 @@ long arch_ptrace(struct task_struct *chiwake_up_process (child);break ; -case PTRACE_DETACH :/* detach a process that was attached. */ -pr_debug ("PTRACE_DETACH\n" ); - rval =ptrace_detach (child, data); -break ;default : -/* rval = ptrace_request(child, request, addr, data); noMMU */ - rval = -EIO ; + rval =ptrace_request (child, request, addr, data); }return rval; }Index:
linux-2.6/arch/h8300/kernel/ptrace.c
===================================================================arch/h8300/kernel/ptrace.c +1
-29@@ -42,14 +42,6 @@ extern void h8300_enable_trace(struct ta* in exit.c or in signal.c. */ -inline -static int read_long (struct task_struct * tsk,unsigned long addr, -unsigned long * result) -{ - *result = *(unsigned long *)addr; -return 0 ; -} -void ptrace_disable (struct task_struct *child) {h8300_disable_trace (child);@@ -60,17 +52,6 @@ long arch_ptrace(struct task_struct *chiint ret;switch (request) { -case PTRACE_PEEKTEXT :/* read word at location addr. */ -case PTRACE_PEEKDATA : { -unsigned long tmp; - - ret =read_long (child, addr, &tmp); -if (ret <0 ) -break ; - ret =put_user (tmp, (unsigned long *) data); -break ; - } -/* read the word at location addr in the USER area. */ case PTRACE_PEEKUSR : {unsigned long tmp =0 ;@@ -109,11 +90,6 @@ long arch_ptrace(struct task_struct *chi }/* when I and D space are separate, this will have to be fixed. */ -case PTRACE_POKETEXT :/* write the word at location addr. */ -case PTRACE_POKEDATA : - ret =generic_ptrace_pokedata (child, addr, data); -break ; -case PTRACE_POKEUSR :/* write the word at location addr in the USER area */ if ((addr &3 ) || addr <0 || addr >=sizeof (struct user )) { ret = -EIO ;@@ -175,10 +151,6 @@ long arch_ptrace(struct task_struct *chibreak ; } -case PTRACE_DETACH :/* detach a process that was attached. */ - ret =ptrace_detach (child, data); -break ; -case PTRACE_GETREGS : {/* Get all gp regs from the child. */ int i;unsigned long tmp;@@ -210,7 +182,7 @@ long arch_ptrace(struct task_struct *chi }default : - ret = -EIO ; + ret =ptrace_request (child, request, addr, data);break ; }return ret;Index:
linux-2.6/arch/m68knommu/kernel/ptrace.c
===================================================================arch/m68knommu/kernel/ptrace.c +1
-17@@ -116,12 +116,6 @@ long arch_ptrace(struct task_struct *chiint ret;switch (request) { -/* when I and D space are separate, these will need to be fixed. */ -case PTRACE_PEEKTEXT :/* read word at location addr. */ -case PTRACE_PEEKDATA : - ret =generic_ptrace_peekdata (child, addr, data); -break ; -/* read the word at location addr in the USER area. */ case PTRACE_PEEKUSR : {unsigned long tmp;@@ -160,12 +154,6 @@ long arch_ptrace(struct task_struct *chibreak ; } -/* when I and D space are separate, this will have to be fixed. */ -case PTRACE_POKETEXT :/* write the word at location addr. */ -case PTRACE_POKEDATA : - ret =generic_ptrace_pokedata (child, addr, data); -break ; -case PTRACE_POKEUSR :/* write the word at location addr in the USER area */ ret = -EIO ; if ((addr & 3) || addr < 0 ||@@ -258,10 +246,6 @@ long arch_ptrace(struct task_struct *chibreak ; } -case PTRACE_DETACH :/* detach a process that was attached. */ - ret =ptrace_detach (child, data); -break ; -case PTRACE_GETREGS : {/* Get all gp regs from the child. */ int i;unsigned long tmp;@@ -320,7 +304,7 @@ long arch_ptrace(struct task_struct *chi#endif default : - ret = -EIO ; + ret =ptrace_request (child, request, addr, data);break ; }return ret;
Signature · 4 lines
Michal Simek, Ing. (M.Eng) w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/ Microblaze U-BOOT custodian