Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5482450rwd; Mon, 5 Jun 2023 04:29:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ53nMfvfGb6FNvzk3WlIuZjScCE6Ieh5b0SDQurLv+AjcGAvDomwxMAUIN5HcTex4hgH9L/ X-Received: by 2002:a05:6a21:9712:b0:10b:ca02:1a5e with SMTP id ub18-20020a056a21971200b0010bca021a5emr5529179pzb.55.1685964599645; Mon, 05 Jun 2023 04:29:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685964599; cv=none; d=google.com; s=arc-20160816; b=lsb97+Id9cblFerAjZRQp4bRU2ZKp6T/IlBZWJKB5DHxJeb4B+7l2dzkYZba4wiE8h VwwO73C8h4JR2WFhlmXWj5+aGpGBCyrCW4l6o7BoG4o9y5KKvaR2dKHASdrmCYHPVmIt x9qPVabvoX9ySets01sP20O98TYdbb/0yGFQVljOCjGU+X8iNMUvNt3ZHPpQWfIpTRI/ lmWSW/Y8T4rCm1yRjmDsAeiEUrZn6ROE+jQTlwJkMB+Zh1tPt+7a4Pd6qiGdLMEXHCn2 2PCv2gWGU+Nxt6FyVawBNPZTAapP+DlkssQLIz4wHLdsFwwQSSCaNN9X5WXP3hA98q4e mFRg== 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=Y+GJJ8Mmc0oeDh8hL6S+8Cpv35FkmxFr8XDckyJUa00=; b=W52QiQV5B/WHoD/bw9rYhr1Okzxg/ebmhow2mEY0K5GojNACV987vW1zj7BGZrD2Mi YFYgy3TpXQD86qw/Sj3CIsSxII9WrcyUPLQtvs8SrHa4upKaKrQgVMqUOUvOCQusao7n N8XM+sCgUeec7Aed80vY1yzaDiQe7WCYpXlW7k3LE1kRhyy4Kk4flahf3KQvzcWtmbZ3 V7UThPx1Dk+4S+8++VXvZ/kfUYb/Tayd9TwYwwIs1ut0iuFSDYDaY5NI4lGTWIgztrNe J9xYxP+OU/eRWpelCsp5CDu8Tc6dHtS9phfsl/5lZQjPQPzRL2j+6J4dmbw/Z4Gt3zLs sxEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VFSRp2KK; 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 k126-20020a633d84000000b0051f74820afdsi5454775pga.782.2023.06.05.04.29.45; Mon, 05 Jun 2023 04:29:59 -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=VFSRp2KK; 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 S231800AbjFELZS (ORCPT + 99 others); Mon, 5 Jun 2023 07:25:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231486AbjFELZO (ORCPT ); Mon, 5 Jun 2023 07:25:14 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 308A2B8 for ; Mon, 5 Jun 2023 04:24:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685964267; 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=Y+GJJ8Mmc0oeDh8hL6S+8Cpv35FkmxFr8XDckyJUa00=; b=VFSRp2KKiF7K03GkClz/0zkAy2xd8vHXYGzofz+uwxpNaa6cYHuvRBKBAKdlUyv4oI191W tjTvMd8/9bqndCMWGRDcrboz5H9a+r/42R80T57QCLiFunxvIcyH1Mx/iN2xbxa/nvcggG m4/zHnyNk+AFycIhJ1Shaufxx3UcSd0= Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-122-bOt7v3LHOrGiAhjyL4dQkg-1; Mon, 05 Jun 2023 07:24:26 -0400 X-MC-Unique: bOt7v3LHOrGiAhjyL4dQkg-1 Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-5343c1d114cso4445622a12.0 for ; Mon, 05 Jun 2023 04:24:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685964265; x=1688556265; 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=Y+GJJ8Mmc0oeDh8hL6S+8Cpv35FkmxFr8XDckyJUa00=; b=IbvMtCn2/H8ZX4gtLkIjzN9ocwZIGzccSoROS6Jsjdy4GipIgAbyfI4Wwt+Q/cljWl fsFdEThpZVToo2NVjMc6bU1d/SkuwVUhzScjkHP2R6AHkXTAyNea1DnD1ooFRtgx2EFd 2CkoxMj6q2kcoEd40wnf+Gxc1NP13czSOopIJj7UtAPA6e2Vt007x1UKnjSBCpKHd3he ICpmnYPdlrtbLJu8/s5tD+zMipqPz+Mud7C3Ov38/Bfo9VQ9wuRNfumcmpsCDVNVY/9I hNFXpYymPeVyD9TU8UGyoWo6xI6WW4PyWwx/gu3FHPhZOcOmslO+a7havtjQE79k26+n W0KA== X-Gm-Message-State: AC+VfDznwkO+/raRP54E9ZebmDgdvBEAUWb6XSUtsRs+J97hh/Mh04/2 /BQgGWUuqFHCoerbFMC7GML2RVBwaz53hri3RYtS5dqkInKowCqo9JEcR3KYZTKQOznYbLR5Vy9 VnS+vSCa6KW89HT2fDyZbajCYoPij5l2+/2fnEsjB X-Received: by 2002:a17:902:c1d4:b0:1b2:f8d:3ef5 with SMTP id c20-20020a170902c1d400b001b20f8d3ef5mr2192493plc.38.1685964265097; Mon, 05 Jun 2023 04:24:25 -0700 (PDT) X-Received: by 2002:a17:902:c1d4:b0:1b2:f8d:3ef5 with SMTP id c20-20020a170902c1d400b001b20f8d3ef5mr2192459plc.38.1685964264837; Mon, 05 Jun 2023 04:24:24 -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> <20230602173302.GA32644@redhat.com> In-Reply-To: <20230602173302.GA32644@redhat.com> From: Wander Lairson Costa Date: Mon, 5 Jun 2023 08:24:13 -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.1 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 Fri, Jun 2, 2023 at 2:34=E2=80=AFPM Oleg Nesterov wrot= e: > > On 06/01, Wander Lairson Costa wrote: > > > > On Thu, Jun 1, 2023 at 3:14=E2=80=AFPM Oleg Nesterov = wrote: > > > > > > > but only in the RT kernel > > > > > > this again suggests that your testing was wrong or I am totally confu= sed (quite > > > possible, I know nothing about RT). I did the testing without CONFIG_= PREEMPT_RT. > > > > > > > Hrm, could you please share your .config? > > Sure. I do not want to spam the list, I'll send you a private email. > Thanks. I found an unrelated earlier splat in the console code. That's why I couldn't reproduce it in the stock kernel. > Can you share your kernel module code? > *facepalm* I forgot to post the link: https://github.com/walac/test-prove-l= ock/ > Did you verify that debug_locks !=3D 0 as I asked in my previous email ? > > > > > 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 > > Cough ;) I think we need a more simple one to enssure that > refcount_sub_and_test(nr, &t->usage) returns true under raw_spin_lock() > and then __put_task_struct() actually takes spin_lock(). > > Oleg. >