linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: BUG: corrupted list in cpu_stop_queue_work
       [not found] ` <000000000000693c7d057087caf3@google.com>
@ 2018-07-09 12:55   ` Tetsuo Handa
  2018-07-09 13:32     ` Matthew Wilcox
  0 siblings, 1 reply; 5+ messages in thread
From: Tetsuo Handa @ 2018-07-09 12:55 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: syzbot, bigeasy, linux-kernel, matt, mingo, peterz,
	syzkaller-bugs, tglx, linux-mm

Hello Matthew,

It seems to me that there are other locations which do not check xas_store()
failure. Is that really OK? If they are OK, I think we want a comment like
/* This never fails. */ or /* Failure is OK because ... */
for each call without failure check.

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

* Re: BUG: corrupted list in cpu_stop_queue_work
  2018-07-09 12:55   ` BUG: corrupted list in cpu_stop_queue_work Tetsuo Handa
@ 2018-07-09 13:32     ` Matthew Wilcox
  2018-07-09 14:15       ` Tetsuo Handa
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Wilcox @ 2018-07-09 13:32 UTC (permalink / raw)
  To: Tetsuo Handa
  Cc: syzbot, bigeasy, linux-kernel, matt, mingo, peterz,
	syzkaller-bugs, tglx, linux-mm

On Mon, Jul 09, 2018 at 09:55:17PM +0900, Tetsuo Handa wrote:
> Hello Matthew,
> 
> It seems to me that there are other locations which do not check xas_store()
> failure. Is that really OK? If they are OK, I think we want a comment like
> /* This never fails. */ or /* Failure is OK because ... */
> for each call without failure check.

Good grief, no, I'm not adding a comment to all 50 calls to
xas_store().  Here are some rules:

 - xas_store(NULL) cannot fail.
 - xas_store(p) cannot fail if we know something was already in
   that slot beforehand (ie a replace operation).
 - xas_store(p) cannot fail if xas_create_range() was previously
   successful.
 - xas_store(p) can fail, but it's OK if the only things after that are
   other xas_*() calls.  Because every xas_*() call checks xas_error().
   So this is fine:

	do {
		xas_store(&xas, p);
		xas_set_tag(&xas, XA_TAG_0);
	} while (xas_nomem(&xas, GFP_KERNEL));

> >From d6f24d6eecd79836502527624f8086f4e3e4c331 Mon Sep 17 00:00:00 2001
> From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Date: Mon, 9 Jul 2018 15:58:44 +0900
> Subject: [PATCH] shmem: Fix crash upon xas_store() failure.
> 
> syzbot is reporting list corruption [1]. This is because xas_store() from
> shmem_add_to_page_cache() is not handling memory allocation failure. Fix
> this by checking xas_error() after xas_store().

I have no idea why you wrote this patch on Monday when I already said
I knew what the problem was on Friday, fixed the problem and pushed it
out to my git tree on Saturday.

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

* Re: BUG: corrupted list in cpu_stop_queue_work
  2018-07-09 13:32     ` Matthew Wilcox
@ 2018-07-09 14:15       ` Tetsuo Handa
  2018-07-09 14:24         ` Matthew Wilcox
  0 siblings, 1 reply; 5+ messages in thread
From: Tetsuo Handa @ 2018-07-09 14:15 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: syzbot, bigeasy, linux-kernel, matt, mingo, peterz,
	syzkaller-bugs, tglx, linux-mm

On 2018/07/09 22:32, Matthew Wilcox wrote:
>> >From d6f24d6eecd79836502527624f8086f4e3e4c331 Mon Sep 17 00:00:00 2001
>> From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
>> Date: Mon, 9 Jul 2018 15:58:44 +0900
>> Subject: [PATCH] shmem: Fix crash upon xas_store() failure.
>>
>> syzbot is reporting list corruption [1]. This is because xas_store() from
>> shmem_add_to_page_cache() is not handling memory allocation failure. Fix
>> this by checking xas_error() after xas_store().
> 
> I have no idea why you wrote this patch on Monday when I already said
> I knew what the problem was on Friday, fixed the problem and pushed it
> out to my git tree on Saturday.
> 

Because syzbot found a C reproducer on 2018/07/09 02:29 UTC, and your fix was
not in time for a kernel version syzbot was testing, and you were not listed
as a recipient of this bug, and I didn't know you already fixed this bug.

Anyway, linux-next-20180709 still does not have this fix.
What is the title of your fix you pushed on Saturday?

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

* Re: BUG: corrupted list in cpu_stop_queue_work
  2018-07-09 14:15       ` Tetsuo Handa
