From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 7989C3B27D4 for ; Thu, 30 Jul 2026 08:25:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785399959; cv=none; b=pAFdOtpzBE+Wp2hJxo8YYE+23E0roRwv7CxkBoHtsW/zY6U8ha1OAbQOiKGgidm3wkF8nMXXfS93mcygOkSsDL3FO06qARmPOCtCI/a7DH0ZHvGJQkHZeMGJgaPszbcDqY6LLNJXh/J4uRPAUGky2PC6889msV6RZ/M6rSGqzIM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785399959; c=relaxed/simple; bh=C4Dp81+yrf8RNuNIOEBP8kLYNnF4h2mYnD9L4fn2tnM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SVjq4zltG9gu/Fw4qh2AvyjnYRThALC+do6ZwBs6UTY89AKdGmJDGg4OaLd0Uvf5VN+R+Yu7lZAppx+xu/kCLWzzc9L48DKT8AF0VVuJNbdjLEb8vB4eHD8/8tPaD0c36PqXvZ93gkmXP1nF0DUN4eoHXR+NAOP9nS4u8LtYCxg= 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=YyGmLfRl; arc=none smtp.client-ip=209.85.128.43 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="YyGmLfRl" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-49556f97a9dso12759945e9.1 for ; Thu, 30 Jul 2026 01:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1785399956; x=1786004756; 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=+khihSFp8xIqvD5iaqe5AnFSih+L44scJGPk6G96Z6g=; b=YyGmLfRlW4B2nNd4BLXk49a7u1JpGiHkopgEEOcL9UUwm4YzJNkbcDyU6jfr2iLFy7 o2kwSU5yTioK4mV9hDxv4Qa+or6nbBgd2E0I3jTQqt4SgdZ5BPfaqjvKkR0tbKPTFvfx XvU9ssaMb5r+y04cD7eL3LyC5l0GOh1gZU7F8/QrdZm8MEii/2lnTbL6PNFvYKQcm1b2 JCDnocvX+4z1vCzbGHFcEpy3uXlQ9HUgIOk7Z9ZhIRYNt2MOkHPn5Shmg2UOZmB3PvTI 1/qH3Ua57tBr4cQ6H7k1f24BsZOYnRqODrgWNHPZ0eptcnSHvV1qcTOw87XY2cz9K/bD 3YNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785399956; x=1786004756; 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=+khihSFp8xIqvD5iaqe5AnFSih+L44scJGPk6G96Z6g=; b=KK8LD5HR+UyuONQ/vW/EGpPv7wl47iANxv+POWGfY0bJ02eW4z8D4t/tJkYxzV9YzX rVtC2fh8aSVishOvXXqsiPucuquy2CnFNIUHIqeHwjdM9I01g9H3J86NOlIgEdNFZ/UC pBe6uIl5ZXiTJ7m4DnwWhNnBS1Jj2RtH99fnv/vwQQrHqDseNTu/DuErBvvAg2fZIqwc VCRhQMpR3iv2b18X/BqI03eapfBx9E1Ie66RALc78aCcxIMpChXBv+O222NFuvB4cYI5 5G3z9UiL2ZZz4wzeEs4e3KSoHs0Vhlvlp8riSU2Z7L2pTByjIATZiPmYlKsz1O4Imnk6 MxPQ== X-Forwarded-Encrypted: i=1; AHgh+RomYf8WfxM6QLIH44KfPcjDWd7PnijT6SUnWzDuTg1uM8Zm6nlJwWsPXfoIEW/ok+zf9qSI6egoe9tDSSo=@vger.kernel.org X-Gm-Message-State: AOJu0YwAX9VU7T/JdEppFtmYdKVy2jOOSIuzL/XpIOYvD4fnXlJg6IhV zsrl8cMR7b9LChdERaF6MV83ayYSeMHgwX+qF0bFIl5rZLCTDCstr33SaddYD4Q20AU= X-Gm-Gg: AR+sD12KVFXHqX6U/4TMXxA54DHg8rw67IQVGcIMYakuvYgVORuDRSd+UGvOeTPcb0d kGH42LC0OyxX/BI45IItgEOPwfhJZIiUCc7tRoxNopIdhsWJjwf76oVyO5XpbHofMZ+ECoVUCFO pZZGuNZRjWrrNDdkgxF6ZTx21LMMarZzFoW1ZILH1FssqGzu4Ci70AeG3oIsS/tM2+tSzEJWdTK 5MT9+rmgI3ZV5hiBWRbaPCJUHUpJzMLcERImmze5iYLIMFSB7zNgWraO7pBHwQXV8tsYgbH+lqu I2JYvYezWxy9HXuM32jXJhB9hIKrWqtrVET81PAUABesW1hz65XnpOrdEu9mo6Ax2Byaipk7t9P Nt320fbxii2oeRI9Ed4MQuR3uTfblhTtmlwCVvj28VBuweXq9olsYsjIrQEXalrrWezmbW9krQw Uo1cxu4vKoSouiaNK0AOVtAc9W6hL5XZAObZB0PZi6znUIhbDcOZwbFVG7PJhH4Fe5Hl47Bir22 +qfF8M4sI8fkqk= X-Received: by 2002:a05:600c:500d:b0:495:4e17:cad5 with SMTP id 5b1f17b1804b1-49800eac18amr18818185e9.26.1785399955724; Thu, 30 Jul 2026 01:25:55 -0700 (PDT) Received: from u94a (61-227-70-26.dynamic-ip.hinet.net. [61.227.70.26]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504927a7bsm20164432eec.0.2026.07.30.01.25.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Jul 2026 01:25:54 -0700 (PDT) Date: Thu, 30 Jul 2026 16:25:47 +0800 From: Shung-Hsi Yu To: chenyy23@mails.tsinghua.edu.cn 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 , Daniel Wade , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH bpf v4 2/4] bpf: Preserve pointer state for commuted arithmetic Message-ID: References: <20260729-c3-035-public-bpf-v4-v4-0-8ee297e2346b@mails.tsinghua.edu.cn> <20260729-c3-035-public-bpf-v4-v4-2-8ee297e2346b@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: <20260729-c3-035-public-bpf-v4-v4-2-8ee297e2346b@mails.tsinghua.edu.cn> On Wed, Jul 29, 2026 at 03:18:28PM +0000, Yiyang Chen via B4 Relay wrote: > From: Yiyang Chen > > 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 the caller's temporary offset register 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: f4d7e40a5b71 ("bpf: introduce function calls (verification)") > Signed-off-by: Yiyang Chen > Tested-by: Daniel Wade > Signed-off-by: Eduard Zingerman Acked-by: Shung-Hsi Yu