Bug 2253034 (CVE-2023-6531)

Summary: CVE-2023-6531 kernel: GC's deletion of an SKB races with unix_stream_read_generic() leading to UAF
Product: [Other] Security Response Reporter: Rohit Keshri <rkeshri>
Component: vulnerabilityAssignee: Product Security <prodsec-ir-bot>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: acaringi, allarkin, bhu, chwhite, cye, cyin, dbohanno, debarbos, dfreiber, drow, dvlasenk, ezulian, fmaurer, hkrzesin, jarod, jburrell, jdenham, jfaracco, jforbes, jlelli, joe.lawrence, jshortt, jstancek, jwyatt, kcarcia, ldoskova, lgoncalv, lzampier, mleitner, mmilgram, mstowell, nmurray, ptalbert, rogbas, rparrazo, rrobaina, rvrbovsk, rysulliv, scweaver, security-response-team, sukulkar, tglozar, tyberry, vkumar, wcosta, williams, wmealing, ycote, ykopkova, zhijwang
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Kernel 6.7-rc5 Doc Type: If docs needed, set a value
Doc Text:
A use-after-free flaw was found in the Linux Kernel due to a race problem in the unix garbage collector's deletion of SKB races with unix_stream_read_generic() on the socket that the SKB is queued on.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2253033    

Description Rohit Keshri 2023-12-05 18:06:29 UTC
If the Unix GC's deletion of an SKB races with unix_stream_read_generic() on the socket that the SKB was queued up on, we get a race condition, leading to UAF, because it is supposed to be impossible to run these operations in parallel on the same socket:

 - unix_stream_read_generic() assumes that `mutex_lock(&u->iolock)` protects
   `sk->sk_receive_queue` against element removal, so it holds a pointer to an
   SKB on the `sk->sk_receive_queue` without any other protection
 - scan_inflight() only takes `spin_lock(&x->sk_receive_queue.lock)` when
   stealing SKBs from the `sk_receive_queue`

Comment 11 errata-xmlrpc 2024-04-30 10:14:23 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 9

Via RHSA-2024:2394 https://access.redhat.com/errata/RHSA-2024:2394