Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1646479

Re: [PATCH] slub/memcg: Cure the brainless abuse of sysfs attributes

From David Rientjes <rientjes@google.com>
Newsgroups linux.kernel
Subject Re: [PATCH] slub/memcg: Cure the brainless abuse of sysfs attributes
Date 2017-05-22 03:30 +0200
Message-ID <tJKkx-74C-1@gated-at.bofh.it> (permalink)
References <tJah3-jb-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, 20 May 2017, Thomas Gleixner wrote:

> memcg_propagate_slab_attrs() abuses the sysfs attribute file functions to
> propagate settings from the root kmem_cache to a newly created
> kmem_cache. It does that with:
> 
>      attr->show(root, buf);
>      attr->store(new, buf, strlen(bug);
> 
> Aside of being a lazy and absurd hackery this is broken because it does not
> check the return value of the show() function.
> 
> Some of the show() functions return 0 w/o touching the buffer. That means in
> such a case the store function is called with the stale content of the
> previous show(). That causes nonsense like invoking kmem_cache_shrink() on
> a newly created kmem_cache. In the worst case it would cause handing in an
> uninitialized buffer.
> 
> This should be rewritten proper by adding a propagate() callback to those
> slub_attributes which must be propagated and avoid that insane conversion
> to and from ASCII, but that's too large for a hot fix.
> 
> Check at least the return value of the show() function, so calling store()
> with stale content is prevented.
> 
> Reported-by: Steven Rostedt <rostedt@goodmis.org>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Cc: stable@vger.kernel.org

Acked-by: David Rientjes <rientjes@google.com>

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH] slub/memcg: Cure the brainless abuse of sysfs attributes Thomas Gleixner <tglx@linutronix.de> - 2017-05-20 13:00 +0200
  Re: [PATCH] slub/memcg: Cure the brainless abuse of sysfs attributes Christoph Hellwig <hch@infradead.org> - 2017-05-20 15:20 +0200
    Re: [PATCH] slub/memcg: Cure the brainless abuse of sysfs  attributes Steven Rostedt <rostedt@goodmis.org> - 2017-05-20 16:30 +0200
    Re: [PATCH] slub/memcg: Cure the brainless abuse of sysfs  attributes Thomas Gleixner <tglx@linutronix.de> - 2017-05-21 22:10 +0200
  Re: [PATCH] slub/memcg: Cure the brainless abuse of sysfs  attributes David Rientjes <rientjes@google.com> - 2017-05-22 03:30 +0200

csiph-web