This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH -tip 1/3] Pass mm->flags to binfmt core_dump for bitflag consistency
- From: Ingo Molnar <mingo at elte dot hu>
- To: Roland McGrath <roland at redhat dot com>
- Cc: Masami Hiramatsu <mhiramat at redhat dot com>, lkml <linux-kernel at vger dot kernel dot org>, systemtap <systemtap at sources dot redhat dot com>, DLE <dle-develop at lists dot sourceforge dot net>, Hidehiro Kawai <hidehiro dot kawai dot ez at hitachi dot com>, Andrew Morton <akpm at linux-foundation dot org>, Oleg Nesterov <oleg at redhat dot com>
- Date: Sat, 14 Nov 2009 00:23:07 +0100
- Subject: Re: [PATCH -tip 1/3] Pass mm->flags to binfmt core_dump for bitflag consistency
- References: <20091113225226.15079.90813.stgit@harusame> <20091113231602.2DD2C100E@magilla.sf.frob.com>
* Roland McGrath <roland@redhat.com> wrote:
> To clarify, proc_coredump_filter_write() is the one place that can
> change mm->flags during a core dump. I don't think any other is
> possible while all the other tasks sharing that mm are prevented from
> running. Is there any other way that mm->flags might change during
> do_coredump()?
>
> I don't see anything wrong with this change. But (assuming that is
> the only case), there is another approach we could take instead. That
> is, have proc_coredump_filter_write() do:
>
> down_read(&mm->mmap_sem);
> ret = mm->core_state ? -EBUSY : 0;
> up_read(&mm->mmap_sem);
this would fix the (probably harmless) race too, but isnt the whole
approach taken by the patch more robust, i.e. to take a snapshot of
mm->flags value and pass it along coredump processing?
That makes it evidently immutable in the future too. It also makes the
code a bit easier to read IMO - instead of get_dumpable() we use the
mm_flags.
The only other observation i have is that for this parameter set:
long signr, struct pt_regs *regs, struct file *file,
unsigned long limit, unsigned long mm_flags)
we should probably introduce a coredump parameter struct, and pass that
along:
struct coredump_params {
long signr;
struct pt_regs *regs;
struct file *file;
unsigned long limit;
unsigned long mm_flags;
}
Had this been done in the past this present patch would be a lot simpler
as well: we could have added mm_flags to coredump_params, instead of
having to propagate it through ~6 function interface surfaces.
Thanks,
Ingo