From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (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 F237A371D02 for ; Fri, 24 Jul 2026 03:05:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784862334; cv=none; b=nsrs5KxAYa5DRcUl7m2CuGYqhFpua9n0BFfPgj9CbG5d/vO8T4k5Toe8CHTXQ2+L7/jpgn0HRKU5y7XK2uzBFAIkPp5oJgBOor/7bUQhD8vmgrfSUwy7aQyY5Q7lm9k1UEbcjYtOUXh3Ts0ouq3aI5ApZ9XSi9U5ztnCnmqYLmo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784862334; c=relaxed/simple; bh=cRMYG/X4KbTYbEkrDkF5vJoRcZP3moe02DkXb+7WLrY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WdhjHQ0H5Q/kkgUK9wbxnoOofB4tfxWTJM+VR9kOd0ORov7HnXe/dtZvOf+zQGVcavifK5BWQR0UQcmY5C3mKJrOjpVa7VuDUVson0OTio+tTbEy/9dCgzlhGRvKzqDRzWhXY+/TYqs93aDHQAt3sgheobnWLAQ7stuHGIs8g+Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=Zt/zGpoz; arc=none smtp.client-ip=209.85.208.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="Zt/zGpoz" Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-69e8ea2783aso1946933a12.3 for ; Thu, 23 Jul 2026 20:05:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1784862330; x=1785467130; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=YkgPqMzAP2ofbMJqGwKnF617Gb9fXhy5NfbpimZP8p0=; b=Zt/zGpozCJ810tz+dqs8wujvG3xOrDortXUplZ3rnjfqWPWCJaPHdgYzw9384oErbi nN0/Sq3RFmtn0OisZGpgk1lXa8pQU+HU2sTJn19qE/CAYxhEl3fITNUS4rstucwjny98 ifuDVjAAHxQ0NCBbBdjvJXe9GxHznMMqi29Kivx3dAlN7lxLv2XJjRzYNBGXTaDynPxg 2G8JDTK1bK/B3X79ZwwVv+WVSjLg9CHyGXLTLrTBBjKJZgrZ9/71G7NoWlI4NHj/fwd+ gcfbaSx3unyX1/by51CY9yCVReI6VAc5UnOCMvJyrrKl6rd2K2GBlEzYQtvfmD6wFLlV 61lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784862330; x=1785467130; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=YkgPqMzAP2ofbMJqGwKnF617Gb9fXhy5NfbpimZP8p0=; b=ez9fZNsitjrrB4wTr/GA6WVfTq/S64vWt1BFAyUhB2Y39LnmflxeWiKZ9YiiLTiBRK E8x/y6dLAjfxk0ukqLYZnYVKhRAEg2DkLwFy7HErCIOrzvYQV5Oe+UByJrdot8ymJc6A ri0qmxe3WahD7PpL6jWa4xwPO+uCmXYjBl/h97lVUuQzhoWca6BtXzhPqQdMmkYiX7fa 19BxJuIvregdu5nUgdnfhcNSzImMyO1tNnmLSMBjfSmKDAqcb6PSzqeC6LeeOwNshCrh lRje/Ib5KU3EJcN6A9+LqZAh0P+BYqYKx3a5cWEpJ3pzkBLkCoIjsldVrerkwlEobNtP rikA== X-Forwarded-Encrypted: i=1; AHgh+Rr4mV2Lfs3udMZfxD7dq3cE9McikR165yJP+fXONTNdRXFSfWaf2oI8lZU2wRItj/kT7i+kY+atxCFCcug=@vger.kernel.org X-Gm-Message-State: AOJu0Ywv5YpbXtxx+TL5UaFMqs0/sEMLUsfha+GEmRfR9oBBg1AUMKbu NFYLno5goHB1NvstRr9ry5lA1//OfzO7Ku70/+GcDRLdAQvTLnR2ruwO+zRH82FKEYU= X-Gm-Gg: AR+sD1236RIa4FTassUCArr4f90zTDXUGqqoEdmE7PGSDEw4WLe5JNVVFTjeJC/ywwC eAf7iY+OfVBHQ0Npxih9HkTr4BKiX60O2wnZB9+OxKDRdQr2xqzoj6LGNhNrSEjFRGRqSRjQEQt j5+rHThlRtJeE1ErkDGYpWBCgn8WSP1tdGIUV/q0XigTddrQbv3fvn+6hZUbvfnKaMAsYaF6Nvy 61fxa/UhMCXQDn8ZyyGguCDhV3w3h4KNt6yBtLhjXUqWVN2tLBVe94mSF4p7dN0CB+2D353kvOp VcnawbyPcabHxDBLD0g//Co+WQ+tvGHBxkF0M0lZOHoTza+9apJ4GEN6RyFVsM2Tkgs8Cx7hWD/ 3e5QR9iskluunlSysAKRzxS1PTy4D7Ss3bxxMpsjtwUfC1txiwVPVIxYXAP1jJk5SHJRpYOVGtv YTJ70uItWdirnW0QwZCsJv6QjumZFBNf+5Hsc= X-Received: by 2002:a17:906:9f84:b0:c08:59dd:3fea with SMTP id a640c23a62f3a-c1c50bee0b9mr277617166b.27.1784862330234; Thu, 23 Jul 2026 20:05:30 -0700 (PDT) Received: from u94a (27-53-160-227.adsl.fetnet.net. [27.53.160.227]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cf8f31f14csm42880555ad.63.2026.07.23.20.05.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2026 20:05:28 -0700 (PDT) Date: Fri, 24 Jul 2026 11:05:18 +0800 From: Shung-Hsi Yu To: Eduard Zingerman , Yiyang Chen Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Kumar Kartikeya Dwivedi , John Fastabend , Martin KaFai Lau , Song Liu , Yonghong Song , Jiri Olsa , Shuah Khan , Emil Tsalapatis , Ihor Solodrai , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH bpf-next v3 1/3] bpf: Preserve pointer state for commuted arithmetic Message-ID: References: <004a83de52a36e9f3acd6c3fa2d0dfd0a013460d.1784696372.git.chenyy23@mails.tsinghua.edu.cn> <04c2eab092885ed738fc87f2db344bca1319a90b.camel@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <04c2eab092885ed738fc87f2db344bca1319a90b.camel@gmail.com> On Thu, Jul 23, 2026 at 02:07:20PM -0700, Eduard Zingerman wrote: > On Wed, 2026-07-22 at 05:27 +0000, Yiyang Chen wrote: > > When scalar += pointer is handled in adjust_ptr_min_max_vals(), the > > destination register inherits the pointer state from the source pointer. > > Copying only selected fields is fragile because pointer provenance is > > tracked by several bpf_reg_state fields. > > > > Use verifier-env scratch storage to preserve the scalar operand while > > replacing the destination with the full pointer state. This preserves the > > frame number for PTR_TO_STACK registers and keeps parent identity fields > > consistent. > > > > Fixes: f1174f77b50c ("bpf/verifier: rework value tracking") > > Signed-off-by: Yiyang Chen > > --- > > > > kernel/bpf/verifier.c | 21 ++++++++++++++------- > > 1 file changed, 14 insertions(+), 7 deletions(-) > > > > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c > > index 52be0a118cce0..085cbd5222737 100644 > > --- a/kernel/bpf/verifier.c > > +++ b/kernel/bpf/verifier.c > > @@ -13726,11 +13726,14 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env, > > Yiyang, > > I noticed there there is a temporary 'off' reg allocated on stack by > the caller of this function. So, let's reuse it, ... 'off_reg' perhaps? +1 > and also adjust the > sanitize_err signature to minimize changes. > > Could you please re-spin using the attached patches? > > Shung-Hsi, wdyt? Refactoring LGTM. Feels like the alias check 'dst_reg != ptr_reg' would still bite us later, but perhaps that something for another time. ...