From: Steven Rostedt <rostedt@goodmis.org> To: Pekka Enberg <penberg@kernel.org> Cc: Christoph Lameter <cl@linux.com>, Thomas Gleixner <tglx@linutronix.de>, RT <linux-rt-users@vger.kernel.org>, Clark Williams <clark@redhat.com>, John Kacur <jkacur@gmail.com>, "Luis Claudio R. Goncalves" <lgoncalv@redhat.com>, Joonsoo Kim <js1304@gmail.com>, Glauber Costa <glommer@parallels.com>, linux-mm@kvack.org, David Rientjes <rientjes@google.com>, elezegarcia@gmail.com Subject: Re: FIX [1/2] slub: Do not dereference NULL pointer in node_match Date: Fri, 01 Feb 2013 06:51:27 -0500 [thread overview] Message-ID: <1359719487.5642.18.camel@gandalf.local.home> (raw) In-Reply-To: <CAOJsxLH6BO_m+6Ys0AG8gHQzmoDovdA8kaAecUhcP5foXoEXUA@mail.gmail.com> On Fri, 2013-02-01 at 12:23 +0200, Pekka Enberg wrote: > On Wed, Jan 23, 2013 at 11:45 PM, Christoph Lameter <cl@linux.com> wrote: > > The variables accessed in slab_alloc are volatile and therefore > > the page pointer passed to node_match can be NULL. The processing > > of data in slab_alloc is tentative until either the cmpxhchg > > succeeds or the __slab_alloc slowpath is invoked. Both are > > able to perform the same allocation from the freelist. > > > > Check for the NULL pointer in node_match. > > > > A false positive will lead to a retry of the loop in __slab_alloc. > > > > Signed-off-by: Christoph Lameter <cl@linux.com> > > Steven, how did you trigger the problem - i.e. is this -rt only > problem? Does the patch work for you? I haven't tested Christoph's version yet. I've only tested my own. But I'll take his and run them through tests as well. This bug is not easy to hit. It is not a -rt only bug, and yes it probably should go to stable. The race is extremely small, but -rt creates scenarios that may only be hit by 1000 CPU core machines. Because of the preemptive nature of -rt, -rt is much more susceptible to race conditions than mainline. But these are real bugs for mainline too. It may only trigger once a year, where in -rt it will trigger once a week. -- Steve > > > Index: linux/mm/slub.c > > =================================================================== > > --- linux.orig/mm/slub.c 2013-01-18 08:47:29.198954250 -0600 > > +++ linux/mm/slub.c 2013-01-18 08:47:40.579126371 -0600 > > @@ -2041,7 +2041,7 @@ static void flush_all(struct kmem_cache > > static inline int node_match(struct page *page, int node) > > { > > #ifdef CONFIG_NUMA > > - if (node != NUMA_NO_NODE && page_to_nid(page) != node) > > + if (!page || (node != NUMA_NO_NODE && page_to_nid(page) != node)) > > return 0; > > #endif > > return 1; > > > > -- > > To unsubscribe, send a message with 'unsubscribe linux-mm' in > > the body to majordomo@kvack.org. For more info on Linux MM, > > see: http://www.linux-mm.org/ . > > Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Steven Rostedt <rostedt@goodmis.org> To: Pekka Enberg <penberg@kernel.org> Cc: Christoph Lameter <cl@linux.com>, Thomas Gleixner <tglx@linutronix.de>, RT <linux-rt-users@vger.kernel.org>, Clark Williams <clark@redhat.com>, John Kacur <jkacur@gmail.com>, "Luis Claudio R. Goncalves" <lgoncalv@redhat.com>, Joonsoo Kim <js1304@gmail.com>, Glauber Costa <glommer@parallels.com>, linux-mm@kvack.org, David Rientjes <rientjes@google.com>, elezegarcia@gmail.com Subject: Re: FIX [1/2] slub: Do not dereference NULL pointer in node_match Date: Fri, 01 Feb 2013 06:51:27 -0500 [thread overview] Message-ID: <1359719487.5642.18.camel@gandalf.local.home> (raw) In-Reply-To: <CAOJsxLH6BO_m+6Ys0AG8gHQzmoDovdA8kaAecUhcP5foXoEXUA@mail.gmail.com> On Fri, 2013-02-01 at 12:23 +0200, Pekka Enberg wrote: > On Wed, Jan 23, 2013 at 11:45 PM, Christoph Lameter <cl@linux.com> wrote: > > The variables accessed in slab_alloc are volatile and therefore > > the page pointer passed to node_match can be NULL. The processing > > of data in slab_alloc is tentative until either the cmpxhchg > > succeeds or the __slab_alloc slowpath is invoked. Both are > > able to perform the same allocation from the freelist. > > > > Check for the NULL pointer in node_match. > > > > A false positive will lead to a retry of the loop in __slab_alloc. > > > > Signed-off-by: Christoph Lameter <cl@linux.com> > > Steven, how did you trigger the problem - i.e. is this -rt only > problem? Does the patch work for you? I haven't tested Christoph's version yet. I've only tested my own. But I'll take his and run them through tests as well. This bug is not easy to hit. It is not a -rt only bug, and yes it probably should go to stable. The race is extremely small, but -rt creates scenarios that may only be hit by 1000 CPU core machines. Because of the preemptive nature of -rt, -rt is much more susceptible to race conditions than mainline. But these are real bugs for mainline too. It may only trigger once a year, where in -rt it will trigger once a week. -- Steve > > > Index: linux/mm/slub.c > > =================================================================== > > --- linux.orig/mm/slub.c 2013-01-18 08:47:29.198954250 -0600 > > +++ linux/mm/slub.c 2013-01-18 08:47:40.579126371 -0600 > > @@ -2041,7 +2041,7 @@ static void flush_all(struct kmem_cache > > static inline int node_match(struct page *page, int node) > > { > > #ifdef CONFIG_NUMA > > - if (node != NUMA_NO_NODE && page_to_nid(page) != node) > > + if (!page || (node != NUMA_NO_NODE && page_to_nid(page) != node)) > > return 0; > > #endif > > return 1; > > > > -- > > To unsubscribe, send a message with 'unsubscribe linux-mm' in > > the body to majordomo@kvack.org. For more info on Linux MM, > > see: http://www.linux-mm.org/ . > > Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a> -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2013-02-01 11:51 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <20130123214514.370647954@linux.com> 2013-01-23 21:45 ` FIX [1/2] slub: Do not dereference NULL pointer in node_match Christoph Lameter 2013-01-23 21:45 ` Christoph Lameter 2013-01-24 0:53 ` Simon Jeons 2013-01-24 0:53 ` Simon Jeons 2013-01-24 15:14 ` Christoph Lameter 2013-01-25 8:11 ` Simon Jeons 2013-01-25 8:11 ` Simon Jeons 2013-01-25 14:53 ` Christoph Lameter 2013-02-01 10:23 ` Pekka Enberg 2013-02-01 10:23 ` Pekka Enberg 2013-02-01 11:51 ` Steven Rostedt [this message] 2013-02-01 11:51 ` Steven Rostedt 2013-01-23 21:45 ` FIX [2/2] slub: tid must be retrieved from the percpu area of the current processor Christoph Lameter 2013-01-23 21:45 ` Christoph Lameter 2013-02-01 10:24 ` Pekka Enberg 2013-02-01 10:24 ` Pekka Enberg
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=1359719487.5642.18.camel@gandalf.local.home \ --to=rostedt@goodmis.org \ --cc=cl@linux.com \ --cc=clark@redhat.com \ --cc=elezegarcia@gmail.com \ --cc=glommer@parallels.com \ --cc=jkacur@gmail.com \ --cc=js1304@gmail.com \ --cc=lgoncalv@redhat.com \ --cc=linux-mm@kvack.org \ --cc=linux-rt-users@vger.kernel.org \ --cc=penberg@kernel.org \ --cc=rientjes@google.com \ --cc=tglx@linutronix.de \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.