From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E252026AA91 for ; Mon, 30 Mar 2026 05:20:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774848057; cv=none; b=ooGYmdN3oYGsDjO0KFctzRHWNVmi/m0SO/RWBvGMTajmWKapC1uO5uO+EdpKlbswfqtOwdrdUVA11nRUt/rEX937OJ0e7aH3FN7ff/tapavAc4OG9g7fnnUsT1u1S9cwcnXl8yQwnlScRExyqP1MeQmG6/y9BPsL77m0tXn0nFE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774848057; c=relaxed/simple; bh=0d0naRcIv9z63yxPLsdCSjk0pr783O3WgjjGnMocXio=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=PBP3Mm7Aj4DgeUh6PxYrPUnhQQPSBU0xZN/iZ43g0dQufrRP5ZpgxL3VlGwBFVXV/94482pk7Nfx0ajwVXEsFJ/9ca5+hrATBvFwf7rzTdAbzXb8HzJ24/TiwW5Q1DJkMyXceF23CDMPS+MhzH/G43NwyyhNZ831B5CIHcwTkio= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=rm42e46/; arc=none smtp.client-ip=95.215.58.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="rm42e46/" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1774848053; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9fd68eY2O2CwKaCg9R2Y4ntn7WouQrswGFUmgrDBAqE=; b=rm42e46/2efGwnTyy/Nk+aswrm4cugwEBxJF6HCKwNl0e0BvUV9EJq7hIsC2Pr6k1w3QM1 ntPjaA78xPcGapwBvb4Hez5TRgyQ3LklKOQltrR5754BM77QV6Tq+MquKKYb5n2wtGnK6x JZUk16rHpsKNIyUYI0FG1pYo2wsHxoY= Date: Mon, 30 Mar 2026 13:20:16 +0800 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH bpf-next 1/3] bpf: Disallow freplace on XDP with mismatched xdp_has_frags values Content-Language: en-US To: Jakub Kicinski Cc: bpf@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , "David S . Miller" , Jesper Dangaard Brouer , Toke Hoiland-Jorgensen , Lorenzo Bianconi , linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, kernel-patches-bot@fb.com References: <20260324150444.68166-1-leon.hwang@linux.dev> <20260324150444.68166-2-leon.hwang@linux.dev> <20260326124205.1a3bb825@kernel.org> <785e0b04-91e4-457f-8d6c-e0a911c0fd88@linux.dev> <20260327171220.6d10d710@kernel.org> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Leon Hwang In-Reply-To: <20260327171220.6d10d710@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 28/3/26 08:12, Jakub Kicinski wrote: > On Fri, 27 Mar 2026 14:42:19 +0800 Leon Hwang wrote: >>> It may be worth adding a selftest to >>> tools/testing/selftests/drivers/net/xdp.py >>> which sets MTU to 9k, tries to attach a non-frag-capable prog >>> if that fails attaches a frag-capable prog and then checks if >>> replacing the capable prog with non-capable fails. >>> Drivers may be buggy in this regard. >> >> Do you mean adding these two tests to xdp.py? >> >> 1. Verify the failure of attaching non-frag-capable prog to mtu=9k >> driver. >> 2. Verify the failure of updating frag-capable prog with non-frag- >> capable prog via libbpf.c::bpf_link__update_program(). > > Not directly via libbpf just ip -f link, it uses libbpf internally > but testing with ip link is simpler. Also - there are already XDP > progs which return XDP_PASS in frag-capable and non-capable mode, > so just use those. > Yep, I see these XDP progs in xdp_dummy.bpf.c. I think the option of ip cmd to update XDP prog is -force. # ip l set dev eth0 mtu 9000 # ip l set dev eth0 xdpdrv obj xdp_dummy.bpf.o sec xdp.frags # ip l 6: eth0: mtu 9000 xdp qdisc mq master bond0 state UP mode DEFAULT group default qlen 1000 link/ether 3a:39:5f:35:17:6c brd ff:ff:ff:ff:ff:ff permaddr e0:9d:73:c6:7a:d6 prog/xdp id 72 name xdp_dummy_prog_ tag 614b434cd8324ecc jited # ip -force l set dev eth0 xdpdrv obj xdp_dummy.bpf.o sec xdp.frags # ip l 6: eth0: mtu 9000 xdp qdisc mq master bond0 state UP mode DEFAULT group default qlen 1000 link/ether 3a:39:5f:35:17:6c brd ff:ff:ff:ff:ff:ff permaddr e0:9d:73:c6:7a:d6 prog/xdp id 76 name xdp_dummy_prog_ tag 614b434cd8324ecc jited # ip l set dev eth0 mtu 1500 xdpdrv off I'd like to post an RFC to net-next later. Thanks, Leon