public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@redhat.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	lkml <linux-kernel@vger.kernel.org>,
	systemtap <systemtap@sources.redhat.com>,
	DLE <dle-develop@lists.sourceforge.net>,
	Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>,
	Oleg Nesterov <oleg@redhat.com>,
	Roland McGrath <roland@redhat.com>
Subject: Re: [PATCH -tip 1/3] Pass mm->flags to binfmt core_dump for bitflag consistency
Date: Fri, 13 Nov 2009 18:44:53 -0500	[thread overview]
Message-ID: <4AFDEF75.1080101@redhat.com> (raw)
In-Reply-To: <20091113232457.GC21666@elte.hu>

Ingo Molnar wrote:
>
> * Andrew Morton<akpm@linux-foundation.org>  wrote:
>
>> On Fri, 13 Nov 2009 17:52:27 -0500
>> Masami Hiramatsu<mhiramat@redhat.com>  wrote:
>>
>>> Pass mm->flags to binfmt core_dump for bitflag consistency.
>>> Since mm->flags bit flags is not protected by locks, it will be
>>> changed while dumping core. This patch copies mm->flags to a
>>> mm_flags local variable at the beginning of do_coredump() and
>>> use it while dumping. mm_flags also includes dump_filter which
>>> filters elf sections from core file in elf_core_dump().
>>> So, this patch also passes mm_flags to each binfmt->core_dump().
>>
>> I can kind-of guess the answer, but it would be much more reliable if
>> we were to hear this from yourself:
>>
>>    Why did you write this patch?  What problem is being observed?
>
> i'm not Masami so i'm only guessing that while writing the tracepoint a
> race got noticed but that otherwise there's no big practical effect,
> 'just' a cleanliness problem fixed.

Right, I'd like to add a tracepoint of coredump event with
its information. And also, this patch may fix a small
dumpable inconsistency issue below code

---
1787         if (mm->core_state || !get_dumpable(mm)) {  <- (1)
1788                 up_write(&mm->mmap_sem);
1789                 put_cred(cred);
1790                 goto fail;
1791         }
1792
[...]
1798         if (get_dumpable(mm) == 2) {    /* Setuid core dump mode */ <-(2)
1799                 flag = O_EXCL;          /* Stop rewrite attacks */
1800                 cred->fsuid = 0;        /* Dump root private */
1801         }

Since dumpable bits are not protected by lock, there is a
chance to change these bits between (1) and (2).

This patch copies mm->flags to a local variable and check the variable
for consistency.

Thank you,

-- 
Masami Hiramatsu

Software Engineer
Hitachi Computer Products (America), Inc.
Software Solutions Division

e-mail: mhiramat@redhat.com


  reply	other threads:[~2009-11-13 23:45 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-13 22:52 [PATCH -tip 1/3] Pass mm->flags to binfmt core_dump for bitflag consistency Masami Hiramatsu
2009-11-13 22:52 ` [PATCH -tip 2/3] Add coredump tracepoint Masami Hiramatsu
2009-11-13 23:39   ` Roland McGrath
2009-11-14  0:00     ` Masami Hiramatsu
2009-11-14  0:02     ` Ingo Molnar
2009-11-14  0:06       ` Roland McGrath
2009-11-14  0:14         ` Ingo Molnar
2009-11-14  1:49           ` Roland McGrath
2009-11-14  0:25         ` Masami Hiramatsu
2009-11-13 22:52 ` [PATCH -tip 3/3] Add get_signal tracepoint Masami Hiramatsu
2009-11-13 23:53   ` Roland McGrath
2009-11-14  0:10     ` Ingo Molnar
2009-11-16 21:51       ` Masami Hiramatsu
2009-11-16 22:09         ` Roland McGrath
2009-11-16 22:39           ` Masami Hiramatsu
2009-11-16 23:00             ` Roland McGrath
2009-11-16 23:45               ` Masami Hiramatsu
2009-11-17  6:01         ` Ingo Molnar
2009-11-17 15:26           ` Masami Hiramatsu
2009-11-14  0:29     ` Masami Hiramatsu
2009-11-13 23:09 ` [PATCH -tip 1/3] Pass mm->flags to binfmt core_dump for bitflag consistency Andrew Morton
2009-11-13 23:24   ` Ingo Molnar
2009-11-13 23:44     ` Masami Hiramatsu [this message]
2009-11-13 23:16 ` Roland McGrath
2009-11-13 23:23   ` Ingo Molnar
2009-11-13 23:29     ` Roland McGrath

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=4AFDEF75.1080101@redhat.com \
    --to=mhiramat@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dle-develop@lists.sourceforge.net \
    --cc=hidehiro.kawai.ez@hitachi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=roland@redhat.com \
    --cc=systemtap@sources.redhat.com \
    /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