From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82CD3503BF7 for ; Thu, 10 Sep 2026 17:47:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789062438; cv=none; b=lbCAfTw0FkndKIYH8ReKz7teMv3MesahknoJ70UsH5HBpkBXS0C/K+CCBx0Pi7SAziam0RqeQArAB4Hn8f29N5HZg5tRXiirPhcHM0Yn2xVqhteXOeusBv82gV+mybxENZGR6tZexiNdpfQ7fS/qFubhjV+5oBNJy7/ZRXxsNTM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789062438; c=relaxed/simple; bh=ggmWy378Fm8XbzIqsmoiDfWqgCWV7miSo+Loys+qS6I=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=sExHzkENpg/ve/TMFyYDCqE3YS5ndUmixE9GQBVZNDsfzqCYDE85Y9dbAku/KDqIallTyxeAKhkj7msblJ/Oq/gdVg/9B7oswgNXJL0aGoTRBSPFDOp2aDD81nBDiNWL/NAI39Q368LoF+7kJaCMM4feq/Mx51YNyyCFZS/f2DM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=etsalapatis.com; spf=pass smtp.mailfrom=etsalapatis.com; dkim=pass (2048-bit key) header.d=etsalapatis-com.20251104.gappssmtp.com header.i=@etsalapatis-com.20251104.gappssmtp.com header.b=HUHwSk7O; arc=none smtp.client-ip=209.85.216.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=etsalapatis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etsalapatis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=etsalapatis-com.20251104.gappssmtp.com header.i=@etsalapatis-com.20251104.gappssmtp.com header.b="HUHwSk7O" Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-38a0c7e841fso9418355a91.2 for ; Thu, 10 Sep 2026 10:47:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=etsalapatis-com.20251104.gappssmtp.com; s=20251104; t=1789062427; x=1789667227; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:content-transfer-encoding:mime-version:from:to:cc :subject:date:message-id:reply-to:content-type; bh=HAvA87Et5zN/g6j7vdy1Ap87pfUn9R+X0a3IzOHRO74=; b=HUHwSk7OVdy7wpzNCyqFSt0yxKwOynRRXEBnkyUtOGsGl5Si3uamMpwuqIA5trg7Hs Mr85LLXnSJseku++pvzOVjuvnNBC2p2FsAZgMm/a9thop2FTNDBpsLdrClIDHuW9NKzd l9dPe+TT6zH4vRn/x44lWIMCXqvLpV7iiTBwaoIHZQd489fvGazRkxRek3cZveM+l0p8 1GSlRPDslRjkUgIQ8umUr/fPzSDkjjnioCpgJxzcjSoibPc8DJQ3Rt/yVqWq2bzeuaiE HxFEZ3gTH+AprS3kP66SXQjGF5dcGm6bID2iGSzoMAMpmhUstuPzLeDPfiaEWPtOEhQa +FFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789062427; x=1789667227; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-type:content-transfer-encoding:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=HAvA87Et5zN/g6j7vdy1Ap87pfUn9R+X0a3IzOHRO74=; b=Dx+810jXNR0F3u0OEZjxjPu4gPeX70wu4ktZMFmwgVbQqEaNXp/2TMrdMC0kxlIL7B zTV2S+sziRo9BZxNOXWlWjfIPkNKSKd6LNQK+/gKnbXJgGaY05F6kshBfqcgVfDO2YzU utE3hc157KRIYmT6r5qbWOS6MMXOjN6aO16M7ADt4NfZsQD9pGJRgQqwBkOaZLzgac+y FVbvHk7D7NRCe2qecRMXrHKLa1GpIXhdlps1VHA20OKLgMh1HvCsVxjUEzLoD94/ud51 V+YVQacr7lJnHIk62TMxa4kxQWl47drMjGSEkTIx0tdHF9058AN3vuDhl3rTEg9PwzBB gs/A== X-Forwarded-Encrypted: i=1; AKwUvBwZMeF35gv+HqqEOYx1jaf9Vl2/tzc7xh3naiQ4mA9mnL7YXOa3zs/F1eyyHShr7mAgLqul9/o=@vger.kernel.org X-Gm-Message-State: AFuF++lgrHwNt+gkwWos1WCDw7daLIbkvGiggpvWlWzs4NOPbAVxw6X3 8wT60YPLc7MPdr8oZiTELH/BiWVlYzm/9iOi3p1aakChvvl6qfk1/1m1rLHNNXGoshg= X-Gm-Gg: AYBFou147ECG6t/dNVL6avpgaflvWCHk3tBCiO6bQUlEwCw1qUpSI/FqvKwkWIOt4gS weDKouai70L22HTAd0EKd9ptQZVoTvumJIZcAESq2/uArHduf38lKRDKJgySgheo4GR/IImxUvn WZ1jG8UNoBjWyDOGKsYFqIex9K8iI+4wQ1ALerg8N00S5wg01M8ygqO81U/u1AMRM1h9YOTO9vo 5BhgriTnnZnqtsJrJfO/GWW0B0i8VTjTo3m3ZsANd5BTRubD16YzfkBaod/suj+tvcsviCvZ/IU dolrM0AQOXTrA78L5wg3UImzCkwplpViQjp7GPOU8nsProD1Cq8UIsVH+kdj5+w7WQbJEAM0Viv V7ABmsZ2iPZNEdD6RGbClupow9Gfv0tMcxU6G7Y6laQd/F+eyPtbEED4j/7+KPUB/K4J8BNX6c+ Q45KKyT1Z9d90DND8Bzr+O+5Pa4JixH0oa4sTBQdBKA3C2QxbV0yVECLKho0gPlYWubMl/L8PbU ezyEIBWfcDwMlJ7nl2INKRpJamf X-Received: by 2002:a17:90b:274e:b0:398:b1eb:136c with SMTP id 98e67ed59e1d1-39b2610fe62mr64208964a91.9.1789062426873; Thu, 10 Sep 2026 10:47:06 -0700 (PDT) Received: from localhost (107-190-31-17.cpe.teksavvy.com. [107.190.31.17]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39d98e60484sm263339a91.4.2026.09.10.10.46.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Sep 2026 10:46:58 -0700 (PDT) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 10 Sep 2026 13:46:56 -0400 Message-Id: Cc: "Emil Tsalapatis" , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH bpf] bpf: fix reading neigh ha in bpf_fib_lookup() From: "Emil Tsalapatis" To: "Nikhil Ludder" , "Jiayuan Chen" X-Mailer: aerc 0.21.0-0-g5549850facc2 References: <20260909024011.1252694-1-nikhilljatt@gmail.com> <178898653497.1776876.10402414041023036972@gmail.com> <7f3e237e-ac5c-46af-ae21-8b437a099fe3@linux.dev> <178903991209.1916825.3991149870565892141@gmail.com> In-Reply-To: <178903991209.1916825.3991149870565892141@gmail.com> On Thu Sep 10, 2026 at 7:31 AM EDT, Nikhil Ludder wrote: > On 9/10/26 12:59 PM, Jiayuan Chen wrote: >> Yes, no deadlock. > > Thanks for confirming. The explanation makes sense, hadn't considered where this is written from. No need to adjust. > >> BTW, if an IPoIB device can show up here, dmac is already truncated >> today and the packet can't be forwarded anyway. >> Shouldn't we just reject addr_len !=3D ETH_ALEN instead of open-coding >> the copy? Then you can use the native function instead. > > You are right, and it is worse than just dmac: the line immediately > below copies dev->dev_addr into params->smac with a fixed ETH_ALEN and > no addr_len check either, so both addresses are already truncated for > such a device. struct bpf_fib_lookup declares smac[6] and dmac[6], so > the helper is ethernet-only by contract and a non-ethernet nexthop is > already outside it. > > I would rather not fold that into this patch though. This one is a > race fix with Cc: stable and no behaviour change, whereas rejecting a > device that today returns a (garbage) success is uapi visible and does > not belong in a stable backport. Would you be happy with the seqlock > fix as it stands, and a follow-up for bpf-next that rejects > addr_len !=3D ETH_ALEN and covers smac as well? I am happy to write it. > I think this split makes sense, even if there's the churn of adding the fix then removing it to use the pre-existing helper. It's just a couple lines of temporary duplication. @Jiayuan wdyt? > If so, which return code would you want for that? None of the existing > BPF_FIB_LKUP_RET_* really fits: NO_NEIGH is untrue since the neighbour > is there, NOT_FWDED is vague, and adding a new BPF_FIB_LKUP_RET_* is > uapi, which is another reason to keep it out of this patch. > > Thanks, > Nikhil