linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Memory allocation issues after "sysctl: Convert to iter interfaces"
@ 2021-02-25  1:02 Ivan Babrou
  2021-02-25  1:10 ` Matthew Wilcox
  0 siblings, 1 reply; 2+ messages in thread
From: Ivan Babrou @ 2021-02-25  1:02 UTC (permalink / raw)
  To: kernel-team
  Cc: Matthew Wilcox (Oracle), Christoph Hellwig, Al Viro,
	Luis Chamberlain, Kees Cook, Iurii Zaikin, Alexey Dobriyan,
	linux-kernel, linux-fsdevel

Hello,

We started seeing allocation failures on procfs reads after
commit 4bd6a7353ee1 "sysctl: Convert to iter interfaces".

I haven't done a full bisect, but the decoded stacks point
squarely at the following piece of code which was introduced:

kbuf = kzalloc(count + 1, GFP_KERNEL);

Previously reading /proc/sys/net/core/somaxconn required order 1
and order 3 allocations from the kernel, which can be seen from:

$ sudo perf record -g -e kmem:mm_page_alloc_zone_locked -- \
    cat /proc/sys/net/core/somaxconn

Now we see order 6 + order 6 allocations from cat, and even:

read(3, 0x7f8d9d3f3000, 131072) = -1 ENOMEM (Cannot allocate memory)

See the following gist for full allocation stacks on 5.4 and 5.10:

* https://gist.github.com/bobrik/dd03cce0aaeef5acd5faecc32bd44530

This seems like a regression, and unprivileged users being
able to force order 6 allocations onto the kernel doesn't feel good.

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

* Re: Memory allocation issues after "sysctl: Convert to iter interfaces"
  2021-02-25  1:02 Memory allocation issues after "sysctl: Convert to iter interfaces" Ivan Babrou
@ 2021-02-25  1:10 ` Matthew Wilcox
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2021-02-25  1:10 UTC (permalink / raw)
  To: Ivan Babrou
  Cc: kernel-team, Christoph Hellwig, Al Viro, Luis Chamberlain,
	Kees Cook, Iurii Zaikin, Alexey Dobriyan, linux-kernel,
	linux-fsdevel

On Wed, Feb 24, 2021 at 05:02:09PM -0800, Ivan Babrou wrote:
> Hello,
> 
> We started seeing allocation failures on procfs reads after
> commit 4bd6a7353ee1 "sysctl: Convert to iter interfaces".

https://lore.kernel.org/linux-fsdevel/6345270a2c1160b89dd5e6715461f388176899d1.1612972413.git.josef@toxicpanda.com/

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

end of thread, other threads:[~2021-02-25  1:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-25  1:02 Memory allocation issues after "sysctl: Convert to iter interfaces" Ivan Babrou
2021-02-25  1:10 ` Matthew Wilcox

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).