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


Groups > linux.kernel > #1652154

Re: mips qemu test failures in -next due to "kthread: Fix use-after-free if kthread fork fails"

From Vegard Nossum <vegard.nossum@oracle.com>
Newsgroups linux.kernel
Subject Re: mips qemu test failures in -next due to "kthread: Fix use-after-free if kthread fork fails"
Date 2017-05-28 17:00 +0200
Message-ID <tM7PI-3iO-13@gated-at.bofh.it> (permalink)
References <tLOal-7br-1@gated-at.bofh.it> <tM4RP-1pY-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 05/28/17 13:45, Vegard Nossum wrote:
> On 05/27/17 19:56, Guenter Roeck wrote:
>> Hi,
>>
>> my qemu testis of mips images are failing in -next. Symptom is a hang 
>> during
>> boot; see http://kerneltests.org/builders/qemu-mips-next for some 
>> examples.
>>
>> I bisected the problem in next-20170526. It points to commit 
>> 4d6501dce079c
>> ("kthread: Fix use-after-free if kthread fork fails"). Reverting that 
>> patch
>> fixes the problem.
>>
>> Bisect log is attached.
> 
> Hi,
> 
> Thanks for the report and sorry for the breakage :-/
> 
> I can't immediately spot what's going wrong, but I am able to reproduce
> it on mips so I will try to debug.
> 
> Are you sure it's this commit, though? I checked out linus/master and
> I get a boot hang even after reverting it.

My mistake; I ran into a different bug which made me think it was
hanging when it wasn't.

However, I think I found the problem; does this patch fix it for you too?

diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 918d4c73e951..5351e1f3950d 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -120,7 +120,6 @@ int copy_thread_tls(unsigned long clone_flags, 
unsigned long usp,
         struct thread_info *ti = task_thread_info(p);
         struct pt_regs *childregs, *regs = current_pt_regs();
         unsigned long childksp;
-       p->set_child_tid = p->clear_child_tid = NULL;

         childksp = (unsigned long)task_stack_page(p) + THREAD_SIZE - 32;

The problem is that when we moved the p->{set,clear}_child_tid
assignments inside copy_process(), the above assignments would clear
them out. The assignments only exist on mips and openrisc (which would
need the same patch), which explains why I didn't see it in my x86
testing. I think the patch above should be safe given that we're now
always setting these fields in copy_process() at an appropriate moment.

Looks like those assignments came from commit 3c37026d43c47 ("NPTL,
round one."); Ralf?

Oleg?


Vegard

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

mips qemu test failures in -next due to "kthread: Fix use-after-free  if kthread fork fails" Guenter Roeck <linux@roeck-us.net> - 2017-05-27 20:00 +0200
  Re: mips qemu test failures in -next due to "kthread: Fix  use-after-free if kthread fork fails" Vegard Nossum <vegard.nossum@oracle.com> - 2017-05-28 13:50 +0200
    Re: mips qemu test failures in -next due to "kthread: Fix  use-after-free if kthread fork fails" Guenter Roeck <linux@roeck-us.net> - 2017-05-28 16:50 +0200
    Re: mips qemu test failures in -next due to "kthread: Fix  use-after-free if kthread fork fails" Vegard Nossum <vegard.nossum@oracle.com> - 2017-05-28 17:00 +0200
      Re: mips qemu test failures in -next due to "kthread: Fix  use-after-free if kthread fork fails" Guenter Roeck <linux@roeck-us.net> - 2017-05-28 17:10 +0200
      Re: mips qemu test failures in -next due to "kthread: Fix  use-after-free if kthread fork fails" Guenter Roeck <linux@roeck-us.net> - 2017-05-28 17:30 +0200

csiph-web