From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796094861; b=obsDVY3TdXmvKMOOyBFGmcwtYbwvN1kYUbpRG3EwCzsuBNt1tA+6R0wR+J4MSUr1Sxx7 3reUBJhnFb3s/3yc9HhjPS7wTXn16xeIaA1qWr2klmDVTENhDn+IhRlWSgVLgsaebOQYK /Lc4cWEOkt8iWeRYt1jnQQ4XwFE480cK0P5HSqxhsu4EWTqiRKe4gyIcAJ2Miyg6+3ZIZ 2r9dsK9l3OUV4hMvuxDLDnK40WEbUDeZAqUiVIROxkzcWuxrbUeOHNVm9M+a3+LxxuUnk pIoiesWj/ISEh2BaoDXiH1F6FocnKGUUvP0EClPDGfVES4W6H1UJNQzrQ/Tf005Hv1w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796094861; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=jDjeRx/tS9HUJ3rgUrN4lgIQCx5uvXc77+rQF4wsEFw=; b=Julhwj/p78Qy+buTyiBi7guxvXmZ7exXZOvfBiOadYwTsvO7SYWSh8etcKgsJcz0T9ro q1jhp2qyEUPWAwyi7gyKKWbVqyz5cHCfdbpMJKUponTZU0eS/YyLwSB5zYX3wLnSUmkCa WRN5o7zQbZpt/JKSNzbs8gFdFeTqYlxXYOrqPmJkPTPr6AEZMMj6mCobFrwjBwnG8KR78 QAR+OLknvjcLhwhVdtfyokSDHAqdK67e+c4qKXoHS7nK/yzW/MOmTXvhkY8CtTJuAnhEH B4527o4/vGzgukCEyjCSY2DmW4RT2g2GurljBDP8u+psu1Hnsq9yCESRVE0cNiApE7g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=r7TWx0KG; arc=none smtp.remote-ip=209.85.214.172 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1B65606A31A for ; Tue, 1 Dec 2026 03:14:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C1B65606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=r7TWx0KG Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2f09190e85fso11504025ad.3 for ; Mon, 30 Nov 2026 19:14:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796094860; x=1796699660; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=jDjeRx/tS9HUJ3rgUrN4lgIQCx5uvXc77+rQF4wsEFw=; b=r7TWx0KGykuWBibs5zvC7KmTFZngxSV8cQ1XGByj4/8L//4k/qtPKA48gdnZSco7vx bHg2vC2hn3U4hoq1lWdqGdwq+lDseEvNqQPv6zemOeqy6+VTuSy0dG0jzq67/f1fgEST yi4XpGs4qH31f6d/mV1/Guqh/DRMH4RBbIN/+bGf6bOrVvZi9x509p0o8DXApu8f27+W rNfvM354Tf9Oqfk2wZaIgL7CdUcwju9ADcSdRLkWJzZJzBZqNsDEAdAWDfv2dK4vS5ac FvnyxgmCQn5Y3GbwqodLGnr9P0jKb0pC/RUMQh66nWvfvO70Q7NT4w8L2D//Hv7Vwvzp X9Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796094860; x=1796699660; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=jDjeRx/tS9HUJ3rgUrN4lgIQCx5uvXc77+rQF4wsEFw=; b=F68JGULXeLk9iHMVypKPsJ/zAJYokylo9QcsVxrmOCtSfVnlIQYbomjJF8dtEEqBDR IdR73eGXT04Tz36uzBjxTMhIxSEd6b9OZv9PeW/EGqVbhbbrrzdn7qrotY5KgJw0omPx qCYlNxupH+xpK14QC9MFA8Hko2WXS1bJuZej+z+mlDVJBVIuvkk9DUzdhw5GAyMh/VGa Jh90CeA1wyuWBq8Gy1Syr624LFFaxAiZhDloacGJ7IDGTmdGaSOYPBYwulCQRJrM+771 Zk9JCf9I7yijyrpTNetpfiYRZKGHETm89VqH9ipMUJHqdy2cq6SMujl/x3xUxsbHhfhK VDgg== X-Gm-Message-State: APuU4Z8ETDq3xplAY1yowCZXsurmarPluMZhR2oklbQbGiWNC7P1vsHw pFBwAdYEDLuq3wiQcc+Ms1Lma9yv9bApmREvlOEkTa1BpfOnrXUI0VI8 X-Gm-Gg: AZFdTZdFBmPVDfQnXFXwIDA7BWuGe8k9Wb9qSx2hBuQIWt9imbkpWa84s7vS3MqEUur 7NfoKhRirWzZVBj6Ukj7n6lnegO04w+lxLYPAl35ShjOJo2nFMh/YiwQ6abfqz8P1n0uCOS+zhE sYp2xZf1r4wM33k66C1caEvvcDOkZxhPe2BY1YV8zf1d7dAKUKWIo2RVpyHiT5sFi9UHqVqzsyE 7o3tAIfmyoHATmHLMUilV8rHBB1l61mIA24ke3gdCxnAuhduGk5u19vMhrE6qE0/rDlRyV0iH3n vtGhCqxBKaNSNHOKZoDL0WrWwbthPbQv67WpcMppOXvb6EFocN4/coMWPz9PZicUjujuys3TkJf EKVZYkHXfRod334O7ADU0yOtRMZPxztmOLNY3IKfMaQxRa9BF2wh36zsgaYy42o56sm0xqcmr9x IHmrpAwThdUc5Ec6GgO8paR+PiEPUvc79MIbJut4RsHogqe1W6zg2Y27jBtLVeIrcPi2mOEbX/g Xr0Vd2HwESFmfjQrlbuqlGOJE/jZGGQIHhfBV6yiplj+jnIxxzYAprKc8bVRrTDmTwqDZ8IjUjg BMJ0pK0Pfsquk7OxgM0ni+Z0Q5j9QzMdvpOtO581QE1cszkImA== X-Received: by 2002:a17:902:f70f:b0:2f0:3956:3a67 with SMTP id d9443c01a7336-2f03f113631mr587044435ad.1.1796094859977; Mon, 30 Nov 2026 19:14:19 -0800 (PST) Received: from security.datascience.hku.hk ([175.159.181.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2f03f0c1a74sm177594405ad.12.2026.11.30.19.14.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 19:14:19 -0800 (PST) From: Yu Junzhe To: Steffen Klassert , Herbert Xu , "David S. Miller" Cc: netdev@vger.kernel.org, ipsec@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [BUG] espintcp: slab UAF in espintcp_tx_work after espintcp_close Date: Tue, 1 Dec 2026 03:14:15 +0000 Message-ID: <20261201031415.194-1-junzheyu1@gmail.com> X-Mailer: git-send-email 2.43.0 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hello, I am reporting a slab use-after-free in espintcp_tx_work(). A TCP socket with the "espintcp" ULP can be closed while an ACK still schedules ctx->work after cancel_work_sync() in espintcp_close(), and espintcp_destruct() frees the context before the worker runs. Summary ======= espintcp_write_space() calls schedule_work(&ctx->work). espintcp_close() waits with cancel_work_sync() and then tcp_close() frees the context from espintcp_destruct(). cancel_work_sync() does not block later schedule_work() calls. On 6.6, a write-space callback from tcp_check_space() (for example while ksoftirqd processes an inbound segment right after cancel_work_sync() returns) can queue espintcp_tx_work() again. The worker then reads ctx->tx_running at espintcp.c:415 on freed kmalloc memory. Affected ======== - Originally observed: Linux 6.6.158 KASAN - Still vulnerable in source: 6.6.163, 6.1.193, 5.15.226 (cancel_work_sync in espintcp_close; no disable_work_sync) - Fixed in mainline: e1512c1db9e8 "espintcp: Fix race condition in espintcp_close()" (disable_work_sync); present on 7.4-rc5, 6.18.65, 6.12.119 - Config: CONFIG_INET_ESPINTCP=y, CONFIG_KASAN=y - Files: net/xfrm/espintcp.c Crash excerpt (campaign, Linux 6.6.158) ======================================= BUG: KASAN: slab-use-after-free in espintcp_tx_work+0x9f/0xb0 Read of size 1 by task kworker/1:1 Workqueue: events espintcp_tx_work Allocated: espintcp_init_sk via tcp_set_ulp Freed: espintcp_destruct during tcp_close / do_exit Last work creation: espintcp_write_space from tcp_check_space in tcp_rcv_established on ksoftirqd A self-contained Docker/QEMU PoC attaches TCP_ULP "espintcp" on loopback, keeps the peer sending while the client closes, and stresses the race. I can send the package or test a backport of e1512c1db9e8. Thanks, Yu Junzhe FuzzAnything