All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Sam Sun <samsun1006219@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	Greg KH <gregkh@linuxfoundation.org>,
	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
Date: Fri, 12 Apr 2024 14:11:49 -0400	[thread overview]
Message-ID: <69a6f4c9-6470-40d1-99f1-aaf532497d02@rowland.harvard.edu> (raw)
In-Reply-To: <CAEkJfYMjO+vMBGPcaLa51gjeKxFAJBrSa0t_iJUtauQD3DaK8w@mail.gmail.com>

On Sat, Apr 13, 2024 at 12:26:07AM +0800, Sam Sun wrote:
> On Fri, Apr 12, 2024 at 10:40 PM Alan Stern <stern@rowland.harvard.edu> 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

  reply	other threads:[~2024-04-12 18:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-11  6:52 [Linux kernel bug] general protection fault in disable_store Sam Sun
2024-04-11  6:58 ` Greg KH
2024-04-11  7:19   ` Sam Sun
2024-04-11 15:24 ` Alan Stern
2024-04-12 13:08   ` Sam Sun
2024-04-12 14:40     ` Alan Stern
2024-04-12 16:26       ` Sam Sun
2024-04-12 18:11         ` Alan Stern [this message]
2024-04-12 18:32           ` Alan Stern
2024-04-13  5:08           ` Sam Sun
2024-04-15 14:47             ` Alan Stern
2024-04-16  9:05               ` Sam Sun
2024-04-16 16:35                 ` Alan Stern
2024-04-17  7:39                   ` Sam Sun
2024-04-17 14:23                     ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=69a6f4c9-6470-40d1-99f1-aaf532497d02@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=ricardo@marliere.net \
    --cc=royluo@google.com \
    --cc=samsun1006219@gmail.com \
    --cc=swboyd@chromium.org \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=xrivendell7@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.