public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Kawai, Hidehiro" <hidehiro.kawai.ez@hitachi.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, gregkh@suse.de,
	james.bottomley@steeleye.com, Satoshi OSHIMA <soshima@redhat.com>,
	"Hideo AOKI@redhat" <haoki@redhat.com>,
	sugita <yumiko.sugita.yf@hitachi.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH] binfmt_elf: core dump masking support
Date: Mon, 22 Jan 2007 11:29:40 +0900	[thread overview]
Message-ID: <45B42194.3050601@hitachi.com> (raw)
In-Reply-To: <20070119004548.GE10351@elf.ucw.cz>

Hi Pavel,

>>>>The /proc/<pid>/ approach doesn't have these demerits, and it
>>>>has an advantage that users can change the bitmask of any process
>>>>at anytime.
>>>
>>>Well... not sure if it is advantage. 
>>
>>For example, consider the following case:
>>  a process forks many children and system administrator wants to
>>  allow only one of these processes to dump shared memory.
>>
>>This is accomplished as follows:
>>
>> $ echo 1 > /proc/self/coremask
>> $ ./some_program
>> (fork children)
>> $ echo 0 > /proc/<a child's pid>/coremask
>>
>>With the /proc/<pid>/ interface, we don't need to modify the
>>user program.  In contrast, with the ulimit or setrlimit interface,
>>the administrator can't do it without modifying the user program
>>to call setrlimit.  This will not be preferred.
> 
> Yep, otoh process coremask setting can change while it is running,
> that is not expected. Hmm, it can also change while it is dumping
> core, are you sure it is not racy?

Good point, thanks.  I never thought of that.
We can change the coremask setting while dumping the process's
memory, and it is problematic.

maydump() function which decides a given VMA may be dumped or not
is invoked twice per VMAs.  One is at the time of writing a program
header for a VMA, another is at the time of writing its contents.
If the coremask setting differs between the two, the program
header will point wrong place in the core file as its contents.

 
> (run echo 1 > coremask, echo 0 > coremask in a loop while dumping
> core. Do you have enough locking to make it work as expected?)

Currently, any lock isn't acquired.  But I think the kernel only
have to preserve the coremask setting in a local variable at the
begining of core dumping.  I'm going to do this in the next version.

Best regards,
-- 
Hidehiro Kawai
Hitachi, Ltd., Systems Development Laboratory



  reply	other threads:[~2007-01-22  2:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-13  7:14 [PATCH] binfmt_elf: core dump masking support Kawai, Hidehiro
2006-12-13 21:23 ` Andrew Morton
2006-12-18  8:08   ` Kawai, Hidehiro
2006-12-20 15:40   ` Pavel Machek
2007-01-09  1:07     ` Kawai, Hidehiro
2007-01-09 14:39       ` Pavel Machek
2007-01-12  8:49         ` Kawai, Hidehiro
2007-01-14 20:01           ` Pavel Machek
2007-01-19  0:40             ` Kawai, Hidehiro
2007-01-19  0:45               ` Pavel Machek
2007-01-22  2:29                 ` Kawai, Hidehiro [this message]
2007-01-22 10:06                   ` Pavel Machek
2007-01-23  4:42                     ` Kawai, Hidehiro
2007-01-23  9:08                       ` Pavel Machek
2007-01-23 12:17                         ` Kawai, Hidehiro

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=45B42194.3050601@hitachi.com \
    --to=hidehiro.kawai.ez@hitachi.com \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=gregkh@suse.de \
    --cc=haoki@redhat.com \
    --cc=james.bottomley@steeleye.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=pavel@ucw.cz \
    --cc=soshima@redhat.com \
    --cc=yumiko.sugita.yf@hitachi.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