public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] apparently broken RLIMIT_CORE
@ 2013-10-06  0:43 Al Viro
  2013-10-06 20:42 ` Linus Torvalds
  0 siblings, 1 reply; 5+ messages in thread
From: Al Viro @ 2013-10-06  0:43 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

	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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-10-06 22:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-06  0:43 [RFC] apparently broken RLIMIT_CORE Al Viro
2013-10-06 20:42 ` Linus Torvalds
2013-10-06 21:07   ` Ulrich Drepper
2013-10-06 21:33   ` Al Viro
2013-10-06 22:04     ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox