Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2546579rwd; Fri, 2 Jun 2023 10:53:04 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6rN22gDe/Y3sg7Ef5PCpz2LQxQhEdMw6ueggrg2/Uufawho1Kd9k2m47d9b3lebYUeXBiI X-Received: by 2002:a05:6a00:16c7:b0:64d:2487:5b20 with SMTP id l7-20020a056a0016c700b0064d24875b20mr12169042pfc.9.1685728384208; Fri, 02 Jun 2023 10:53:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685728384; cv=none; d=google.com; s=arc-20160816; b=RPi7IWQQg2SpCBR9F0Ahwu9NcY3t8k/2CpNB77ix20ZrgjM/0qrcrhxyLQjfwRJGyH zWOwgN4X88qRIziOrpjNmqO1YzBE0/pvrQqsjwrxh5/XV/vmKUJkMFX8KMBa2QmgBKgi 8r8isfInB0V+NGAqulTDD2y8nPccVh02mB8VNyVTYjTiGqLCBqDTEEU7zU+9Ydl5cLqA KtN2HQbjyJ+5h+eITlQbv2jVEK+3ZiL/gK5mHRQ2ahOTpUpvX+TfzyvYnm8n4xQxlc6T yMRhx2CrGwiB84K1iSUj7eVZCXoMGIKUUlXoCexsbkH3pavgI4Sx+G9UoVSEHiNmGmA0 Y8lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Wbtd2XCVq+/sFLE2jxa6+mJAIWTP4JlHCpeKfF2/aOU=; b=XgRFDvJQWnWnb6dEdwHXeZvBleMcbmf/77koouDEpf5J413CRCTd1jM0Q4l77vmly/ YK/BunFCKdF9ToD8/NsDrZwVNTACVsQr2mvvUZZiTBZysofSt9YFM0pTz9wWtmzg2cth UDXrp/RxrjQETgS6cU2cku3VfA6kQCxgsLWkJDCFyvhotsWXVMMqiOzd8NRfRhYiuqS8 k8WJISNgNfiZ4co+DjhFIcm7sTZ/XaRQgTvca210vEa26ttDTFj9uvVRYjTPSU2M/sd5 6+D6vHhcBC4DnUwoXKfiY3D+6AWQtrZ95Baj6Ud2DCbB7hd7Ouh6+UwhNyW4wtjSTc8c oEYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FL0FZSB8; 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 131-20020a630489000000b005369f4111aesi1285115pge.849.2023.06.02.10.52.52; Fri, 02 Jun 2023 10:53:04 -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=FL0FZSB8; 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 S236288AbjFBRlR (ORCPT + 99 others); Fri, 2 Jun 2023 13:41:17 -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 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 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.