Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1194956rwd; Thu, 1 Jun 2023 11:46:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7m0+xBzndgKUiI4mvo6qqOuEV0y2FHwqg8/4S+aPNeojotlF63sBYJY9hoaQZe9R67+JIp X-Received: by 2002:a05:6a20:4286:b0:10b:235c:d8c3 with SMTP id o6-20020a056a20428600b0010b235cd8c3mr9691005pzj.36.1685645214346; Thu, 01 Jun 2023 11:46:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685645214; cv=none; d=google.com; s=arc-20160816; b=mcBu7Y7Jqxc6lt+P/O8nAZoBmaeEHFHeemu1UapIvHQyXzW0U5UB0cCzBJlauaZRQ3 EpWkW14zAaoRbK5eFVkMQirqBxJFowXlq8/nggaU6cGZmJnqkAZV8lAxSb6OnoSL7kyg i/lfosuS/8v8iviSbCR7YXi5RxjzxicAVsP9oVGfceask/17QNEUHA3y/FQyILgPLhWC TpFCllnQ9NsGtCT4n5/zPRwsrJQhVwpjCehyzKtol73XcRkVQNAx6oxZRxEG3aa3/oH1 LmDRhNA3T1JgNJcYvKB7JI33t108znWHdHtnvN9cJe/IpYN6/GG9cw+D380CqrxWCwdq mHwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=A5dSayMLOZ2SWfW3EHSyHTiLOVAvqWyyk7XNs5jXd68=; b=Ybza+CLYVTmBIYG0eN8IfJsnfJA0g61EP7I5kbQd6Svls4uExUr8hL8jivFMEDmknP sucapXU74n5d5cSslrClGV8OovkcLt+e6qF8ztg1q52D54Dr93YYEo4Xm5yABo9cZgn1 GJPJwjvU5eM/SmfpRJ4wv/lMatD068haq26AvoDouz/IqoiV98cun7kjyP9Z6ObiAKNn +RjNO71QGKXqH6u/VphZA+5AKJb9yAQ/9WzspyLGPBfffP4sv6NpimBICrBJN9YMjQbO RkDmitHFvggumziCnIMahQHzgxPpS5qed+fSw9/mu4gVQpyP2triYdCEVFSwbiWfcwxE 8JDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N0BEVuLn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h13-20020a056a00000d00b0064f78c32b89si5871453pfk.95.2023.06.01.11.46.30; Thu, 01 Jun 2023 11:46:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N0BEVuLn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231334AbjFASYk (ORCPT + 99 others); Thu, 1 Jun 2023 14:24:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbjFASYj (ORCPT ); Thu, 1 Jun 2023 14:24:39 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EF3DE7 for ; Thu, 1 Jun 2023 11:23:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685643826; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A5dSayMLOZ2SWfW3EHSyHTiLOVAvqWyyk7XNs5jXd68=; b=N0BEVuLnX0JrmHtTslII+F5JakSfu24+x9yn5u9F0IvG7bYRRLkxoz/kTzKxR7awY3txMh Ni0zCGUGwo3XMdQwAQILtB+PhMEf8pZk+PCFjvLsGAjO6rbg35VkReSc1qQFd8Jdd8VMiM dP90yPenfBo8KZnRrD0XNS5uYgCLag4= Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-137--2GlbbB-NmOLrAxRIV2nlg-1; Thu, 01 Jun 2023 14:23:45 -0400 X-MC-Unique: -2GlbbB-NmOLrAxRIV2nlg-1 Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-53f44c2566dso510957a12.2 for ; Thu, 01 Jun 2023 11:23:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685643824; x=1688235824; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=A5dSayMLOZ2SWfW3EHSyHTiLOVAvqWyyk7XNs5jXd68=; b=MiSmd2uJTMBh+L6OsKBc/FqVZ4Bx/YGlWabuO1AHyeIZxKxnB10RUjqGTc5HcSu1dg 3q4yI2GCpKL/i/p1212RPInNWrR8Co3tpJTy4lN/otTF6VKAU/j7NkuBxnLJ856lss09 q8NfSHffMvFr8Ee7DPGnG+xguJ+89cE9KsPEp/aKEUTnJIv7Bu7x1YQVMxiyLQY3eQoj gD+cOSMS6HhGl2/n6Sc7MJZEygtgLFdhphFjttXeK0HZkDSb6dh6Y+sIL9AHBHdU1WOG 25MP0W9qLzWrhDxGJcZf3mJHWQ0XTBM0so4y3w1+AJDVuHNW2t9jjgJx/HBmNqn6tQN9 GBDw== X-Gm-Message-State: AC+VfDz/YvBAKeYQF+JeK59i0DiAd/93vWMzjsFTEdBC5Qe8naOpVzy4 e/yv4BLXD6Rr5mrPCscxeNP6e7aVGFdKpTvSW5yZ9X4RDhleZpTkpKhiFNdqQu1hNA0t1hD9qBf dD3lTG+TcC5v0TBfIhOiH2w2rDfA+4LYKVBuVQjLI X-Received: by 2002:a17:90a:3b0b:b0:256:4246:d94d with SMTP id d11-20020a17090a3b0b00b002564246d94dmr225484pjc.3.1685643823891; Thu, 01 Jun 2023 11:23:43 -0700 (PDT) X-Received: by 2002:a17:90a:3b0b:b0:256:4246:d94d with SMTP id d11-20020a17090a3b0b00b002564246d94dmr225462pjc.3.1685643823561; Thu, 01 Jun 2023 11:23:43 -0700 (PDT) MIME-Version: 1.0 References: <20230516191441.34377-1-wander@redhat.com> <20230517152632.GC1286@redhat.com> <20230529122256.GA588@redhat.com> <20230601181359.GA23852@redhat.com> In-Reply-To: <20230601181359.GA23852@redhat.com> From: Wander Lairson Costa Date: Thu, 1 Jun 2023 15:23:32 -0300 Message-ID: Subject: Re: [PATCH v9] kernel/fork: beware of __put_task_struct calling context To: Oleg Nesterov Cc: "Russell King (Oracle)" , Brian Cain , Michael Ellerman , Stafford Horne , Kefeng Wang , Andrew Morton , "Liam R. Howlett" , Vlastimil Babka , "Matthew Wilcox (Oracle)" , "Eric W. Biederman" , Andrei Vagin , Peter Zijlstra , "Paul E. McKenney" , Daniel Bristot de Oliveira , Yu Zhao , Alexey Gladkov , Mike Kravetz , Yang Shi , open list , Hu Chunyu , Valentin Schneider , Sebastian Andrzej Siewior , Steven Rostedt , Luis Goncalves Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 1, 2023 at 3:14=E2=80=AFPM Oleg Nesterov wrot= e: > > On 06/01, Wander Lairson Costa wrote: > > > > On Mon, May 29, 2023 at 9:23=E2=80=AFAM Oleg Nesterov = wrote: > > > > > > On 05/17, Wander Lairson Costa wrote: > > > > > > > > On Wed, May 17, 2023 at 12:26=E2=80=AFPM Oleg Nesterov wrote: > > > > > > > > > > LGTM but we still need to understand the possible problems with C= ONFIG_PROVE_RAW_LOCK_NESTING ... > > > > > > > > > > Again, I'll try to investigate when I have time although I am not= sure I can really help. > > > > > > > > > > Perhaps you too can try to do this ? ;) > > > > > > > > > > > > > FWIW, I tested this patch with CONFIG_PROVE_LOCK_NESTING in RT and > > > > stock kernels. No splat happened. > > > > > > Strange... FYI, I am running the kernel with this patch > > > > > > diff --git a/kernel/sys.c b/kernel/sys.c > > > index 339fee3eff6a..3169cceddf3b 100644 > > > --- a/kernel/sys.c > > > +++ b/kernel/sys.c > > > @@ -2412,6 +2412,17 @@ SYSCALL_DEFINE5(prctl, int, option, un= signed long, arg2, unsigned long, arg3, > > > > > > error =3D 0; > > > switch (option) { > > > + case 666: { > > > + static DEFINE_SPINLOCK(l); > > > + static DEFINE_RAW_SPINLOCK(r); > > > + > > > + raw_spin_lock(&r); > > > + spin_lock(&l); > > > + spin_unlock(&l); > > > + raw_spin_unlock(&r); > > > + > > > + break; > > > + } > > > case PR_SET_PDEATHSIG: > > > if (!valid_signal(arg2)) { > > > error =3D -EINVAL; > > > > > > applied (because I am too lazy to compile a module ;) and > > > > > > > FWIW, I converted it to a module [1] > > where is [1] ? not that I think this matters though... > > > > # perl -e 'syscall 157,666' > > > > > > triggers the lockdep bug > > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D > > > [ BUG: Invalid wait context ] > > > 6.4.0-rc2-00018-g4d6d4c7f541d-dirty #1176 Not tainted > > > ----------------------------- > > > perl/35 is trying to lock: > > > ffffffff81c4cc18 (l){....}-{3:3}, at: __do_sys_prctl+0x21b/0x= 87b > > > other info that might help us debug this: > > > context-{5:5} > > > ... > > > > > > as expected. > > > > > > > Yeah, I tried it here and I had the same results, > > OK, > > > but only in the RT kernel > > this again suggests that your testing was wrong or I am totally confused = (quite > possible, I know nothing about RT). I did the testing without CONFIG_PREE= MPT_RT. > Hrm, could you please share your .config? > > But running the reproducer for put_task_struct(), works fine. > > which reproducer ? > Only now I noticed I didn't add the reproducer to the commit message: while true; do stress-ng --sched deadline --sched-period 1000000000 --sched-runtime 800000000 --sched-deadline 1000000000 --mmapfork 23 -t 20 done