[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131004103106.1612.23691.stgit@f19-x64>
Date: Fri, 04 Oct 2013 16:01:06 +0530
From: Janani Venkataraman <jananive@...ibm.com>
To: linux-kernel@...r.kernel.org
Cc: amwang@...hat.com, rdunlap@...otime.net, andi@...stfloor.org,
aravinda@...ux.vnet.ibm.com, hch@....de, mhiramat@...hat.com,
jeremy.fitzhardinge@...rix.com, xemul@...allels.com,
suzuki@...ux.vnet.ibm.com, kosaki.motohiro@...fujitsu.com,
adobriyan@...il.com, tarundsk@...ux.vnet.ibm.com,
vapier@...too.org, roland@...k.frob.com, tj@...nel.org,
ananth@...ux.vnet.ibm.com, gorcunov@...nvz.org, avagin@...nvz.org,
oleg@...hat.com, eparis@...hat.com, d.hatayama@...fujitsu.com,
james.hogan@...tec.com, akpm@...ux-foundation.org,
torvalds@...ux-foundation.org
Subject: [PATCH 03/19] Make fill_psinfo generic
From:Suzuki K. Poulose <suzuki@...ibm.com>
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@...ibm.com>
---
fs/binfmt_elf.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 107bbd3..4eee017 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1222,9 +1222,21 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
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->mm == current->mm) {
+ 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] = ' ';
--
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