From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.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 F1F263CFF7D for ; Tue, 16 Jun 2026 05:51:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781589112; cv=none; b=rVah8OzdXwrFoOddZBzAiszegeyLRYwH2qexB3+GLOpFunmrc1d4eOPwq87Wzb3WVx7KlGfGn9fUH8z8uCWVb/F3k3o0A7Z4fFb0Dpp0R3QsY/biBH3dF0uahpXGXE5BwjIZ8Gf2Kmj1hYt6vMtf27SE+LAiyH/wiBAMvVUgHA8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781589112; c=relaxed/simple; bh=7BG2QmmZRLh5N3+eiC64oaFFvrrLDzoLyfL/lriehHI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RsBAKQ9+CHEZt0BPx+vGiQ85fvNnPEN8f0l9JydKjBdrRJkAcPyT/VxGaSoXcR8/Y5KJea6b+eQPVxCSE1ACeb8DAhrgBg0i6jIKWwnfDSCZl5jnRkNcyoSRUQDYIrt3TXCShq5E8AttdcljvDtm2P2OZ0HNjU2Cf2UfiZ0tIqo= 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=QxDfpumc; arc=none smtp.client-ip=209.85.128.47 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="QxDfpumc" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4903d730b1fso52216675e9.2 for ; Mon, 15 Jun 2026 22:51:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1781589109; x=1782193909; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=pn+WbxeK/3ieMZ9WvMfWf1pVnmuN4tJPxKr7sK9EIcY=; b=QxDfpumcliIkLkFyq2V538vW9GarjHCMoWbjN4HO8T6s/IiDNpncAa0mI5H4wdn/e0 2wJQDN0duell/pBFWpiRxlH/rx95giBgzcgD2VZ7/Xx6pXrTa5qEJIhfuN/TWR4EbWU8 pD1dM+RTYz9kjj8R6jAHI9PCvEmMvrnZy9qnsy6SNI8eMC83e4bZhq6PcZtpS4hRHmMW fuRAnjH3iBxl/p7geKLZs9qwBBPfgIWIxvSSuosapzeO18oKP41Gc9WUig5HXSYSz+En xdZ0j7pZdcayL5dGVLvPUfSL0b9imeKgdXiNL+RsMhqo6X1lko2slE4zbQt7HZ1564xR rBNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781589109; x=1782193909; h=in-reply-to:content-disposition: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; bh=pn+WbxeK/3ieMZ9WvMfWf1pVnmuN4tJPxKr7sK9EIcY=; b=L5al/DMOmLDsewi34gpgFm8JbF+XpG2QTX0zrQ8xCanmEDbFACsPR/pMyAzYNKjPD9 Oa3Q7aw8rK//KvfuVFHD0m5tUS8rc/myS8nCQmR1p3NbjIYEkLCYBludEdIyRA+CrbIt 0wHBdEhaOPVTuMjC+7wIR2KMyc/QPlhrk15OcmDchwgIGZizCuLyGRBvb94Kb44DjHWW wS1VGZrvHRVBjtUbWw7jvAgRuvU7PFo12VB5GR4eiuOfe7toxhD9s3Qy7Cvhwes0WUUw C67KLODS4+7BricR+lgVKOr4pfvzu3G2Pm1kPs6db78tOYBwtY5B2mEHE4zOFlNH+lQt ihIg== X-Forwarded-Encrypted: i=1; AFNElJ9pKFC/n+aWnSbLHYXu7gBKGFCw0XuSlqNybQrTLv/0mR+6f/MjFkmT2diKqBQoDqqE4WUVXF1caP2FBSM=@vger.kernel.org X-Gm-Message-State: AOJu0YyAMCWh3WMajs2c+smixcsSiLiFA7dkC7fS24eyQn5q23M0P539 +t0NqF7B8qfjT602dTrcFgue8hDA9S2LTgpYNc6d4nl2OVc8TmBW9rt1ELP2A8d5sA0= X-Gm-Gg: Acq92OHPomBLDWvYWlDIPAqKYDmEWSafljo3cZ1qDnbL9Sc7vF66sdFp2awMqAjfONE CvaWhSPBc3U/6xUZwJw4SuVHS/VY+yGerRuzCW54M00NBOiSs6o3PIRPssHb/kd7t2FEvZNeScf CSvyM3ZU7GDHp58fGIQnO10Ko6KBsJS7jUJPwuYSf5HBv+T40Gcw/2XcY10j+GvhBuqcAhPsb5B NcTcIAD/yoqGOx5V8F2akjejDUIr/UYDH6HF9CZHE/N5hQym12YY2DeBUeRUFQO5I2Z4GmnG5uM +GfOpYoQzWoy0ZQKXiF+5V6U0S5tS3bGgnoopJgPGBTIFyZCm5qf1/aeFkb1tKg//K6vcfiGsMZ ATAyQ5+l221ubnyDBcEvzXyDPZdrujCLPeu3b1IYLoPYeJB5xFkaUjJvNfXSSH9pNOLzGJhM4Vm t+QhA4mY6Vm3VrV/G+uvEakS5MCbNpmL4fw3OxZkX5n5C+1g== X-Received: by 2002:a05:600c:1f8c:b0:488:d6eb:e63c with SMTP id 5b1f17b1804b1-492200768abmr192521925e9.15.1781589109336; Mon, 15 Jun 2026 22:51:49 -0700 (PDT) Received: from u94a (39-12-139-247.adsl.fetnet.net. [39.12.139.247]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30b6191bf9asm12009774eec.31.2026.06.15.22.51.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jun 2026 22:51:48 -0700 (PDT) Date: Tue, 16 Jun 2026 13:51:39 +0800 From: Shung-Hsi Yu To: Zhenzhong Wu Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, kpsingh@kernel.org, haoluo@google.com, jolsa@kernel.org, menglong8.dong@gmail.com, eddyz87@gmail.com, stable@vger.kernel.org, mykolal@fb.com, tamird@kernel.org, Hao Sun Subject: Re: [PATCH stable 6.6.y v3 1/4] bpf: Track equal scalars history on per-instruction level Message-ID: References: <7f27d335fa6280d5eb04e7b27a7e3d7e7ac1d641.1781194510.git.jt26wzz@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: <7f27d335fa6280d5eb04e7b27a7e3d7e7ac1d641.1781194510.git.jt26wzz@gmail.com> On Mon, Jun 15, 2026 at 12:58:38AM +0800, Zhenzhong Wu wrote: [...] > +/* For all R being scalar registers or spilled scalar registers > + * in verifier state, save R in linked_regs if R->id == id. > + * If there are too many Rs sharing same id, reset id for leftover Rs. > + */ > +static void collect_linked_regs(struct bpf_verifier_state *vstate, u32 id, > + struct linked_regs *linked_regs) > +{ > + struct bpf_func_state *func; > struct bpf_reg_state *reg; > + int i, j; > > - bpf_for_each_reg_in_vstate(vstate, state, reg, ({ > - if (reg->type == SCALAR_VALUE && reg->id == known_reg->id) { > + for (i = vstate->curframe; i >= 0; i--) { > + func = vstate->frame[i]; > + for (j = 0; j < BPF_REG_FP; j++) { > + reg = &func->regs[j]; > + __collect_linked_regs(linked_regs, reg, id, i, j, true); > + } > + for (j = 0; j < func->allocated_stack / BPF_REG_SIZE; j++) { > + if (!is_spilled_reg(&func->stack[j])) > + continue; > + reg = &func->stack[j].spilled_ptr; > + __collect_linked_regs(linked_regs, reg, id, i, j, false); > + } > + } > + > + if (linked_regs->cnt == 1) > + linked_regs->cnt = 0; This part seems new, not found on the original commit, and also not in bpf-next. Can you add some more explaining (in the notes before your signed-off-by) regarding why this is needed? > +} [...] > @@ -14704,6 +14899,21 @@ static int check_cond_jmp_op(struct bpf_verifier_env *env, > return 0; > } > > + /* Push scalar registers sharing same ID to jump history, > + * do this before creating 'other_branch', so that both > + * 'this_branch' and 'other_branch' share this history > + * if parent state is created. > + */ > + if (BPF_SRC(insn->code) == BPF_X && src_reg->type == SCALAR_VALUE && src_reg->id) > + collect_linked_regs(this_branch, src_reg->id, &linked_regs); > + if (dst_reg->type == SCALAR_VALUE && dst_reg->id) > + collect_linked_regs(this_branch, dst_reg->id, &linked_regs); > + if (linked_regs.cnt > 0) { Same here, the original commit and bpf-next has the '> 1' conditional, where as your has '> 0'. Can you also added some explanation on this part? > + err = push_jmp_history(env, this_branch, 0, linked_regs_pack(&linked_regs)); > + if (err) > + return err; > + } > + ...