From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (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 35D623612DB for ; Thu, 23 Jul 2026 03:45:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784778339; cv=none; b=T71sThmxo6Wh4tE/OEbpY+X6iVAlCRydu4Ik3PBbRGJUwvPWL0TYW2366mK+Ku+rcc8QIqrh1pzUEUNSkkv/Sr7mI8v011oa5uVieL4GW6rKXwxrDDryL9rx7QxthtGwiEwkRloYXOecJu4PQPsKMZjA+s0TT0areyYXGUkVMas= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784778339; c=relaxed/simple; bh=arSEEFXFQVdqCW0J+7+aF8D80655DPiP8sYSGDClKlA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PXggAlJVUfNFwb9gnRu9cbcTOagbgDQymlq2enhOIX13IliGdAAXIxb4awEdb3bQgRZhS1WmEA2DvnZvRkP8ZskfzEtLGjEbCDMirDPKJBgVndan8E4iLA66rVaNusy69rxicNbltaxrz3AIwse1rFJ6QXHkhgPtpzJC11FtiUY= 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=B+XyUiFD; arc=none smtp.client-ip=209.85.218.53 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="B+XyUiFD" Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-c15d47266baso22211466b.3 for ; Wed, 22 Jul 2026 20:45:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1784778335; x=1785383135; 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=wvdorMdSMyG6e2Iuu6rHoLJQpWLzhl4z4BJUQ5L+CIQ=; b=B+XyUiFDNiK2CJWCk+Aa66iUsAjRyjYKz99uU19n0oH7pHbIMPaP7Qj8hMVXj/dgAQ 7ipvHdUBtvadVEFvBpELtU6DJKUOW5ocVNUcEHH33fGEY78VA76U2ny7ZE5UmRZWFK87 g89mswajwakEqXtWhV90BVOt+RYfli5tIpJ1zgR0vpEqUJ7nAWUfT6NmGj25YlKY/1EI wlxJy0jZUx/nfiZ+puV/5nQQgb5dXbvzdJXB6Z4dlo9wG92vdWOMObZN9fOFXAXQfiLo r9pDBPzuQtGDF/gcTV1fAI2PQEAnIahORf8c3L7jQFGTpaQuDBqGUcSm05UxfpbB5vGt K5/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784778335; x=1785383135; 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=wvdorMdSMyG6e2Iuu6rHoLJQpWLzhl4z4BJUQ5L+CIQ=; b=q2JaTI//Q0OkZGllsZEakA5X/UEsRJl9Tp7Toe4v2qBwTR7GyDrX4KAOBqci5LlFrg xJIAbixGVJReSyr5dJOmVvGPgUeS7OJuzaazi7tPTblIL/i65lkXdG5KaFm+7aQiD3k7 FIYor+rA6lsxnjJcWmNI7vYIyx8yPt/ypkC50yxAnX3TBoNjUixchYqH91UfPzZBY6Lu PasFEc0GIeVIbgFHArJzBDOIiVKLNfNCFYexftIRsEizNOLh43FQvfIowq/z9f445Dm0 vMEse8JrGiCN3ZMAMCWfaLD4QkREgpVoH5zidV0NR7ROOHKgyRaaQ3CKGvcONZCTp5HI Lgjg== X-Forwarded-Encrypted: i=1; AHgh+RqSsrI5ka21zVPp6Zulwu/L+TDY3Bz7DkVYK112n4s5sSfI2CCshbttAwVEvMXNVUqBINGR10aV0FsPkFQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw0hv7hM3Swhpiwp34uJIGHWLb+YipOwwXmpM2Ce8KrJiZmFQic CiF/p7Ip9wUXlBCd0Wzl8JYjqaUC7Rrh/8Ud8MwTYH2Kixn7hKmcE73rR9pVcTmKwmU= X-Gm-Gg: AR+sD10z4c6HHd82KvLK6YAU9xGp4Nd1tlbAd7/AhFPFH7R9UcG9emyOPa9S47Lctay 2jPdsVE9XCSzWtUcnVsrE3c4nUg1h08PrUaGTuQ0MpcOP4qbwmE4i6y+l36mz17md4maqeXR1e3 LlE1Z1aCX2BSVbAXyyZHKlbsCM6+Iqy/W40nJ8UjkTq4i3Twl/Aqo0k12ziohJW4egDizA7IP4c Wt1OLSXpJFGcQp+9Tewx6C9Ge6+aeQ4wHlJIveH3cDFV3U2lHN4TrDPHbaYARNxvhq3TnNARGdy GgZPgktgWaOFeThb5Dql6LgkAvl/ebTLp6xgcblAxq4ehWLsHv2fA8/5Xrnp4KyVmjtu+YUNvzR QXAQmsltJoHPAXGSvOfr9d5q9LwaQFSc/S6T57wfaPahXO11eQ8lA0e10x5w3IstLxYaERATboy zZTK72mwaa6tzS61nq0GM= X-Received: by 2002:a17:907:8dcf:b0:c16:9ca5:e551 with SMTP id a640c23a62f3a-c1c50783c3emr55161966b.14.1784778335399; Wed, 22 Jul 2026 20:45:35 -0700 (PDT) Received: from u94a (27-53-97-40.adsl.fetnet.net. [27.53.97.40]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cf8efd88f7sm24726105ad.22.2026.07.22.20.45.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2026 20:45:34 -0700 (PDT) Date: Thu, 23 Jul 2026 11:45:26 +0800 From: Shung-Hsi Yu To: Yiyang Chen Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , 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> 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: <004a83de52a36e9f3acd6c3fa2d0dfd0a013460d.1784696372.git.chenyy23@mails.tsinghua.edu.cn> Oops, missed there was already v3 yesterday. Reposting comments here. On Wed, Jul 22, 2026 at 05:27:31AM +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") Nit: This doesn't look right. Without bpf2bpf there is just one frame, hence there isn't a bug at this point. I think the commit f4d7e40a5b71 ("bpf: introduce function calls (verification)") the you mentioned in v1 should be used here instead. [...]