lkml.org 
[lkml]   [2010]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[Patch 4/21] Make fill_psinfo generic
fill_psinfo() fills the NT_PRPSINFO note for the core. NT_PRPSINFO stores the 
command line of the process, which is stored at from mm->arg_start. Make
fill_psinfo reusable by supporting other tasks. Use access_process_vm() to read
the command line args for non-current task.

Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
---
fs/binfmt_elf.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
Index: linux-2.6.36-rc7/fs/binfmt_elf.c
===================================================================
--- linux-2.6.36-rc7.orig/fs/binfmt_elf.c
+++ linux-2.6.36-rc7/fs/binfmt_elf.c
@@ -1211,9 +1211,20 @@ static int fill_psinfo(struct elf_prpsin
len = mm->arg_end - mm->arg_start;
if (len >= ELF_PRARGSZ)
len = ELF_PRARGSZ-1;
- if (copy_from_user(&psinfo->pr_psargs,
- (const char __user *)mm->arg_start, len))
- return -EFAULT;
+ /*
+ * If we are dumping core for "another task"
+ * we can't use copy_from_user().
+ */
+ if (p->group_leader == current->group_leader) {
+ if (copy_from_user(&psinfo->pr_psargs,
+ (const char __user *)mm->arg_start, len))
+ return -EFAULT;
+ } else {
+ int bytes = access_process_vm(p, mm->arg_start,
+ &psinfo->pr_psargs, len, 0);
+ if (bytes != len)
+ return -EFAULT;
+ }
for(i = 0; i < len; i++)
if (psinfo->pr_psargs[i] == 0)
psinfo->pr_psargs[i] = ' ';

\
 
 \ /
  Last update: 2010-12-14 11:03    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site