lkml.org 
[lkml]   [2008]   [Jul]   [17]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateFri, 18 Jul 2008 02:56:32 +0400
FromAlexey Dobriyan <>
SubjectRe: [PATCH 23/23] /proc/PID/syscall
On Thu, Jul 17, 2008 at 12:31:44AM -0700, Roland McGrath wrote:
> This adds /proc/PID/syscall and /proc/PID/task/TID/syscall magic files.
> These use task_current_syscall() to show the task's current system call
> number and argument registers, stack pointer and PC.

> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -509,6 +509,26 @@ static int proc_pid_limits(struct task_struct *task, char *buffer)
>  	return count;
>  }
> 
> +#ifdef CONFIG_HAVE_ARCH_TRACEHOOK
> +static int proc_pid_syscall(struct task_struct *task, char *buffer)
> +{
> +	long nr;
> +	unsigned long args[6], sp, pc;
> +
> +	if (task_current_syscall(task, &nr, args, 6, &sp, &pc))
> +		return sprintf(buffer, "running\n");
> +
> +	if (nr < 0)
> +		return sprintf(buffer, "%ld 0x%lx 0x%lx\n", nr, sp, pc);
> +
> +	return sprintf(buffer,
> +		       "%ld 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",
> +		       nr,
> +		       args[0], args[1], args[2], args[3], args[4], args[5],
> +		       sp, pc);
> +}
> +#endif /* CONFIG_HAVE_ARCH_TRACEHOOK */

My gut feeling this code needs ptrace_may_access() checks.



\
 
 \ /
  Last update: 2008-07-18 01:01    [from the cache]
©2003-2008