In the Linux kernel, the following vulnerability has been resolved:
afunix: Unlink sccentry in unixdeledge().
Kyle Zeng reported that GC could free a dead SCC partially.
The scenario is as follows:
1) Create two SCCs:
X -. A <-> B
^--'
2) Run the following concurrently:
2-1) send() sk-B to sk-B from sk-X
2-2) close() both A and B
At 2-1), there is a small window where unixaddedges() publishes a new edge (B <-> B) to GC but its skb is not queued by skbqueuetail().
If 2-2) completes before skbqueuetail() and GC is triggered, it judges A <-> B as dead, but B is not freed because GC cannot collect the not-yet-queued skb holding the B <-> B edge.
X -. A <-> B -. This edge is visible
^--' ^..' but skb is not
This itself is not a problem since the next GC run will judge B as dead as well and free it finally.
X -. A <.> B -.
^--' ^--'
However, X's SCC forces the next GC to call unixwalksccfast(), and it iterates over A through B's sccentry.
Let's unlink sccentry before freeing the vertex in unixdel_edge().