From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796515662; b=YjCR4ikBXlcjayx53VecbHNtI9egy0sxLqCPDIeX/dxONeLrYY7+qCkUQlaqgpH7Cn1J jsTrm4q0yc02dxoUnK6f3qlnAdmz2Q1KKxkXqG9kjX7LxUJ+Qu6BLmbwhOBMgOsKl5RLz txdZwo1/7b3Wr8khURJEqh6DricjdG+ZvhgTN/LmJkpsjz0WpK8sTLuOCyiF3BEUYYugf YbcpM9nQBvuejp5nBCeB/Nl87lSus7diwvyBnzb140oGVmEd7KQP/Agp7Dth+A7zQPn1n e4JBgMbe7IbWhyZ52TFWofRV6a9WxmHCjjhH7mPdnuWksB+xeLGEDM9UBFt3VqGuZRA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796515662; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=IoULUEIeopIiXjerg/UhmxVN08W2QRQ+GdkyXWisfDM=; b=uMAXk2PC64Jgkc5JBGxQry70h3AbfNQAxoBm0ZVD7ccE4LfLCc7R5F7qSWMEnQllVM+o x22fTKVlGO7xUqQfg+nPesI51Imp3IdS32GryNm44XYpgMZ8gHMdkqvGEQvSydbjz4gjL 8YWVw3zD6ab/RLhLhcnUZ3XICBkQJkeC7CvFCfnBGumHdgVCokJUPQbzT5f+piHkfJLKM 7Q60d6DIolH3n2SQAwHFC7CpNnusoLmAg3AOz70kt7l+G3fkANsuaq8nOUYhBWTM3504p kUB8LzAjpVaa4A7iOP421CdFCxq1xPFgivIhLsvkhMJJ6u9c1m417/FZZFQgBjSpW0g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WaamGbfZ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B63DF606A31F; Sun, 6 Dec 2026 00:07:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WaamGbfZ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D6DB1F0092B; Sun, 6 Dec 2026 00:07:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796515662; bh=IoULUEIeopIiXjerg/UhmxVN08W2QRQ+GdkyXWisfDM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=WaamGbfZ3vNlM1Sj1VZ5xwCxoceiFEcEAuEp4MauX7h/IN4cfzRXO3kXBbEIyLhEG j1UWvni2Cl1Q8TVy8RkxqRUmDZi1wjX2P9IzJjhA7Vk9uxPZ1sacb472jkbHTh7FXW g3zcbCdPbCXq9fR0Nkk4qzl6UFeqyKTosFIhtcA3OV2HnPTodMj9h8/PevhdrDt5H5 bKjwjnQdXzk6eBiS1so/lxzsBAFgSsZRo6IgDd0gKPR5arMuWD/YOrssUSkNDhYajd Dtx+lzFYpll0svl5vmNIIOTbkxLRM0s6v75C6w7Q793FtEakjyny74Y+SNl0a7OZMP TeF6/kYvALzUw== Subject: Re: [PATCH net-next v5 3/6] net: devmem: resolve leased RX queues to physical device on bind From: netdev-bot+sashiko@kernel.org To: almasrymina@google.com Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com, horms@kernel.org, shuah@kernel.org, linux-kselftest@vger.kernel.org, sdf.kernel@gmail.com, bobbyeshleman@meta.com, razor@blackwall.org, daniel@iogearbox.net, dw@davidwei.uk, asml.silence@gmail.com, axboe@kernel.dk, bestswngs@gmail.com, io-uring@vger.kernel.org, hawk@kernel.org, ilias.apalodimas@linaro.org Date: Sun, 06 Dec 2026 00:07:40 +0000 Message-ID: <179651566095.3148.8405401259463150987@kernel.org> In-Reply-To: <20261204231030.3815575-4-almasrymina@google.com> References: <20261204231030.3815575-4-almasrymina@google.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] Commit "net: devmem: resolve leased RX queues to physical device on bind" fixes a memory-safety bug in leased-queue devmem RX teardown,… -- net: devmem: resolve leased RX queues to physical device on bind At bind-rx time, this commit resolves leased RX queues to the physical net_device and its physical rx_queue indices. It holds netdev_lock(virt_dev) and then netdev_lock(phys_dev) across the DMA device lookup, the dmabuf mapping and the queue opens. phys_dev and phys_rxq are stored in the binding so that teardown paths serialize on the physical device lock. The rxq->mp_params clearing moves into __netif_mp_uninstall_rxq(). > - When the physical device unregisters first, > dev_memory_provider_uninstall(phys_dev) passes phys_rxq to > mp_dmabuf_devmem_uninstall(), which searches binding->bound_rxqs for > virt_rxq, fails to match, and leaves the dmabuf mapped. [ ... ] > These issues were identified by code inspection and selftest development > while extending devmem unregister teardown to leased queues; they have not > been observed in production or tested on real hardware. Verified with > netdevsim and netkit selftests in nl_netdev.py and nk_qlease.py. [Severity: Low] Does "leaves the dmabuf mapped" cover the full consequence here? And should this patch carry Fixes: tags? Before this patch, when the physical device unregisters first, the cascaded unlease path is the one that matches virt_rxq: netif_rxq_cleanup_unlease(phys_rxq, virt_rxq) __netif_mp_uninstall_rxq(virt_rxq, &p) mp_dmabuf_devmem_uninstall(binding, virt_rxq) That call empties bound_rxqs and clears binding->dev. It skips the unmap because virt_rxq->lease is still set: if (xa_empty(&binding->bound_rxqs)) { if (!rxq->lease) net_devmem_dmabuf_binding_unmap(binding); ASSERT_EXCLUSIVE_WRITER(binding->dev); WRITE_ONCE(binding->dev, NULL); } net_devmem_dev_unregister() does not unmap it either. binding->dev does not match phys_dev, and the leasee device is skipped. So the dma_buf attachment stays mapped while the physical dma_dev is freed. When the netlink socket is closed later, this call chain would run against the freed device: __net_devmem_dmabuf_binding_free()->dma_buf_unmap_attachment() This looks like the same slab-use-after-free in dma_unmap_sg_attrs() that KASAN caught in commit c4466d2c3e77 ("net: devmem: unmap dma_buf synchronously on queue uninstall"). Could the commit message describe this as a use-after-free rather than a mapping leak? Tags like these would also let stable trees that carry the queue lease support pick it up: Fixes: 5602ad61ebee ("net: Proxy netif_mp_{open,close}_rxq for leased queues") Fixes: c4466d2c3e77 ("net: devmem: unmap dma_buf synchronously on queue uninstall") -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204231030.3815575-1-almasrymina%40google.com