[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080717225632.GA16887@martell.zuzino.mipt.ru>
Date: Fri, 18 Jul 2008 02:56:32 +0400
From: Alexey Dobriyan <adobriyan@...il.com>
To: Roland McGrath <roland@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org
Subject: Re: [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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists