From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.53 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795122693; b=TayvccP2vZetHLJcVQ8cHIhGrKxD2p6BtbMiSviWevIZa4r8sYmE0YkkyDdYxVxl1iwD p0ty0HjMFxECBPKkB32HXaDWHpOFwxEuqZ4DMcMxJfSoV8lAPCrUDTduH6awfm2Y7avSl z7LkHNpQ6q12FmERzdtuKuQcm5PSXk03c0eV38iCFfUN5z7kU8FLD7QBh1FEa0as1F4G2 Ma837ERlM87bIECi85sGYBHxhFr6I02EtLuLxciwO7fMjN3J7TUqe2/HZ4PIrHLyJVyEu quwgDretbqr5ZGGggkR4MDNreecgt2DP1wo3750CjNY2HqmeB3mAL/E+CZ3tPjmmUzg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795122693; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=c/FxpSNP1KOyGBvVMF7iGpNqA3mgfV1zD60Qg+NCmX4=; b=xNdUUjw3fOnNNKownMsoT0MLGxK0/QCPAxGtDqRhhjv8FmFDedbgq0j9Ygu88EOAM2AH jixAuKP0R+jpTBCFh2lVvZ09bYLEgt86dyGiWFVgQ6QmY2gXPDOYMzyeyhXKPcazhqfCy ZX9fz39ykIdttKXQxyeZY6UkN4kNEFR0rxINgfRt/ZviP8HFmC8sMJVt8PAX6QJMbFudS BkgMKvVppM1Ypxb8YQQnT8OtzbIWlEugg7Go+EFBbfVm+b3VyvE5P7lYQ6W8dBfYCDiMM xPS4qryM4T+kcFu8ivYo5wNwlhvwxN0H3PCv6XwoNCr1chP5ITNfZOyiPzK8BTcc1qw== 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="nQj/AXSB"; arc=none smtp.remote-ip=209.85.219.53 Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) (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 5F17A606A32C for ; Thu, 19 Nov 2026 21:11:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5F17A606A32C 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=nQj/AXSB Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-91eb46044c4so3406516d6.1 for ; Thu, 19 Nov 2026 13:11:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795122691; x=1795727491; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:subject :references:in-reply-to:message-id:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to:content-type; bh=c/FxpSNP1KOyGBvVMF7iGpNqA3mgfV1zD60Qg+NCmX4=; b=nQj/AXSBMlx3clfcBQYldrA8gxX7muuq67ouf7ZjWPp6biVchiONrwmhAPyu788R5+ 3983SrhAoAPloXSo0/meDJambBmtNzapvYoJzcGEMahLu7e8SlBSxoqxTQASYl+QCMdY EIaeQmMefl5CHGg7wRPaUKFnUdL1J6BuKySvlGRwdt3zQQl9nWrJFm/bl5UEZRXeWkq5 AjsZ3stbPf7pNmaPsT57km434hskkTs5ni9q5nsQ+LQJDPFcKRcC5Rw+nBQNudu3Wtmh /fdzwUEaGLLspP8oUeGqCey8uGyYLNDvW3wYlrI9YLxNC/dbkPgKyOWrlnvALjKm/Qcg m7nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795122691; x=1795727491; h=content-transfer-encoding:content-type:mime-version:subject :references:in-reply-to:message-id:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=c/FxpSNP1KOyGBvVMF7iGpNqA3mgfV1zD60Qg+NCmX4=; b=Yk2/ttuBDVCbe/pc84jbXpBkOHybbK38AhaNH/jSelCS9ZxKePnY5eTqNVP0VIP7kv Isfqy/0N8NY4pjjHMx7c7BvorQpNPmsf8ykEVEhOduBfaeUAeSaxHPGjyE5vkxPLWbku mK7gNrRq+atpDuIlgqwGWFaO9hVri/TWXpIaI5NaWyJ76Pg6a0UwyRrptbH8GWw37eKZ AB93vBwQHeHc57NRBQ+164PDcK8kaIfjqUOGjP2hN3kovJ7n2ti2cWQb3V5U/Fi2/2b7 z29+TAv/cPOWJxwUcIZaNOZMHsXxiqYGey4Mj3VKyY1vfKNz89+7wjhO8Y/gYWeGTBsW SbBg== X-Forwarded-Encrypted: i=1; AL+hErG23fXVcKOAx5DLvbVfLihGWOaBtc1441DN71FWyGsnNajszXSztxU8kNivlAx7KDYqi+JMBfM=@vger.kernel.org X-Gm-Message-State: APuU4Z+9NZzpgiWtORd48CPvjxPJT+iqw9C6xiV3U62SbBmASHv9qorM ui+q8F2gG8C2GjO5K20KDrMgTWfryL24owdQpPkE9Z9SlWsnemp7cAQe X-Gm-Gg: AZFdTZfS2kAi/UVAhk1wcQp1jeNaQPyFjSMOIG0YMZRdyl+49fMeLywFsfn00ovL2bY B6N2wPEYGf/vuQe973ZzbgOGrQFTVMUYeUWfpOuhBu9wbmIvMMFzJRlpSgigInMyhQ0LFaOVHcP Mk+zG1aIGUiQpBpSYyQpQS/rV4TOp7Xyxh3bkpnn7CUVkftTf2Vb6r4wVCcIqBf1rmusP8BeEYv ptwoOvUXTc3+7qWcLvQgV1QSGUnfJ0+le2hR2S94q0kNwRKPVdwTAp74N0lpgw38EjkIMeQnifJ aou5+xXNZ9ierybTeooA74BidFXXw9NnVLIPJ6WtnsaSRzMZ0lXaC1VxpwxZoEwelgJEOVAZc9b kJftjHliRETouHf4U8EVxOGVCLg0wsp6gpp2gvso7cN0oiH5PmILKMy9Nwlj+54n0mWLYXE8IVT 8XEO1VVyM+k9I0c+hIIb3xstVt2Jl8zfafliXgg7vpRDSvjkOnvJTwPI00sdpBEX8AR5xljbQBf yEyrJbw2pttEA6kyfrkCx11yNFJNbuXEIct6ls2tg5ItezmFD5dLmwTGQ6kys81oC2fPlkBAhgk 27ta+7Pa7xEb7D9+UdTqhnUDREyUKtuwRw1MCFvxe7RsCQ6ZnyzAXXaNplczC1X67vQjzj0b5tZ AgLtyCgsUT/LfB1DR5CioV3AWwte2XTw5Q/s/z2eszgh5mWl5INzcKuEdI3rg4Xo= X-Received: by 2002:a05:6214:5294:b0:921:b6f:e3ca with SMTP id 6a1803df08f44-9213498a6f9mr17532256d6.3.1795122691261; Thu, 19 Nov 2026 13:11:31 -0800 (PST) Received: from gmail.com (15.60.86.34.bc.googleusercontent.com. [34.86.60.15]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-92134bf848dsm7227906d6.44.2026.11.19.13.11.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2026 13:11:30 -0800 (PST) Date: Thu, 19 Nov 2026 16:11:29 -0500 From: Willem de Bruijn To: Junyoung Jang , Willem de Bruijn , Jason Wang , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Junyoung Jang , Simon Horman , Shuah Khan , Gwanhyun Lee , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Message-ID: In-Reply-To: <20261119144241.360238-3-graypanda.inzag@gmail.com> References: <20261119144241.360238-1-graypanda.inzag@gmail.com> <20261119144241.360238-3-graypanda.inzag@gmail.com> Subject: Re: [PATCH net v3 2/4] tap: clamp zero-copy copylen to remaining payload length 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-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Junyoung Jang wrote: > tap_get_user() chooses GOODCOPY_LEN when the virtio hdr_len is zero, > without limiting it to the payload remaining after the virtio header. > A 246-byte padded header and a 14-byte Ethernet frame give vhost-net a > 260-byte TX descriptor, above its 256-byte zero-copy threshold. The > 128-byte skb head then contains only 14 copied bytes; the rest can be > transmitted as stale kernel heap contents. > > The original macvtap zero-copy support introduced the copylen choice. > Commit bab632d69ee4 ("vhost: vhost TX zero-copy support") connected > the in-tree vhost-net caller, so this case predates the v6.15 header > validation regression. > > Clamp copylen to the remaining payload before allocating the skb. This > also covers cases where the entire frame fits in the skb's linear area. > > An AI-assisted code review found this issue. An x86-64 QEMU/vhost-net > reproducer observed a 128-byte frame from 14 input bytes, including a > 114-byte uncopied tail. The patched kernel delivered 14 bytes in the > same test and in 400 repeated short-frame sends. If respinning: tun/tap's vnet_hdr_sz must be at least ~129. That is far larger than any header vhost would negotiate, so it only happens when the VMM sets vnet_hdr_sz inconsistently with the vhost features. The guest controls the packet contents but not vnet_hdr_sz, so a guest can't trigger this on its own against a sane VMM. > Fixes: 97bc3633bec7 ("macvtap: macvtapTX zero-copy support") > Co-developed-by: Gwanhyun Lee > Signed-off-by: Gwanhyun Lee > Signed-off-by: Junyoung Jang Reviewed-by: Willem de Bruijn