Received: by 10.223.164.202 with SMTP id h10csp83905wrb; Mon, 6 Nov 2017 03:03:52 -0800 (PST) X-Google-Smtp-Source: ABhQp+S13aRJC7yROuTK3G8Zw4t2BU6dQ+wjZ/6M2pFqC624UtjC2k9EqC5+lqwihY+MGlXulAuH X-Received: by 10.98.200.138 with SMTP id i10mr16453163pfk.222.1509966232035; Mon, 06 Nov 2017 03:03:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509966232; cv=none; d=google.com; s=arc-20160816; b=0z2/Hr3a8JcAltAxZtzG/o0T1qt5dRXLxnwCUjfrGHA+fdJEj0Dvdm1ayustj8yCmS fdLeWWQW8TFM1+ZJgLb+BX58KH6dN69wtUNRZoPwowlsjTVn4hBhogOeh0cgsMFdJDnf +kj+yzdliuzXWnMSkzEC+wEZWN2jeF6EW1C2hYG8RIIPgZwf0vQNXuRXiZjC4arBGYNa I0N4nTOvWQu6p40SptCtAt9+YoE6wfjeNE+wJ3A3MVhLY8WQxejAoyuqbpFNVTlZ4V8u xeSQKY9wLg4NbwFex2uPqMrfEzJvo4qmJ/O/yT/cX6W7HnOTW8UFkeVww8FZIC8Lxhi9 Zqkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=xyrFV09bSt8hPwWXDg+EmS3MaKeVMC106ABmzW9vdK0=; b=zjsqKPdVvcfcmTxBRCFS6glRPdFjVVBKw2O1lVr3pCbBUHNKgTiMqBjVgyTz1v5iEP kpRHdOUqd6bM55mPVkj99lkiF6SKS4a/J+kKPApE4b8UqWik/uYhv5EsmndTsDQjT5CU bWM7DBZF08xlz/1SfZxPGwIuVmmNJSijldWa3ljnXvgV9lSbFudQ1bvr1f7xVImFUw4h mlJlQwf2gerAzWPG0Y69CcIPwbtrI7V4RHSt7iI3BuOXerNbKVpn4Ot67N8aYhEfRwp3 SxZM8P6Tny3FtDTGZxtSe4YIVJElzNVKXjdwQb7erOjbXC6Bo6qbJjOy49DYfLjx9ygR PQTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=J60cVb8I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k19si11660966pgf.206.2017.11.06.03.03.35; Mon, 06 Nov 2017 03:03:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=J60cVb8I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752190AbdKFLCn (ORCPT + 99 others); Mon, 6 Nov 2017 06:02:43 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:55846 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751457AbdKFLCl (ORCPT ); Mon, 6 Nov 2017 06:02:41 -0500 Received: by mail-io0-f193.google.com with SMTP id p186so15187152ioe.12 for ; Mon, 06 Nov 2017 03:02:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xyrFV09bSt8hPwWXDg+EmS3MaKeVMC106ABmzW9vdK0=; b=J60cVb8IZ59x8xvPBIW0e5gjiguFWelhffrY2lUbPzbA6vpJm0x38uuZim++6mvoY+ 0bctnI2CUsSDRlKqBBBly2+vGBQId5sUBlvPFTERO8KRLZg+qy1Tee+f3cXVGb7iHhRh hwjLa0fy+Lsy3IoOYuTal/rHSA2HJEEPKqkHzfXk+/E+8464ervisjs60gWuZydIQO+o El8HLQ4A9980z863+UpIGE0KQX8j/VFUEu5CAVa9QkEVvUpqyfl1J7Stp8iCIJVFQO5S r/GffODRaCePbnabbkpqb+qAco/G7MyzFktkCWXt3q/5pWrWUIZay0yGaj3ynXFbDkI6 gK4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xyrFV09bSt8hPwWXDg+EmS3MaKeVMC106ABmzW9vdK0=; b=URqtHHKpbURl28co32m/ZLsJDUU6inL5SOi6Afw949C8m0MADbOz/CcWYJSgDSvAfE 9RX9lioD57fuLDEZIXlLswzc1XEp/+le/+3BFV/JQPwX2bGvHfdWyEa+hPKb6GK1KohO 8DcHyQuCBWhOe0/7lviSbaO8jhWC6MgisEFA4Tjo8zAVwxLucu2zUPS+vcvAQAGVf6qE SKdsLaQ1D+d5jKKr/Wk6nBK6iJsL0w4xjiQ6XDbIgtI44wn3NLLFaXSsI9FZmSirUuGA BVtFL0Yz0AX5TQUSQH64XcAV7gSq3txO/WmPcpDHLyy911LOUdjsQix5gElJK42SCxLf TM0g== X-Gm-Message-State: AMCzsaX4fU82D1q8BpjFfsK4gW3daKWljYJkaa9IEJoOb4rLr0OGml3L mS6hPeWibLg/pRXZ646X8lJagXCt6Y6QW8uYymgMUQ== X-Received: by 10.107.104.12 with SMTP id d12mr18691810ioc.296.1509966160001; Mon, 06 Nov 2017 03:02:40 -0800 (PST) MIME-Version: 1.0 Received: by 10.2.155.231 with HTTP; Mon, 6 Nov 2017 03:02:19 -0800 (PST) In-Reply-To: <20171102170138.GA13663@redhat.com> References: <94eb2c058c80ea49ed055cc8695e@google.com> <20171031163451.GA30223@redhat.com> <20171102170138.GA13663@redhat.com> From: Dmitry Vyukov Date: Mon, 6 Nov 2017 12:02:19 +0100 Message-ID: Subject: Re: WARNING in task_participate_group_stop To: Oleg Nesterov Cc: syzbot , Andrew Morton , Arvind Yadav , Mark Brown , "Eric W. Biederman" , =?UTF-8?B?RnLDqWTDqXJpYyBXZWlzYmVja2Vy?= , jamie.iles@oracle.com, LKML , "Martin K. Petersen" , mchehab@kernel.org, Ingo Molnar , mpe@ellerman.id.au, syzkaller-bugs@googlegroups.com, Al Viro , Kyle Huey , Kees Cook Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 2, 2017 at 6:01 PM, Oleg Nesterov wrote: > On 11/01, Dmitry Vyukov wrote: >> >> On Tue, Oct 31, 2017 at 7:34 PM, Oleg Nesterov wrote: >> > Hmm. I do not see reproducer in this email... >> >> Ah, sorry. You can see full thread with attachments here: >> https://groups.google.com/forum/#!topic/syzkaller-bugs/EUmYZU4m5gU > > Heh. I can't say I enjoyed reading the reproducer ;) > >> >> > WARNING: CPU: 0 PID: 1 at kernel/signal.c:340 >> >> > task_participate_group_stop+0x1ce/0x230 kernel/signal.c:340 >> >> > Kernel panic - not syncing: panic_on_warn set ... >> >> > >> >> > CPU: 0 PID: 1 Comm: init Not tainted 4.13.0-mm1+ #5 >> > >> > So this is init process with SIGNAL_UNKILLABLE flag set. And I hope it has >> > the pending SIGKILL, otherwise there is something else. > > From repro.c > > line 111 r[8] = syscall(__NR_ptrace, 0x10ul, r[7]); > > this is PTRACE_ATTACH > > line 115 syscall(__NR_ptrace, 0x4200ul, r[7], 0x40000012ul, 0x100012ul); > > this is PTRACE_SETOPTIONS and "data" includes PTRACE_O_EXITKILL. > > r[7] is initialized at > > line 110 r[7] = *(uint32_t*)0x20f9cffc; > > so if it is eq to 1 then it can attach to init and in this case the problem > can be explained by the wrong SIGNAL_UNKILLABLE/SIGKILL logic. > > But how *(uint32_t*)0x20f9cffc can be 1 ? > > line 108 r[6] = syscall(__NR_fcntl, r[1], 0x10ul, 0x20f9cff8ul); > > this is F_GETOWN_EX, addr = 0x20f9cff8 == 0x20f9cffc + 4, so if fcntl() > actually succeeds then r[7] == f_owner_ex->pid. > > It _can_ be 1, but the reproducer doesn't work for me. If you can reproduce, > could you try the patch below? Hi, I would like to understand why you were not able to reproduce it. I won't be sitting here all the time, and we are tracking hundreds of bugs across different linux kernels and other OSes, so it's problematic to do any extensive work on all of them. That's why we try to provide reproducers. I've just tried the repro on the latest upstream (39dae59d66acd86d1de24294bd2f343fd5e7a625) and it triggered the WARNING within a second. Did you use the config provided? Did you use qemu or real hardware? Can you try in qemu (with -smp>1)? > diff --git a/kernel/signal.c b/kernel/signal.c > index 800a18f..7e15b56 100644 > --- a/kernel/signal.c > +++ b/kernel/signal.c > @@ -78,7 +78,7 @@ static int sig_task_ignored(struct task_struct *t, int sig, bool force) > handler = sig_handler(t, sig); > > if (unlikely(t->signal->flags & SIGNAL_UNKILLABLE) && > - handler == SIG_DFL && !force) > + handler == SIG_DFL && !(force && sig_kernel_only(sig))) > return 1; > > return sig_handler_ignored(handler, sig); > @@ -94,13 +94,15 @@ static int sig_ignored(struct task_struct *t, int sig, bool force) > if (sigismember(&t->blocked, sig) || sigismember(&t->real_blocked, sig)) > return 0; > > - if (!sig_task_ignored(t, sig, force)) > - return 0; > - > /* > - * Tracers may want to know about even ignored signals. > + * Tracers may want to know about even ignored signal unless it > + * is SIGKILL which can't be reported anyway but can be ignored > + * by SIGNAL_UNKILLABLE task. > */ > - return !t->ptrace; > + if (t->ptrace && sig != SIGKILL) > + return 0; > + > + return sig_task_ignored(t, sig, force); > } > > /* > @@ -929,9 +931,9 @@ static void complete_signal(int sig, struct task_struct *p, int group) > * then start taking the whole group down immediately. > */ > if (sig_fatal(p, sig) && > - !(signal->flags & (SIGNAL_UNKILLABLE | SIGNAL_GROUP_EXIT)) && > + !(signal->flags & SIGNAL_GROUP_EXIT) && > !sigismember(&t->real_blocked, sig) && > - (sig == SIGKILL || !t->ptrace)) { > + (sig == SIGKILL || !p->ptrace)) { > /* > * This signal will be fatal to the whole group. > */ > From 1582974543431516836@xxx Thu Nov 02 17:02:45 +0000 2017 X-GM-THRID: 1582711532474407023 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread