lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFRLqsVj28niHO9XejYrMu2g3fCrDXXgArshP-kr4CM=eV2smQ@mail.gmail.com>
Date: Sat, 13 Sep 2025 10:16:19 +0800
From: cen zhang <zzzccc427@...il.com>
To: Luiz Augusto von Dentz <luiz.dentz@...il.com>
Cc: johan.hedberg@...il.com, marcel@...tmann.org, linux-kernel@...r.kernel.org, 
	baijiaju1990@...il.com, zhenghaoran154@...il.com, r33s3n6@...il.com, 
	linux-bluetooth@...r.kernel.org, "gality369@...il.com" <gality369@...il.com>
Subject: Re: [BUG]: slab-use-after-free Read in mgmt_set_powered_complete

Hi Luiz,

Thanks for your patch! It not only addresses the TOCTOU issue we
discussed but may also fix another bug I reported
(https://lore.kernel.org/linux-bluetooth/CAFRLqsWWMnrZ6y8MUMUSK=tmAb3r8_jfSwqforOoR8_-=XgX7g@mail.gmail.com/T/#u).

I will test it soon to confirm.

Thanks again for the great work.

Best regards,

Cen Zhang

Luiz Augusto von Dentz <luiz.dentz@...il.com> 于2025年9月13日周六 02:29写道:
>
> Hi Cen,
>
> On Fri, Sep 12, 2025 at 11:59 AM cen zhang <zzzccc427@...il.com> wrote:
> >
> > Hi Luiz,
> >
> > Thank you for your quick response and the important clarification
> > about hci_cmd_sync_dequeue().
> >
> > You are absolutely correct - I was indeed referring to the TOCTOU
> > problem in pending_find(), not the -ECANCELED check. The
> > hci_cmd_sync_dequeue() call in cmd_complete_rsp() is a crucial detail
> > that I initially overlooked in my analysis.
> >
> > After examining the code more carefully, I can see that while
> > hci_cmd_sync_dequeue() does attempt to remove pending sync commands
> > from the queue, but it cannot prevent the race condition we're seeing.
> > The fundamental issue is that hci_cmd_sync_dequeue() can only remove
> > work items that are still queued, but cannot stop work items that are
> > already executing or about to execute their completion callbacks.
> >
> > The race window occurs when:
> > 1. mgmt_set_powered_complete() is about to execute (work item has been dequeued)
> > 2. mgmt_index_removed() -> mgmt_pending_foreach() -> cmd_complete_rsp() executes
> > 3. hci_cmd_sync_dequeue() removes queued items but cannot affect the
> > already-running callback
> > 4. mgmt_pending_free() frees the cmd object
> > 5. mgmt_set_powered_complete() still executes and accesses freed cmd->param
> >
> > I am sorry that I haven't get a reliable reproducer from syzkaller for
> > this bug may be due to it is timing-sensitive.
>
> Let's try to fix all instances then, since apparently there is more
> than one cmd with this pattern, please test with the attached patch.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