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


Groups > linux.kernel > #1735557 > unrolled thread

[PATCH] zsmalloc: calling zs_map_object() from irq is a bug

Started bySergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
First post2017-09-20 08:40 +0200
Last post2017-09-20 08:50 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] zsmalloc: calling zs_map_object() from irq is a bug Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-09-20 08:40 +0200
    Re: [PATCH] zsmalloc: calling zs_map_object() from irq is a bug Minchan Kim <minchan@kernel.org> - 2017-09-20 08:50 +0200
      Re: [PATCH] zsmalloc: calling zs_map_object() from irq is a bug Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2017-09-20 08:50 +0200

#1735557 — [PATCH] zsmalloc: calling zs_map_object() from irq is a bug

FromSergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Date2017-09-20 08:40 +0200
Subject[PATCH] zsmalloc: calling zs_map_object() from irq is a bug
Message-ID<urGPU-7L3-17@gated-at.bofh.it>
Use BUG_ON(in_interrupt()) in zs_map_object(). Calling this
function from IRQ is a bug, because we use per-CPU mappings
and interrupt may corrupt those buffers.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
 mm/zsmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 7c38e850a8fc..685049a9048d 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1349,7 +1349,7 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle,
 	 * pools/users, we can't allow mapping in interrupt context
 	 * because it can corrupt another users mappings.
 	 */
-	WARN_ON_ONCE(in_interrupt());
+	BUG_ON(in_interrupt());
 
 	/* From now on, migration cannot move the object */
 	pin_tag(handle);
-- 
2.14.1

[toc] | [next] | [standalone]


#1735562

FromMinchan Kim <minchan@kernel.org>
Date2017-09-20 08:50 +0200
Message-ID<urGZz-7Og-1@gated-at.bofh.it>
In reply to#1735557
On Wed, Sep 20, 2017 at 03:39:41PM +0900, Sergey Senozhatsky wrote:
> Use BUG_ON(in_interrupt()) in zs_map_object(). Calling this
> function from IRQ is a bug, because we use per-CPU mappings
> and interrupt may corrupt those buffers.
> 
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>

IMHO, corruption the buffer would be not enough to be a BUG_ON
which stop the system fully so user loses any chances to shut
down smooth/hunt it down.

More serious thing of our case is that it can leak other user's
data by overwriting, which is more concern I am thinking now.

So,

Acked-by: Minchan Kim <minchan@kernel.org>

Thanks!

[toc] | [prev] | [next] | [standalone]


#1735564

FromSergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Date2017-09-20 08:50 +0200
Message-ID<urGZA-7Og-5@gated-at.bofh.it>
In reply to#1735562
On (09/20/17 15:47), Minchan Kim wrote:
> On Wed, Sep 20, 2017 at 03:39:41PM +0900, Sergey Senozhatsky wrote:
> > Use BUG_ON(in_interrupt()) in zs_map_object(). Calling this
> > function from IRQ is a bug, because we use per-CPU mappings
> > and interrupt may corrupt those buffers.
> > 
> > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> 
> IMHO, corruption the buffer would be not enough to be a BUG_ON
> which stop the system fully so user loses any chances to shut
> down smooth/hunt it down.
> 
> More serious thing of our case is that it can leak other user's
> data by overwriting, which is more concern I am thinking now.
> 
> So,
> 
> Acked-by: Minchan Kim <minchan@kernel.org>

thanks.

	-ss

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web