linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Potentially unbounded allocations in seq_read?
@ 2013-12-11 17:04 Tvrtko Ursulin
  2013-12-11 17:48 ` Tvrtko Ursulin
  2013-12-11 17:49 ` Al Viro
  0 siblings, 2 replies; 11+ messages in thread
From: Tvrtko Ursulin @ 2013-12-11 17:04 UTC (permalink / raw)
  To: Alexander Viro, Andrew Morton; +Cc: linux-fsdevel, linux-kernel

Hi all,

It seems that the buffer allocation in seq_read can double in size
indefinitely, at least I've seen that in practice with /proc/<pid>/smaps
(attempting to double m->size to 4M on a read of 1000 bytes). This
produces an ugly WARN_ON_ONCE, which should perhaps be avoided? (given
that it can be triggered by userspace at will)

>From the top comment in seq_file.c one would think that it is a
fundamental limitation of the current code that everything which will be
read (even if in chunks) needs to be in the kernel side buffer at the
same time?

If that is true then only way to fix it would be to completely re-design
the seq_file interface, just silencing the allocation failure with
__GFP_NOWARN perhaps as a temporary measure.

As an alternative, since it does sound a bit pathological, perhaps users
for seq_file who know can be printing out such huge amounts of text
should just use a different (new?) facility?

Thanks,

Tvrtko

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

end of thread, other threads:[~2013-12-12 14:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-11 17:04 Potentially unbounded allocations in seq_read? Tvrtko Ursulin
2013-12-11 17:48 ` Tvrtko Ursulin
2013-12-11 18:00   ` Al Viro
2013-12-11 17:49 ` Al Viro
2013-12-11 17:59   ` Tvrtko Ursulin
2013-12-11 18:07     ` Al Viro
2013-12-12 13:40       ` Tvrtko Ursulin
2013-12-12 13:49         ` Al Viro
2013-12-12 13:59           ` Tvrtko Ursulin
2013-12-12 14:21             ` Al Viro
2013-12-12 14:52               ` Tvrtko Ursulin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).