* [PATCH] ptrace syscall cleanups for mips compat archs
@ 2008-11-13 19:50 Anirban Sinha
2008-11-13 19:50 ` Anirban Sinha
0 siblings, 1 reply; 5+ messages in thread
From: Anirban Sinha @ 2008-11-13 19:50 UTC (permalink / raw)
To: ralf, linux-mips; +Cc: Kaz Kylheku
[-- Attachment #1: Type: text/plain, Size: 275 bytes --]
Hi Ralf:
I have been looking into some of the very recent cleanups that has been
done to compat_sys_ptrace() after 2.6.26. I believe we can clean up the
system call further. I am proposing the attached patch to this end. Let
me know what you feel.
Cheers,
Ani
[-- Attachment #2: ptrace-cleanup-patch --]
[-- Type: application/octet-stream, Size: 2867 bytes --]
Index: mips-git/arch/mips/kernel/ptrace32.c
===================================================================
--- mips-git.orig/arch/mips/kernel/ptrace32.c
+++ mips-git/arch/mips/kernel/ptrace32.c
@@ -49,19 +49,6 @@ long compat_arch_ptrace(struct task_stru
int 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: {
- unsigned int tmp;
- int copied;
-
- copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
- ret = -EIO;
- if (copied != sizeof(tmp))
- break;
- ret = put_user(tmp, (unsigned int __user *) (unsigned long) data);
- break;
- }
/*
* Read 4 bytes of the other process' storage
@@ -208,16 +195,6 @@ long compat_arch_ptrace(struct task_stru
break;
}
- /* 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 = 0;
- if (access_process_vm(child, addr, &data, sizeof(data), 1)
- == sizeof(data))
- break;
- ret = -EIO;
- break;
-
/*
* Write 4 bytes into the other process' storage
* data is the 4 bytes that the user wants written
@@ -332,50 +309,11 @@ long compat_arch_ptrace(struct task_stru
ret = ptrace_setfpregs(child, (__u32 __user *) (__u64) data);
break;
- case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
- case PTRACE_CONT: { /* restart after signal. */
- ret = -EIO;
- if (!valid_signal(data))
- break;
- if (request == PTRACE_SYSCALL) {
- set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
- }
- else {
- clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
- }
- child->exit_code = data;
- wake_up_process(child);
- ret = 0;
- break;
- }
-
- /*
- * make the child exit. Best I can do is send it a sigkill.
- * perhaps it should be put in the status that it wants to
- * exit.
- */
- case PTRACE_KILL:
- ret = 0;
- if (child->exit_state == EXIT_ZOMBIE) /* already dead */
- break;
- child->exit_code = SIGKILL;
- wake_up_process(child);
- break;
-
case PTRACE_GET_THREAD_AREA:
ret = put_user(task_thread_info(child)->tp_value,
(unsigned int __user *) (unsigned long) data);
break;
- case PTRACE_DETACH: /* detach a process that was attached. */
- ret = ptrace_detach(child, data);
- break;
-
- case PTRACE_GETEVENTMSG:
- ret = put_user(child->ptrace_message,
- (unsigned int __user *) (unsigned long) data);
- break;
-
case PTRACE_GET_THREAD_AREA_3264:
ret = put_user(task_thread_info(child)->tp_value,
(unsigned long __user *) (unsigned long) data);
@@ -392,7 +330,7 @@ long compat_arch_ptrace(struct task_stru
break;
default:
- ret = ptrace_request(child, request, addr, data);
+ ret = compat_ptrace_request(child, request, addr, data);
break;
}
out:
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ptrace syscall cleanups for mips compat archs
2008-11-13 19:50 Anirban Sinha
@ 2008-11-13 19:50 ` Anirban Sinha
0 siblings, 0 replies; 5+ messages in thread
From: Anirban Sinha @ 2008-11-13 19:50 UTC (permalink / raw)
To: ralf, linux-mips; +Cc: Kaz Kylheku
[-- Attachment #1: Type: text/plain, Size: 275 bytes --]
Hi Ralf:
I have been looking into some of the very recent cleanups that has been
done to compat_sys_ptrace() after 2.6.26. I believe we can clean up the
system call further. I am proposing the attached patch to this end. Let
me know what you feel.
Cheers,
Ani
[-- Attachment #2: ptrace-cleanup-patch --]
[-- Type: application/octet-stream, Size: 2867 bytes --]
Index: mips-git/arch/mips/kernel/ptrace32.c
===================================================================
--- mips-git.orig/arch/mips/kernel/ptrace32.c
+++ mips-git/arch/mips/kernel/ptrace32.c
@@ -49,19 +49,6 @@ long compat_arch_ptrace(struct task_stru
int 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: {
- unsigned int tmp;
- int copied;
-
- copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
- ret = -EIO;
- if (copied != sizeof(tmp))
- break;
- ret = put_user(tmp, (unsigned int __user *) (unsigned long) data);
- break;
- }
/*
* Read 4 bytes of the other process' storage
@@ -208,16 +195,6 @@ long compat_arch_ptrace(struct task_stru
break;
}
- /* 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 = 0;
- if (access_process_vm(child, addr, &data, sizeof(data), 1)
- == sizeof(data))
- break;
- ret = -EIO;
- break;
-
/*
* Write 4 bytes into the other process' storage
* data is the 4 bytes that the user wants written
@@ -332,50 +309,11 @@ long compat_arch_ptrace(struct task_stru
ret = ptrace_setfpregs(child, (__u32 __user *) (__u64) data);
break;
- case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
- case PTRACE_CONT: { /* restart after signal. */
- ret = -EIO;
- if (!valid_signal(data))
- break;
- if (request == PTRACE_SYSCALL) {
- set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
- }
- else {
- clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
- }
- child->exit_code = data;
- wake_up_process(child);
- ret = 0;
- break;
- }
-
- /*
- * make the child exit. Best I can do is send it a sigkill.
- * perhaps it should be put in the status that it wants to
- * exit.
- */
- case PTRACE_KILL:
- ret = 0;
- if (child->exit_state == EXIT_ZOMBIE) /* already dead */
- break;
- child->exit_code = SIGKILL;
- wake_up_process(child);
- break;
-
case PTRACE_GET_THREAD_AREA:
ret = put_user(task_thread_info(child)->tp_value,
(unsigned int __user *) (unsigned long) data);
break;
- case PTRACE_DETACH: /* detach a process that was attached. */
- ret = ptrace_detach(child, data);
- break;
-
- case PTRACE_GETEVENTMSG:
- ret = put_user(child->ptrace_message,
- (unsigned int __user *) (unsigned long) data);
- break;
-
case PTRACE_GET_THREAD_AREA_3264:
ret = put_user(task_thread_info(child)->tp_value,
(unsigned long __user *) (unsigned long) data);
@@ -392,7 +330,7 @@ long compat_arch_ptrace(struct task_stru
break;
default:
- ret = ptrace_request(child, request, addr, data);
+ ret = compat_ptrace_request(child, request, addr, data);
break;
}
out:
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] ptrace syscall cleanups for mips compat archs
@ 2008-11-19 0:18 Anirban Sinha
2008-11-19 0:18 ` Anirban Sinha
2008-11-19 12:37 ` Ralf Baechle
0 siblings, 2 replies; 5+ messages in thread
From: Anirban Sinha @ 2008-11-19 0:18 UTC (permalink / raw)
To: linux-mips
Can someone please respond to this patch please? Even something like
"it's a total crap" would be fine!
Index: mips-git/arch/mips/kernel/ptrace32.c
===================================================================
--- mips-git.orig/arch/mips/kernel/ptrace32.c
+++ mips-git/arch/mips/kernel/ptrace32.c
@@ -49,19 +49,6 @@ long compat_arch_ptrace(struct task_stru
int 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: {
- unsigned int tmp;
- int copied;
-
- copied = access_process_vm(child, addr, &tmp,
sizeof(tmp), 0);
- ret = -EIO;
- if (copied != sizeof(tmp))
- break;
- ret = put_user(tmp, (unsigned int __user *) (unsigned
long) data);
- break;
- }
/*
* Read 4 bytes of the other process' storage
@@ -208,16 +195,6 @@ long compat_arch_ptrace(struct task_stru
break;
}
- /* 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 = 0;
- if (access_process_vm(child, addr, &data, sizeof(data),
1)
- == sizeof(data))
- break;
- ret = -EIO;
- break;
-
/*
* Write 4 bytes into the other process' storage
* data is the 4 bytes that the user wants written
@@ -332,50 +309,11 @@ long compat_arch_ptrace(struct task_stru
ret = ptrace_setfpregs(child, (__u32 __user *) (__u64)
data);
break;
- case PTRACE_SYSCALL: /* continue and stop at next (return from)
syscall */
- case PTRACE_CONT: { /* restart after signal. */
- ret = -EIO;
- if (!valid_signal(data))
- break;
- if (request == PTRACE_SYSCALL) {
- set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
- }
- else {
- clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
- }
- child->exit_code = data;
- wake_up_process(child);
- ret = 0;
- break;
- }
-
- /*
- * make the child exit. Best I can do is send it a sigkill.
- * perhaps it should be put in the status that it wants to
- * exit.
- */
- case PTRACE_KILL:
- ret = 0;
- if (child->exit_state == EXIT_ZOMBIE) /* already dead
*/
- break;
- child->exit_code = SIGKILL;
- wake_up_process(child);
- break;
-
case PTRACE_GET_THREAD_AREA:
ret = put_user(task_thread_info(child)->tp_value,
(unsigned int __user *) (unsigned long)
data);
break;
- case PTRACE_DETACH: /* detach a process that was attached. */
- ret = ptrace_detach(child, data);
- break;
-
- case PTRACE_GETEVENTMSG:
- ret = put_user(child->ptrace_message,
- (unsigned int __user *) (unsigned long)
data);
- break;
-
case PTRACE_GET_THREAD_AREA_3264:
ret = put_user(task_thread_info(child)->tp_value,
(unsigned long __user *) (unsigned long)
data);
@@ -392,7 +330,7 @@ long compat_arch_ptrace(struct task_stru
break;
default:
- ret = ptrace_request(child, request, addr, data);
+ ret = compat_ptrace_request(child, request, addr, data);
break;
}
out:
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] ptrace syscall cleanups for mips compat archs
2008-11-19 0:18 [PATCH] ptrace syscall cleanups for mips compat archs Anirban Sinha
@ 2008-11-19 0:18 ` Anirban Sinha
2008-11-19 12:37 ` Ralf Baechle
1 sibling, 0 replies; 5+ messages in thread
From: Anirban Sinha @ 2008-11-19 0:18 UTC (permalink / raw)
To: linux-mips
Can someone please respond to this patch please? Even something like
"it's a total crap" would be fine!
Index: mips-git/arch/mips/kernel/ptrace32.c
===================================================================
--- mips-git.orig/arch/mips/kernel/ptrace32.c
+++ mips-git/arch/mips/kernel/ptrace32.c
@@ -49,19 +49,6 @@ long compat_arch_ptrace(struct task_stru
int 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: {
- unsigned int tmp;
- int copied;
-
- copied = access_process_vm(child, addr, &tmp,
sizeof(tmp), 0);
- ret = -EIO;
- if (copied != sizeof(tmp))
- break;
- ret = put_user(tmp, (unsigned int __user *) (unsigned
long) data);
- break;
- }
/*
* Read 4 bytes of the other process' storage
@@ -208,16 +195,6 @@ long compat_arch_ptrace(struct task_stru
break;
}
- /* 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 = 0;
- if (access_process_vm(child, addr, &data, sizeof(data),
1)
- == sizeof(data))
- break;
- ret = -EIO;
- break;
-
/*
* Write 4 bytes into the other process' storage
* data is the 4 bytes that the user wants written
@@ -332,50 +309,11 @@ long compat_arch_ptrace(struct task_stru
ret = ptrace_setfpregs(child, (__u32 __user *) (__u64)
data);
break;
- case PTRACE_SYSCALL: /* continue and stop at next (return from)
syscall */
- case PTRACE_CONT: { /* restart after signal. */
- ret = -EIO;
- if (!valid_signal(data))
- break;
- if (request == PTRACE_SYSCALL) {
- set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
- }
- else {
- clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
- }
- child->exit_code = data;
- wake_up_process(child);
- ret = 0;
- break;
- }
-
- /*
- * make the child exit. Best I can do is send it a sigkill.
- * perhaps it should be put in the status that it wants to
- * exit.
- */
- case PTRACE_KILL:
- ret = 0;
- if (child->exit_state == EXIT_ZOMBIE) /* already dead
*/
- break;
- child->exit_code = SIGKILL;
- wake_up_process(child);
- break;
-
case PTRACE_GET_THREAD_AREA:
ret = put_user(task_thread_info(child)->tp_value,
(unsigned int __user *) (unsigned long)
data);
break;
- case PTRACE_DETACH: /* detach a process that was attached. */
- ret = ptrace_detach(child, data);
- break;
-
- case PTRACE_GETEVENTMSG:
- ret = put_user(child->ptrace_message,
- (unsigned int __user *) (unsigned long)
data);
- break;
-
case PTRACE_GET_THREAD_AREA_3264:
ret = put_user(task_thread_info(child)->tp_value,
(unsigned long __user *) (unsigned long)
data);
@@ -392,7 +330,7 @@ long compat_arch_ptrace(struct task_stru
break;
default:
- ret = ptrace_request(child, request, addr, data);
+ ret = compat_ptrace_request(child, request, addr, data);
break;
}
out:
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] ptrace syscall cleanups for mips compat archs
2008-11-19 0:18 [PATCH] ptrace syscall cleanups for mips compat archs Anirban Sinha
2008-11-19 0:18 ` Anirban Sinha
@ 2008-11-19 12:37 ` Ralf Baechle
1 sibling, 0 replies; 5+ messages in thread
From: Ralf Baechle @ 2008-11-19 12:37 UTC (permalink / raw)
To: Anirban Sinha; +Cc: linux-mips
On Tue, Nov 18, 2008 at 04:18:58PM -0800, Anirban Sinha wrote:
> Can someone please respond to this patch please? Even something like
> "it's a total crap" would be fine!
In the end it's me who is collecting the patches and I may well be
travelling such as in this case or otherwise busy, so don't hold your
breath.
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-11-19 12:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-19 0:18 [PATCH] ptrace syscall cleanups for mips compat archs Anirban Sinha
2008-11-19 0:18 ` Anirban Sinha
2008-11-19 12:37 ` Ralf Baechle
-- strict thread matches above, loose matches on Subject: below --
2008-11-13 19:50 Anirban Sinha
2008-11-13 19:50 ` Anirban Sinha
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox