From: "Kawai, Hidehiro" <hidehiro.kawai.ez@hitachi.com>
To: Andrew Morton <akpm@osdl.org>
Cc: 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, 18 Dec 2006 17:08:52 +0900 [thread overview]
Message-ID: <45864C94.5070406@hitachi.com> (raw)
In-Reply-To: <20061213132358.ddcaaaf4.akpm@osdl.org>
Hello Andrew,
Thank you for your reply and advice.
I'll send the revised patchset after I fix what you pointed out.
Andrew Morton wrote:
> Regarding the implementation: if we add
>
> unsigned char coredump_omit_anon_memory:1;
>
> into the mm_struct right next to `dumpable' then we avoid increasing the
> size of the mm_struct, and the code gets neater.
>
> Modification of this field is racy, and we don't have a suitable lock in
> mm_struct to fix that. I don't think we care about that a lot, but it'd be
> best to find some way of fixing it.
OK, I'll put a bit field right next to `dumpable' member and add a global
lock to protect them from the race.
I have the perception that only writing to these bit-fields needs to
acquire a lock. Simultaneous writes to both bit-fields can cause either one
to be overwritten with its old value. But simultaneous read and write
from/to separate bit-fields is safe because write to one bit-field
doesn't affect read from the other.
The dumpable can be modified at following timing:
- before starting core dumping in do_coredump()
- when initialize mm_struct in flush_old_exec()
- when *uid or *gid is changed by the coresponding system call
- when the dumpable is modified directly by prctl(2)
I expect that these don't occur so much frequently, so I consider that
the performance impact by using a global lock is small.
> Really we should convert binfmt_aout.c and any other coredumpers too.
Currently, binfmt_aout.c and binfmt_elf_fdpic.c have their own core dump
routines as well as binfmt_elf.c. However, as far as I know,
binfmt_aout.c never dumps shared memory.
So I will convert only binfmt_elf_fdpic.c to support this feature.
> Does this feature have any security implications? For example, there might
> be system administration programs which force a coredump on a "bad"
> process, and leave the core somewhere for the administrator to look at.
> With this change, we permit hiding of that corefile's anon memory from the
> administrator. OK, lame example, but perhaps there are better ones.
I think we can avoid it by providing a sysctl parameter which
disables/enables this feature.
Another idea is that we provide a sysctl parameter to prohibit non-root
user from writing to /proc/<pid>/coremask. If the administrator want to
force a full coredump on a bad process, he/she only has to clear the
coremask after setting the sysctl parameter.
For now, I will implement the first idea, because its design and
implementation are simple and it is easy to use.
Best regards,
--
Hidehiro Kawai
Hitachi, Ltd., Systems Development Laboratory
next prev parent reply other threads:[~2006-12-18 8:10 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 [this message]
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
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=45864C94.5070406@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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.