From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: [RFC] apparently broken RLIMIT_CORE
Date: Sun, 6 Oct 2013 01:43:31 +0100 [thread overview]
Message-ID: <20131006004331.GY13318@ZenIV.linux.org.uk> (raw)
elf_core_dump() writes struct elfhdr, then a bunch of
elf_phdr. It sums the sizes of data being written in 'size',
checking it against cprm->limit as it goes.
So far, so good, but then it proceeds to write_note_info(),
which neither checks overflows nor contributes to size. _Then_
it seeks to page boundary and proceeds to loop over the pages,
writing them to dump. At that point it again starts to count sizes,
bump size and check it against cprm->limit (only for present pages,
though - absent ones are silently skipped, with lseek() done on
output and size not increased).
In other words, the size of notes section is ignored for
RLIMIT_CORE purposes. Is that intentional? Looks like a bug to
me... FWIW, POSIX says that limit is on the file size and demands
that write would stop at that length, with 0 meaning "suppress
coredump creation completely". I'm not sure how the holes should
be treated (note, BTW, that when output goes into a pipe we do
feed zeroes into it for absent pages for obvious reasons, but we
do not count them towards the limit), but ignoring the notes doesn't
look intentional...
Comments?
next reply other threads:[~2013-10-06 0:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-06 0:43 Al Viro [this message]
2013-10-06 20:42 ` [RFC] apparently broken RLIMIT_CORE Linus Torvalds
2013-10-06 21:07 ` Ulrich Drepper
2013-10-06 21:33 ` Al Viro
2013-10-06 22:04 ` Linus Torvalds
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=20131006004331.GY13318@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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