In the Linux kernel, the following vulnerability has been resolved: tcp/dccp: Don't use timerpending() in reqskqueueunlink(). Martin KaFai Lau reported use-after-free [0] in reqsktimerhandler(). """ We are seeing a use-after-free from a bpf prog attached to tracetcpretransmitsynack. The program passes the req->sk to the bpfskstoragegettracing kernel helper which does check for null before using it. """ The commit 83fccfc3940c ("inet: fix potential deadlock in reqskqueueunlink()") added timerpending() in reqskqueueunlink() not to call deltimersync() from reqsktimerhandler(), but it introduced a small race window. Before the timer is called, expiretimers() calls detachtimer(timer, true) to clear timer->entry.pprev and marks it as not pending. If reqskqueueunlink() checks timerpending() just after expiretimers() calls detachtimer(), TCP will miss deltimersync(); the reqsk timer will continue running and send multiple SYN+ACKs until it expires. The reported UAF could happen if req->sk is close()d earlier than the timer expiration, which is 63s by default. The scenario would be 1. inetcskcompletehashdance() calls inetcskreqskqueuedrop(), but deltimersync() is missed 2. reqsk timer is executed and scheduled again 3. req->sk is accept()ed and reqskput() decrements rskrefcnt, but reqsk timer still has another one, and inetcskaccept() does not clear req->sk for non-TFO sockets 4. sk is close()d 5. reqsk timer is executed again, and BPF touches req->sk Let's not use timerpending() by passing the caller context to _inetcskreqskqueuedrop(). Note that reqsk timer is pinned, so the issue does not happen in most use cases. [1] [0] BUG: KFENCE: use-after-free read in bpfskstoragegettracing+0x2e/0x1b0 Use-after-free read at 0x00000000a891fb3a (in kfence-#1): bpfskstoragegettracing+0x2e/0x1b0 bpfprog5ea3e95db6da0438tcpretransmitsynack+0x1d20/0x1dda bpftracerun2+0x4c/0xc0 tcprtxsynack+0xf9/0x100 reqsktimerhandler+0xda/0x3d0 runtimersoftirq+0x292/0x8a0 irqexitrcu+0xf5/0x320 sysvecapictimerinterrupt+0x6d/0x80 asmsysvecapictimerinterrupt+0x16/0x20 intelidleirq+0x5a/0xa0 cpuidleenterstate+0x94/0x273 cpustartupentry+0x15e/0x260 startsecondary+0x8a/0x90 secondarystartup64noverify+0xfa/0xfb kfence-#1: 0x00000000a72cc7b6-0x00000000d97616d9, size=2376, cache=TCPv6 allocated by task 0 on cpu 9 at 260507.901592s: skprotalloc+0x35/0x140 skclonelock+0x1f/0x3f0 inetcskclonelock+0x15/0x160 tcpcreateopenreqchild+0x1f/0x410 tcpv6synrecvsock+0x1da/0x700 tcpcheckreq+0x1fb/0x510 tcpv6rcv+0x98b/0x1420 ipv6listrcv+0x2258/0x26e0 napicompletedone+0x5b1/0x2990 mlx5enapipoll+0x2ae/0x8d0 netrxaction+0x13e/0x590 irqexitrcu+0xf5/0x320 commoninterrupt+0x80/0x90 asmcommoninterrupt+0x22/0x40 cpuidleenterstate+0xfb/0x273 cpustartupentry+0x15e/0x260 startsecondary+0x8a/0x90 secondarystartup64noverify+0xfa/0xfb freed by task 0 on cpu 9 at 260507.927527s: rcucoresi+0x4ff/0xf10 irqexitrcu+0xf5/0x320 sysvecapictimerinterrupt+0x6d/0x80 asmsysvecapictimerinterrupt+0x16/0x20 cpuidleenterstate+0xfb/0x273 cpustartupentry+0x15e/0x260 startsecondary+0x8a/0x90 secondarystartup64noverify+0xfa/0xfb
{ "availability": "No subscription required", "ubuntu_priority": "medium", "binaries": [ { "binary_version": "3.11.0-12.19", "binary_name": "block-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "block-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "crypto-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "crypto-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "fat-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "fat-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "fb-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "firewire-core-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "floppy-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "fs-core-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "fs-core-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "fs-secondary-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "fs-secondary-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "input-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "input-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "ipmi-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "ipmi-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "irda-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "irda-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "kernel-image-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "kernel-image-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "linux-doc" }, { "binary_version": "3.11.0-12.19", "binary_name": "linux-headers-3.11.0-12" }, { "binary_version": "3.11.0-12.19", "binary_name": "linux-headers-3.11.0-12-generic" }, { "binary_version": "3.11.0-12.19", "binary_name": "linux-headers-3.11.0-12-generic-lpae" }, { "binary_version": "3.11.0-12.19", "binary_name": "linux-image-3.11.0-12-generic" }, { "binary_version": "3.11.0-12.19", "binary_name": "linux-image-3.11.0-12-generic-lpae" }, { "binary_version": "3.11.0-12.19", "binary_name": "linux-image-extra-3.11.0-12-generic" }, { "binary_version": "3.11.0-12.19", "binary_name": "linux-libc-dev" }, { "binary_version": "3.11.0-12.19", "binary_name": "linux-source-3.11.0" }, { "binary_version": "3.11.0-12.19", "binary_name": "linux-tools-3.11.0-12" }, { "binary_version": "3.11.0-12.19", "binary_name": "linux-tools-3.11.0-12-generic" }, { "binary_version": "3.11.0-12.19", "binary_name": "linux-tools-3.11.0-12-generic-lpae" }, { "binary_version": "3.11.0-12.19", "binary_name": "linux-tools-common" }, { "binary_version": "3.11.0-12.19", "binary_name": "linux-udebs-generic" }, { "binary_version": "3.11.0-12.19", "binary_name": "linux-udebs-generic-lpae" }, { "binary_version": "3.11.0-12.19", "binary_name": "md-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "md-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "message-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "mouse-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "mouse-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "multipath-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "multipath-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "nfs-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "nfs-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "nic-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "nic-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "nic-pcmcia-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "nic-shared-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "nic-shared-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "nic-usb-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "nic-usb-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "parport-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "parport-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "pata-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "pcmcia-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "pcmcia-storage-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "plip-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "plip-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "ppp-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "ppp-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "sata-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "sata-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "scsi-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "scsi-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "serial-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "speakup-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "speakup-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "squashfs-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "squashfs-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "storage-core-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "storage-core-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "usb-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "usb-modules-3.11.0-12-generic-lpae-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "virtio-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "vlan-modules-3.11.0-12-generic-di" }, { "binary_version": "3.11.0-12.19", "binary_name": "vlan-modules-3.11.0-12-generic-lpae-di" } ] }