mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] zram: fix null dereference of handle
@ 2017-09-19 10:21 Sergey Senozhatsky
  2017-09-19 10:38 ` BUG_ON when zsmalloc from IRQ (was zram: fix null dereference of handle) Sergey Senozhatsky
  2017-09-20  5:51 ` [PATCH] zram: fix null dereference of handle Minchan Kim
  0 siblings, 2 replies; 4+ messages in thread
From: Sergey Senozhatsky @ 2017-09-19 10:21 UTC (permalink / raw)
  To: Minchan Kim; +Cc: Andrew Morton, linux-kernel, kernel-team, Sergey Senozhatsky

Minchan,

I just ran across it [because I had a bug to analize where this
part was involved]. I'd really prefer the kernel to BUG_ON immediately
instead of dying in agony.

can we, please, return BUG_ON() back?

there is no point in trying to save the kernel once it did that type
of violation.

---

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

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

* BUG_ON when zsmalloc from IRQ (was zram: fix null dereference of handle)
  2017-09-19 10:21 [PATCH] zram: fix null dereference of handle Sergey Senozhatsky
@ 2017-09-19 10:38 ` Sergey Senozhatsky
  2017-09-20  5:51 ` [PATCH] zram: fix null dereference of handle Minchan Kim
  1 sibling, 0 replies; 4+ messages in thread
From: Sergey Senozhatsky @ 2017-09-19 10:38 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Minchan Kim, Andrew Morton, linux-kernel, kernel-team,
	Sergey Senozhatsky

ah... this should have had another Subject line....
sorry.

	-ss

On (09/19/17 19:21), Sergey Senozhatsky wrote:
> Minchan,
> 
> I just ran across it [because I had a bug to analize where this
> part was involved]. I'd really prefer the kernel to BUG_ON immediately
> instead of dying in agony.
> 
> can we, please, return BUG_ON() back?
> 
> there is no point in trying to save the kernel once it did that type
> of violation.
> 
> ---
> 
> 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);
> 

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

* Re: [PATCH] zram: fix null dereference of handle
  2017-09-19 10:21 [PATCH] zram: fix null dereference of handle Sergey Senozhatsky
  2017-09-19 10:38 ` BUG_ON when zsmalloc from IRQ (was zram: fix null dereference of handle) Sergey Senozhatsky
@ 2017-09-20  5:51 ` Minchan Kim
  2017-09-20  6:28   ` Sergey Senozhatsky
  1 sibling, 1 reply; 4+ messages in thread
From: Minchan Kim @ 2017-09-20  5:51 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Andrew Morton, linux-kernel, kernel-team, Sergey Senozhatsky

On Tue, Sep 19, 2017 at 07:21:25PM +0900, Sergey Senozhatsky wrote:
> Minchan,
> 
> I just ran across it [because I had a bug to analize where this
> part was involved]. I'd really prefer the kernel to BUG_ON immediately
> instead of dying in agony.
> 
> can we, please, return BUG_ON() back?
> 
> there is no point in trying to save the kernel once it did that type
> of violation.

I agree. If it happens, it would corrupt other user's buffer which ends
up leaking some private data from others so there is pointless to keep
system alive to debug it.

Do you mind sending a formal patch?
Thanks!

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

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

* Re: [PATCH] zram: fix null dereference of handle
  2017-09-20  5:51 ` [PATCH] zram: fix null dereference of handle Minchan Kim
@ 2017-09-20  6:28   ` Sergey Senozhatsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sergey Senozhatsky @ 2017-09-20  6:28 UTC (permalink / raw)
  To: Minchan Kim
  Cc: Sergey Senozhatsky, Andrew Morton, linux-kernel, kernel-team,
	Sergey Senozhatsky

Hello,

On (09/20/17 14:51), Minchan Kim wrote:
> On Tue, Sep 19, 2017 at 07:21:25PM +0900, Sergey Senozhatsky wrote:
> > Minchan,
> > 
> > I just ran across it [because I had a bug to analize where this
> > part was involved]. I'd really prefer the kernel to BUG_ON immediately
> > instead of dying in agony.
> > 
> > can we, please, return BUG_ON() back?
> > 
> > there is no point in trying to save the kernel once it did that type
> > of violation.
> 
> I agree. If it happens, it would corrupt other user's buffer which ends
> up leaking some private data from others so there is pointless to keep
> system alive to debug it.

thanks!

yep, I guess we are also potentially looking at __zs_map_object()
preempting zsmalloc in normal context, which would overwrite
area->vm_addr from IRQ, map it, use it, unmap it in __zs_unmap_object().
and then resumed normal context will attempt to use unmapped area->vm_addr,
I suppose.


> Do you mind sending a formal patch?

sure, will do.

	-ss

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

end of thread, other threads:[~2017-09-20  6:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-19 10:21 [PATCH] zram: fix null dereference of handle Sergey Senozhatsky
2017-09-19 10:38 ` BUG_ON when zsmalloc from IRQ (was zram: fix null dereference of handle) Sergey Senozhatsky
2017-09-20  5:51 ` [PATCH] zram: fix null dereference of handle Minchan Kim
2017-09-20  6:28   ` Sergey Senozhatsky

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

all inboxes | Powered by JetHome®