@ 2018-07-09 14:24         ` Matthew Wilcox
  2018-07-09 14:34           ` Tetsuo Handa
  0 siblings, 1 reply; 5+ messages in thread
From: Matthew Wilcox @ 2018-07-09 14:24 UTC (permalink / raw)
  To: Tetsuo Handa
  Cc: syzbot, bigeasy, linux-kernel, matt, mingo, peterz,
	syzkaller-bugs, tglx, linux-mm

On Mon, Jul 09, 2018 at 11:15:54PM +0900, Tetsuo Handa wrote:
> On 2018/07/09 22:32, Matthew Wilcox wrote:
> >> >From d6f24d6eecd79836502527624f8086f4e3e4c331 Mon Sep 17 00:00:00 2001
> >> From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> >> Date: Mon, 9 Jul 2018 15:58:44 +0900
> >> Subject: [PATCH] shmem: Fix crash upon xas_store() failure.
> >>
> >> syzbot is reporting list corruption [1]. This is because xas_store() from
> >> shmem_add_to_page_cache() is not handling memory allocation failure. Fix
> >> this by checking xas_error() after xas_store().
> > 
> > I have no idea why you wrote this patch on Monday when I already said
> > I knew what the problem was on Friday, fixed the problem and pushed it
> > out to my git tree on Saturday.
> > 
> 
> Because syzbot found a C reproducer on 2018/07/09 02:29 UTC, and your fix was
> not in time for a kernel version syzbot was testing, and you were not listed
> as a recipient of this bug, and I didn't know you already fixed this bug.
> 
> Anyway, linux-next-20180709 still does not have this fix.
> What is the title of your fix you pushed on Saturday?

I folded it into shmem: Convert shmem_add_to_page_cache to XArray.
I can see it's fixed in today's linux-next.  I fixed it differently
from the way you fixed it, so if you're looking for an xas_error check
after xas_store, you won't find it.

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

* Re: BUG: corrupted list in cpu_stop_queue_work
  2018-07-09 14:24         ` Matthew Wilcox
@ 2018-07-09 14:34           ` Tetsuo Handa
  0 siblings, 0 replies; 5+ messages in thread
From: Tetsuo Handa @ 2018-07-09 14:34 UTC (permalink / raw)
  To: Matthew Wilcox
  Cc: syzbot, bigeasy, linux-kernel, matt, mingo, peterz,
	syzkaller-bugs, tglx, linux-mm

On 2018/07/09 23:24, Matthew Wilcox wrote:
>> Anyway, linux-next-20180709 still does not have this fix.
>> What is the title of your fix you pushed on Saturday?
> 
> I folded it into shmem: Convert shmem_add_to_page_cache to XArray.
> I can see it's fixed in today's linux-next.  I fixed it differently
> from the way you fixed it, so if you're looking for an xas_error check
> after xas_store, you won't find it.
> 

OK. linux-next-20180709 should no longer hit this bug. Closing with

#syz fix: shmem: Convert shmem_add_to_page_cache to XArray

Thanks.

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

end of thread, other threads:[~2018-07-09 14:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <00000000000032412205706753b5@google.com>
     [not found] ` <000000000000693c7d057087caf3@google.com>
2018-07-09 12:55   ` BUG: corrupted list in cpu_stop_queue_work Tetsuo Handa
2018-07-09 13:32     ` Matthew Wilcox
2018-07-09 14:15       ` Tetsuo Handa
2018-07-09 14:24         ` Matthew Wilcox
2018-07-09 14:34           ` Tetsuo Handa

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