Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp88299lqp; Fri, 12 Apr 2024 11:12:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+p6LaaN7W/xZs9M8Jc3Cd8EMFZ5rQO6dOZGsDsGYN5SIQdaPGHbSeleN0ZpnOcmbNKhYeDZTH/Cg5snqPdUfW5L3G+0A/mREm6MBcdw== X-Google-Smtp-Source: AGHT+IHOWEhR5nKiswq1uIu8sJBU/kigWedHyNOjvidYRpoUR+cJKw2YuN2DvvVFwFGMt81JFLUM X-Received: by 2002:a17:90a:7781:b0:29d:fe34:fa16 with SMTP id v1-20020a17090a778100b0029dfe34fa16mr3327137pjk.21.1712945545069; Fri, 12 Apr 2024 11:12:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712945545; cv=pass; d=google.com; s=arc-20160816; b=tyMcKpmPjhQfj8okLnJ9gUSOiaeRapLfqackuUugjLbUN3cxTRdyvoVkvcFtJ/8OuH 4Z9l7MI5Cl11cc1FBm+sUrrXO35ZjcmJEe0q6sDcKpUyNr+8zmHO5Ui1PJvtfilSIn7t hTmTVZ7ma1ZtI/mXL8f4k5+MJOyvpIgVURlulv25RdIf005LikYxbvk278nqZxndn5Y6 1MPIT0cwQNZLvAq4HVL+vpafJoiGXx54lxRhMQMEvSxXDcoV/es04cKNteTi5TSnh9Nb BsrDlRKM2c0Nf3CGmv/ABrTkazKmdfuRgplbBeeHS+0N8HDeiKdIBGAIVAtGBPOta+aZ A0bw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date; bh=0oEANJDjBqS5De4OXji7Am3D446SagnE7xTPx3iEUDw=; fh=mE7cUi3ALscNaUUUHIFVQYucggOw98/ymECRP6eTmSU=; b=BvjbM1ps7I+Zd8znGUZoBtSkwlHiUhWA9264Z2SBH5u0ZHrbMtjpunIP3cPpYU54CM daKapJwCE5VMkghaTpx6zFlM5LJhAdmyliBvCdA6R4TlkA4hz/zf9dSj/YHJ8eeVoV6z 3sQCD3U0qD41Iw6Njmq2O9ILNxV4M03K0YcpA4l7p0ZUas6ER2Wkb+nd1EKx1OfdAC9l uI1lwfsWFhXKx3rsKXGtTkxr644Rpk41yHLbnz/tF+f8ENOqL0OwYuxaN+4ZiefA/jeb uel1QVWyADU9CPvXGyrCBJeRJM6BjLufSM9KmSx2siEm6hJlNZm51AXkFOsJ3Ar1JgVi DjtA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=netrider.rowland.org); spf=pass (google.com: domain of linux-kernel+bounces-143182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143182-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id gt16-20020a17090af2d000b002a25f744524si3691909pjb.185.2024.04.12.11.12.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 11:12:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=netrider.rowland.org); spf=pass (google.com: domain of linux-kernel+bounces-143182-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143182-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 36273284271 for ; Fri, 12 Apr 2024 18:12:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4127114EC5A; Fri, 12 Apr 2024 18:11:59 +0000 (UTC) Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by smtp.subspace.kernel.org (Postfix) with SMTP id AC62A14D6FD for ; Fri, 12 Apr 2024 18:11:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.131.102.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712945518; cv=none; b=VtUWIWJ9Hn3YFzh82uGXd1Vt9JaqiQBTzVOid0Yuauq1qdv8oR/m6Ohaf2f4pJSxnB4Octmxfz6QT3IZd6z88/o0EhzTtzR5O7pYx/IV9aIiv7lhAjtSFzxGnYpXN56IoEM20pv+8hoiC6/P8rp8ME/Ab4ibJ9FzfRlHGnCxqAk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712945518; c=relaxed/simple; bh=/VIpVejDThBXlmlTl+/jXMBsg9l38y+XANkevrDIb2g=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LiwJgDv5vYoM3IYPawTOcCzUeecBBtEmN8S+naoW4hrbVVlXBIVU/2FsU0uLsX/qHK6OI8fIqP+f+rD0ohrixO4VK2cpVFIwcHUHsmOHq1aVtRgSb405wFOFz5CWJd3xhiHHhoCCv0fF7P7X49oBoMfgrURTCGoP4GWl3VXOd4M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=rowland.harvard.edu; spf=pass smtp.mailfrom=netrider.rowland.org; arc=none smtp.client-ip=192.131.102.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=rowland.harvard.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=netrider.rowland.org Received: (qmail 44530 invoked by uid 1000); 12 Apr 2024 14:11:49 -0400 Date: Fri, 12 Apr 2024 14:11:49 -0400 From: Alan Stern To: Sam Sun Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Greg KH , swboyd@chromium.org, ricardo@marliere.net, hkallweit1@gmail.com, heikki.krogerus@linux.intel.com, mathias.nyman@linux.intel.com, royluo@google.com, syzkaller-bugs@googlegroups.com, xrivendell7@gmail.com Subject: Re: [Linux kernel bug] general protection fault in disable_store Message-ID: <69a6f4c9-6470-40d1-99f1-aaf532497d02@rowland.harvard.edu> References: <92fe8e95-bc01-4d7d-9678-8cfc55cc4a7b@rowland.harvard.edu> <45e246ab-01e8-40b7-8ede-b47957df0d7b@rowland.harvard.edu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Sat, Apr 13, 2024 at 12:26:07AM +0800, Sam Sun wrote: > On Fri, Apr 12, 2024 at 10:40 PM Alan Stern wrote: > > I suspect the usb_hub_to_struct_hub() call is racing with the > > spinlock-protected region in hub_disconnect() (in hub.c). > > > > > If there is any other thing I could help, please let me know. > > > > Try the patch below. It should eliminate that race, which hopefully > > will fix the problem. > I applied this patch and tried to execute several times, no more > kernel core dump in my environment. I think this bug is fixed by the > patch. But I do have one more question about it. Since it is a data > race bug, it has reproducibility issues originally. How can I confirm > if a racy bug is fixed by test? This kind of bug might still have a > race window but is harder to trigger. Just curious, not for this > patch. I think this patch eliminates the racy window. If you don't what what is racing, then testing cannot prove that a race is eliminated. However, if you do know where a race occurs then it's easy to see how mutual exclusion can prevent the race from happening. In this case the bug might have had a different cause, something other than a race between usb_hub_to_struct_hub() and hub_disconnect(). If that's so then testing this patch would not be a definite proof that the bug is gone. But if that race _is_ the cause of the bug then this patch will fix it -- you can see that just by reading the code with no need for testing. Besides, the patch is needed in any case because that race certainly _can_ occur. And maybe not only on this pathway. May I add your "Reported-and-tested-by:" to the patch? Alan Stern