linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [Patch v2] mm: slab: Verify the nodeid passed to ____cache_alloc_node
       [not found] <1081382531.982691.1366726661820.JavaMail.root@redhat.com>
@ 2013-04-23 14:31 ` Aaron Tomlin
  2013-04-23 15:51   ` Christoph Lameter
                     ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Aaron Tomlin @ 2013-04-23 14:31 UTC (permalink / raw)
  To: linux-mm; +Cc: linux-kernel, cl, penberg, Rik, Rafael Aquini

Hi,

This patch is in response to BZ#42967 [1]. 
Using VM_BUG_ON so it's used only when CONFIG_DEBUG_VM is set,
given that ____cache_alloc_node() is a hot code path.

Cheers,
Aaron

[1]: https://bugzilla.kernel.org/show_bug.cgi?id=42967

---8<---
mm: slab: Verify the nodeid passed to ____cache_alloc_node
    
If the nodeid is > num_online_nodes() this can cause an
Oops and a panic(). The purpose of this patch is to assert
if this condition is true to aid debugging efforts rather
than some random NULL pointer dereference or page fault.
    
Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
Reviewed-by: Rik van Riel <riel@redhat.com>


 slab.c |    1 +
 1 file changed, 1 insertion(+)
 
diff --git a/mm/slab.c b/mm/slab.c
index e7667a3..735e8bd 100644
--- a/mm/slab.c
+++ b/mm/slab.c
 -3412,6 +3412,7 @@ static void *____cache_alloc_node(struct kmem_cache *cachep, gfp_t flags,
 	void *obj;
 	int x;
 
+	VM_BUG_ON(nodeid > num_online_nodes());
 	l3 = cachep->nodelists[nodeid];
 	BUG_ON(!l3);

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

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

* Re: [Patch v2] mm: slab: Verify the nodeid passed to ____cache_alloc_node
  2013-04-23 14:31 ` [Patch v2] mm: slab: Verify the nodeid passed to ____cache_alloc_node Aaron Tomlin
@ 2013-04-23 15:51   ` Christoph Lameter
  2013-04-23 16:45   ` Rafael Aquini
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Christoph Lameter @ 2013-04-23 15:51 UTC (permalink / raw)
  To: Aaron Tomlin; +Cc: linux-mm, linux-kernel, penberg, Rik, Rafael Aquini

On Tue, 23 Apr 2013, Aaron Tomlin wrote:

> This patch is in response to BZ#42967 [1].
> Using VM_BUG_ON so it's used only when CONFIG_DEBUG_VM is set,
> given that ____cache_alloc_node() is a hot code path.

Acked-by: Christoph Lameter <cl@linux.com>

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

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

* Re: [Patch v2] mm: slab: Verify the nodeid passed to ____cache_alloc_node
  2013-04-23 14:31 ` [Patch v2] mm: slab: Verify the nodeid passed to ____cache_alloc_node Aaron Tomlin
  2013-04-23 15:51   ` Christoph Lameter
@ 2013-04-23 16:45   ` Rafael Aquini
  2013-04-23 23:16   ` David Rientjes
  2013-04-24  7:26   ` Pekka Enberg
  3 siblings, 0 replies; 8+ messages in thread
From: Rafael Aquini @ 2013-04-23 16:45 UTC (permalink / raw)
  To: Aaron Tomlin; +Cc: linux-mm, linux-kernel, cl, penberg, Rik

On Tue, Apr 23, 2013 at 10:31:36AM -0400, Aaron Tomlin wrote:
> Hi,
> 
> This patch is in response to BZ#42967 [1]. 
> Using VM_BUG_ON so it's used only when CONFIG_DEBUG_VM is set,
> given that ____cache_alloc_node() is a hot code path.
> 
This seems to be a valid condition to BUG_ON, though.

> Cheers,
> Aaron
> 
> [1]: https://bugzilla.kernel.org/show_bug.cgi?id=42967
> 
> ---8<---
> mm: slab: Verify the nodeid passed to ____cache_alloc_node
>     
> If the nodeid is > num_online_nodes() this can cause an
> Oops and a panic(). The purpose of this patch is to assert
> if this condition is true to aid debugging efforts rather
> than some random NULL pointer dereference or page fault.
>     
> Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
> Reviewed-by: Rik van Riel <riel@redhat.com>
>

Acked-by: Rafael Aquini <aquini@redhat.com>


 
> 
>  slab.c |    1 +
>  1 file changed, 1 insertion(+)
>  
> diff --git a/mm/slab.c b/mm/slab.c
> index e7667a3..735e8bd 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
>  -3412,6 +3412,7 @@ static void *____cache_alloc_node(struct kmem_cache *cachep, gfp_t flags,
>  	void *obj;
>  	int x;
>  
> +	VM_BUG_ON(nodeid > num_online_nodes());
>  	l3 = cachep->nodelists[nodeid];
>  	BUG_ON(!l3);

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

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

* Re: [Patch v2] mm: slab: Verify the nodeid passed to ____cache_alloc_node
  2013-04-23 14:31 ` [Patch v2] mm: slab: Verify the nodeid passed to ____cache_alloc_node Aaron Tomlin
  2013-04-23 15:51   ` Christoph Lameter
  2013-04-23 16:45   ` Rafael Aquini
@ 2013-04-23 23:16   ` David Rientjes
  2013-04-24  7:26   ` Pekka Enberg
  3 siblings, 0 replies; 8+ messages in thread
From: David Rientjes @ 2013-04-23 23:16 UTC (permalink / raw)
  To: Aaron Tomlin; +Cc: linux-mm, linux-kernel, cl, penberg, Rik, Rafael Aquini

On Tue, 23 Apr 2013, Aaron Tomlin wrote:

> mm: slab: Verify the nodeid passed to ____cache_alloc_node
>     
> If the nodeid is > num_online_nodes() this can cause an
> Oops and a panic(). The purpose of this patch is to assert
> if this condition is true to aid debugging efforts rather
> than some random NULL pointer dereference or page fault.
>     
> Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
> Reviewed-by: Rik van Riel <riel@redhat.com>
> 

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

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

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

* Re: [Patch v2] mm: slab: Verify the nodeid passed to ____cache_alloc_node
  2013-04-23 14:31 ` [Patch v2] mm: slab: Verify the nodeid passed to ____cache_alloc_node Aaron Tomlin
                     ` (2 preceding siblings ...)
  2013-04-23 23:16   ` David Rientjes
@ 2013-04-24  7:26   ` Pekka Enberg
  3 siblings, 0 replies; 8+ messages in thread
From: Pekka Enberg @ 2013-04-24  7:26 UTC (permalink / raw)
  To: Aaron Tomlin; +Cc: linux-mm, LKML, Christoph Lameter, Rik, Rafael Aquini

On Tue, Apr 23, 2013 at 5:31 PM, Aaron Tomlin <atomlin@redhat.com> wrote:
> This patch is in response to BZ#42967 [1].
> Using VM_BUG_ON so it's used only when CONFIG_DEBUG_VM is set,
> given that ____cache_alloc_node() is a hot code path.

The patch is pretty badly mangled and does not apply with 'git am'.
Please resend with updated ACKs.

                        Pekka

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

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

* Re: [PATCH v2] mm: slab: Verify the nodeid passed to ____cache_alloc_node
  2013-02-25 17:45   ` Rik van Riel
@ 2013-02-25 19:27     ` Christoph Lameter
  0 siblings, 0 replies; 8+ messages in thread
From: Christoph Lameter @ 2013-02-25 19:27 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Rik van Riel, Aaron Tomlin, linux-mm, linux-kernel, glommer

On Mon, 25 Feb 2013, Rik van Riel wrote:

> On 02/25/2013 12:18 PM, Aaron Tomlin wrote:
>
> > mm: slab: Verify the nodeid passed to ____cache_alloc_node
> >
> > If the nodeid is > num_online_nodes() this can cause an
> > Oops and a panic(). The purpose of this patch is to assert
> > if this condition is true to aid debugging efforts rather
> > than some random NULL pointer dereference or page fault.
> >
> > Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
>
> Reviewed-by: Rik van Riel <riel@redhat.com>

It may be helpful to cc the slab maintainers...

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

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

* Re: [PATCH v2] mm: slab: Verify the nodeid passed to ____cache_alloc_node
  2013-02-25 17:18 ` [PATCH " Aaron Tomlin
@ 2013-02-25 17:45   ` Rik van Riel
  2013-02-25 19:27     ` Christoph Lameter
  0 siblings, 1 reply; 8+ messages in thread
From: Rik van Riel @ 2013-02-25 17:45 UTC (permalink / raw)
  To: Aaron Tomlin; +Cc: linux-mm, linux-kernel, glommer

On 02/25/2013 12:18 PM, Aaron Tomlin wrote:

> mm: slab: Verify the nodeid passed to ____cache_alloc_node
>
> If the nodeid is > num_online_nodes() this can cause an
> Oops and a panic(). The purpose of this patch is to assert
> if this condition is true to aid debugging efforts rather
> than some random NULL pointer dereference or page fault.
>
> Signed-off-by: Aaron Tomlin <atomlin@redhat.com>

Reviewed-by: Rik van Riel <riel@redhat.com>

-- 
All rights reversed

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

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

* Re: [PATCH v2] mm: slab: Verify the nodeid passed to ____cache_alloc_node
       [not found] <813482873.8209105.1361812140956.JavaMail.root@redhat.com>
@ 2013-02-25 17:18 ` Aaron Tomlin
  2013-02-25 17:45   ` Rik van Riel
  0 siblings, 1 reply; 8+ messages in thread
From: Aaron Tomlin @ 2013-02-25 17:18 UTC (permalink / raw)
  To: linux-mm; +Cc: linux-kernel, Rik, glommer

Hi,

This patch is in response to bz#42967 [1]. Using VM_BUG_ON
instead of a generic BUG_ON so it's used only when 
CONFIG_DEBUG_VM is set, given that ____cache_alloc_node()
is a hot code path.

Cheers,
Aaron

[1]: https://bugzilla.kernel.org/show_bug.cgi?id=42967

---8<---
mm: slab: Verify the nodeid passed to ____cache_alloc_node
    
If the nodeid is > num_online_nodes() this can cause an
Oops and a panic(). The purpose of this patch is to assert
if this condition is true to aid debugging efforts rather
than some random NULL pointer dereference or page fault.
    
Signed-off-by: Aaron Tomlin <atomlin@redhat.com>

 slab.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/slab.c b/mm/slab.c
index e7667a3..735e8bd 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3412,6 +3412,7 @@ static void *____cache_alloc_node(struct kmem_cache *cachep, gfp_t flags,
 	void *obj;
 	int x;
 
+	VM_BUG_ON(nodeid > num_online_nodes());
 	l3 = cachep->nodelists[nodeid];
 	BUG_ON(!l3);

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

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

end of thread, other threads:[~2013-04-24  7:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1081382531.982691.1366726661820.JavaMail.root@redhat.com>
2013-04-23 14:31 ` [Patch v2] mm: slab: Verify the nodeid passed to ____cache_alloc_node Aaron Tomlin
2013-04-23 15:51   ` Christoph Lameter
2013-04-23 16:45   ` Rafael Aquini
2013-04-23 23:16   ` David Rientjes
2013-04-24  7:26   ` Pekka Enberg
     [not found] <813482873.8209105.1361812140956.JavaMail.root@redhat.com>
2013-02-25 17:18 ` [PATCH " Aaron Tomlin
2013-02-25 17:45   ` Rik van Riel
2013-02-25 19:27     ` Christoph Lameter

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