From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEBA5C7EE24 for ; Fri, 2 Jun 2023 17:41:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236945AbjFBRlS (ORCPT ); Fri, 2 Jun 2023 13:41:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235789AbjFBRlQ (ORCPT ); Fri, 2 Jun 2023 13:41:16 -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 341621B9 for ; Fri, 2 Jun 2023 10:40:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685727627; 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=Wbtd2XCVq+/sFLE2jxa6+mJAIWTP4JlHCpeKfF2/aOU=; b=FL0FZSB8o/TqIo7SPRvxchPKqz1PmRTQjBJ84FaRyK/FcwTe6zmcPKLh4IkVjlIz2o0HJW 2UMvKupEq9o55pUGJr1nrWlq6cZO6dO8S0VN2UYPVIWQ7DKux4Q4t+WVBfn1mhZ/nN6IwV DiqqrikJo5rEWvp9wAegp4Me3jMrrN0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-517-Y5BaPcR8NzKjlfIPcJuT6A-1; Fri, 02 Jun 2023 13:40:23 -0400 X-MC-Unique: Y5BaPcR8NzKjlfIPcJuT6A-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AF386800B35; Fri, 2 Jun 2023 17:40:22 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.50]) by smtp.corp.redhat.com (Postfix) with SMTP id C9F649E63; Fri, 2 Jun 2023 17:40:17 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Fri, 2 Jun 2023 19:40:01 +0200 (CEST) Date: Fri, 2 Jun 2023 19:39:56 +0200 From: Oleg Nesterov To: Wander Lairson Costa 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 Subject: Re: [PATCH v9] kernel/fork: beware of __put_task_struct calling context Message-ID: <20230602173955.GA555@redhat.com> References: <20230516191441.34377-1-wander@redhat.com> <20230517152632.GC1286@redhat.com> <20230529122256.GA588@redhat.com> <20230601181359.GA23852@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/01, Wander Lairson Costa wrote: > > On Thu, Jun 1, 2023 at 3:14 PM Oleg Nesterov wrote: > > > > > 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_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. Can you share your kernel module code? Did you verify that debug_locks != 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 something more simple to ensure that refcount_sub_and_test(nr, &t->usage) returns true under raw_spin_lock() and then __put_task_struct() actually takes spin_lock(). Oleg.