Received: by 10.223.164.221 with SMTP id h29csp2382747wrb; Thu, 2 Nov 2017 10:02:45 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TR59K4hMpqaB0QWu5QljruqbIDqLv3dyfDJ9soaaj+z5vNlcshZvYTHcHQAqR9PLFIlHPz X-Received: by 10.84.132.76 with SMTP id 70mr3986273ple.135.1509642165753; Thu, 02 Nov 2017 10:02:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509642165; cv=none; d=google.com; s=arc-20160816; b=JxhKByrp5uSmXTJjNJ2MXJdtgrtTr2Y0GUIpwJcED/YfQ+ZXPpE1m+HlP6Bhu4+zgh M2Y4pyLDfgBRvirv15U+wibVVc1N5Li2hEi5Vv2MqTQ2NV0waeZ1+pYYOvTL9400gFFE dCHLNOPY6jyfiarBEGMbfnq/gImRvsa/p42CP9ilytcjIZ1ZikzFw09IjgVDqTJLpg5t 6JZlpy8Kqg8LBoQiUGOLidIVwZetXozCpFtWAoTU/PiFfKs/UwPH/NOAwRNNu3TmH1zU czk1ncd02f7mN6CyQ9ArRGnKmXfiuQ6wzS1GZdNVNmvvRUrLu3QFVVOobxxKT8ya0MiA +fEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:arc-authentication-results; bh=v8PeRvwSFHO2ylLs4Uo66vvnNcOXXADzpe869n3tQg0=; b=bKteAYZw+9Tba9pr30HZc9hzOu9g1AcTF1u/fKl8S58sHxIfw7haNYs5y/SNh8Yhmf mu8+Bep3xRRmSxSZui+3DiJHnvhCYYTwyy7dh/aPL1qDUBerf3ZIQGrBywOfJ3r+jenW 4JTFgfjzzqv6TxIcLZpIJNfR562Uyazig422MImBx1yiy7oCWBj1Lc20Ltd2IinXYeF1 Sr09rN+NqTN7iHAEKgBmC0b2LuduD7IoLFM3CFwwcs4puHSiHQg3cbcrCL8WduZfIR3z YiSbaSzvHIHG5SC1tqCLf2H39HJ/Lp6vA6OPPDwWZsTWmSgBkQrFzO8/lhPRmBqWzaIQ eNeA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k26si4136174pfj.372.2017.11.02.10.02.31; Thu, 02 Nov 2017 10:02:45 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754138AbdKBRBo (ORCPT + 97 others); Thu, 2 Nov 2017 13:01:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59904 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750722AbdKBRBn (ORCPT ); Thu, 2 Nov 2017 13:01:43 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06F35356E8; Thu, 2 Nov 2017 17:01:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 06F35356E8 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=oleg@redhat.com Received: from dhcp-27-174.brq.redhat.com (unknown [10.34.27.30]) by smtp.corp.redhat.com (Postfix) with SMTP id 9444660C9F; Thu, 2 Nov 2017 17:01:39 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 2 Nov 2017 18:01:42 +0100 (CET) Date: Thu, 2 Nov 2017 18:01:38 +0100 From: Oleg Nesterov To: Dmitry Vyukov Cc: syzbot , Andrew Morton , Arvind Yadav , Mark Brown , "Eric W. Biederman" , =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , 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 Subject: Re: WARNING in task_participate_group_stop Message-ID: <20171102170138.GA13663@redhat.com> References: <94eb2c058c80ea49ed055cc8695e@google.com> <20171031163451.GA30223@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 02 Nov 2017 17:01:43 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Oleg. 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 1582842126593253474@xxx Wed Nov 01 05:58:03 +0000 2017 X-GM-THRID: 1582711532474407023 X-Gmail-Labels: Inbox,Category Forums