public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] thread coredump oops fix
Date: Fri, 15 Aug 2003 19:45:06 +0900	[thread overview]
Message-ID: <87ekznfbd9.fsf@devron.myhome.or.jp> (raw)

Hi,

If ->group_leader of current thread already was exiting,
group_leader's ->mm is NULL in fill_psinfo(). Then I got Oops.

This uses current->mm instead of ->group_leader->mm to dump args.


 fs/binfmt_elf.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff -puN fs/binfmt_elf.c~thread_coredump-fix fs/binfmt_elf.c
--- linux-2.6.0-test3/fs/binfmt_elf.c~thread_coredump-fix	2003-08-15 05:41:44.000000000 +0900
+++ linux-2.6.0-test3-hirofumi/fs/binfmt_elf.c	2003-08-15 07:09:45.000000000 +0900
@@ -1084,18 +1084,19 @@ static void fill_prstatus(struct elf_prs
 	jiffies_to_timeval(p->cstime, &prstatus->pr_cstime);
 }
 
-static void fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p)
+static void fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
+			struct mm_struct *mm)
 {
 	int i, len;
 	
 	/* first copy the parameters from user space */
 	memset(psinfo, 0, sizeof(struct elf_prpsinfo));
 
-	len = p->mm->arg_end - p->mm->arg_start;
+	len = mm->arg_end - mm->arg_start;
 	if (len >= ELF_PRARGSZ)
 		len = ELF_PRARGSZ-1;
 	copy_from_user(&psinfo->pr_psargs,
-		      (const char *)p->mm->arg_start, len);
+		       (const char *)mm->arg_start, len);
 	for(i = 0; i < len; i++)
 		if (psinfo->pr_psargs[i] == 0)
 			psinfo->pr_psargs[i] = ' ';
@@ -1280,7 +1281,7 @@ static int elf_core_dump(long signr, str
 
 	fill_note(notes +0, "CORE", NT_PRSTATUS, sizeof(*prstatus), prstatus);
 	
-	fill_psinfo(psinfo, current->group_leader);
+	fill_psinfo(psinfo, current->group_leader, current->mm);
 	fill_note(notes +1, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo);
 	
 	fill_note(notes +2, "CORE", NT_TASKSTRUCT, sizeof(*current), current);

_

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

                 reply	other threads:[~2003-08-15 10:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ekznfbd9.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox