From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796552074; b=TiPvCdsqp9haXJk9WFYcx/O5jMhKuDgTWEY6TrwuRVZk7rlDh6VsPzrQBowRQkQgRi+n BtYY9/bPK1VmLw81rAVAfvY5yG7P9G86Ipdd/3D5IeBaVifwCTD06lx5f7vMweGAhjnX4 mVorXnzjkUkHdKBFXbsk3RvMf77ZXFKSQFRGZPoh8J6kVq1qS9ANMhiVGiAIhaDVAXOys zE7UFxeupsqLHMco7Z0DZJijbNy1yAUarREAD/oHLQPGi79auFSeCd3+YM+LxRK1NlnFu IMF/G1vY8rJLycqTkfanpVOPxKTOGdplWtQs4mKh87rXVTa592ayVI21EXspT6WDPRA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796552074; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=mZwEuuOnryFKUvyytHWPjjwHxBTSbPZTNo2/l+WbYMY=; b=LFtkDJop9iRyIyorsEVEJ6/8Qcl7JsmcEEiqtnz2fT+cy2xkKPVZUlBHzrEs82EVMJ8/ 8XMW4rKx+vpvXHrig+z/RE3pVCzxLznq9nedO9I1+ArT+E3nIJh3qvHAvZjbV38lgq70c 9ON8O80NVTWnJfDzDKXS5WADGmLtfeMWXvgvBSkFIG4t22GiXyg5I/XJyLQWoNZ95f0gO xa3Yo/6Ud850wkJ0YybzYSBSPBfHyp+lKJ5mOuX3J8SzvkhjbTPpyFPJLAMHemMkpwnyg MbqgvU7EG5fEEGbyg8yZpqZUy12CwKWkL0s6eWj038o7dzBD1q/pTHmXoaLTdfZKOKA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ff1VYDar; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C5D4606A31F for ; Sun, 6 Dec 2026 10:14:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ff1VYDar Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0D7D1F0092B; Sun, 6 Dec 2026 10:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796552074; bh=mZwEuuOnryFKUvyytHWPjjwHxBTSbPZTNo2/l+WbYMY=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=ff1VYDar3pB8vqWB/jND9hX/5cnjoYLnnMIp/4Bb68Y9AkfgTL+Q5vwtA9doq/4Ty aDndFUNy3DgazbpDn0XHUonNSPGcenda/wjWmCCVFOwtLNl2uJCZ7awFbj3bgvxp/I 1fW21M5UnigPpGlNYEPDQU94KcaHqq15+k8vUoJ10pb01VnjUnX+WtKJ9aomtKwolK VanKwhsWNXSgKZ4UZkvX+J4tubs11hJX53Voo8V06PZQaa8IjiCSNRhQ5AhMk8EIv0 ANPbtsYtuiNGruYlEflby8wduxdTcGEziEaJ/W+06NpHgnXwxr+WBLeUThnZwWjTwF SlXj8CQTb1xQQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH bpf-next 4/6] bpf, arm64: Defer JIT instruction sync Reply-To: sashiko-reviews@lists.linux.dev To: "Xu Kuohai" , bpf@vger.kernel.org In-Reply-To: <190c80959b4e35c8eadaa06dd0ed199c9500ebb4.1796545068.git.xukuohai@huawei.com> References: <190c80959b4e35c8eadaa06dd0ed199c9500ebb4.1796545068.git.xukuohai@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Dec 2026 10:14:33 +0000 X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] bpf, arm64: bpf_arch_text_synchronize() omits local CPU ISB after migration -- commit 8b2bf7fd475c1e8e55dccee21aa58f89891e3c3e Author: Xu Kuohai bpf, arm64: Defer JIT instruction sync This commit implements bpf_arch_text_copy_nosync() and bpf_arch_text_synchronize() on arm64 to support deferred JIT instruction synchronization, and switches the JIT error path to the nosync copy. > diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c > index 3ac287580d224..76d25947ace65 100644 > --- a/arch/arm64/net/bpf_jit_comp.c > +++ b/arch/arm64/net/bpf_jit_comp.c [ ... ] > @@ -3288,6 +3288,18 @@ void *bpf_arch_text_copy(void *dst, void *src, siz= e_t len) > return dst; > } > =20 > +void *bpf_arch_text_copy_nosync(void *dst, void *src, size_t len) > +{ > + if (!aarch64_insn_copy_nosync(dst, src, len)) > + return ERR_PTR(-EINVAL); > + return dst; > +} > + > +void bpf_arch_text_synchronize(void) > +{ > + kick_all_cpus_sync(); > +} [Severity: High] Can bpf_arch_text_synchronize() return without executing an isb() on the calling CPU if the task migrated after bpf_arch_text_copy_nosync()? bpf_arch_text_copy_nosync() runs caches_clean_inval_pou(), which only executes isb() on the CPU performing the copy. Because synchronization is deferred across preemptible work, the task can migrate before calling bpf_arch_text_synchronize(): CPU0 CPU1 bpf_arch_text_copy_nosync() caches_clean_inval_pou() (isb) ... (task migrates to CPU1) ... __switch_to() (dsb, no isb) bpf_arch_text_synchronize() kick_all_cpus_sync() (skips CPU1) dummy_ops_call_op() <-- stale prefetch On arm64, __switch_to() emits dsb(ish) without guaranteeing an isb() (as documented in emit_pte_barriers()). kick_all_cpus_sync() executes smp_mb() (dmb(ish)) and smp_call_function(), which clears this_cpu from the target mask and skips SCF_RUN_LOCAL. Sending the remote IPI does not guarantee an isb() on CPU1 either, for example on GICv2 or when no remote IPI needs to be dispatched. A caller such as bpf_struct_ops_test_run() can then immediately execute newly patched code on CPU1 with stale prefetched instructions from a reused bpf_prog_pack slot, hitting AARCH64_BREAK_FAULT (kernel oops) or stale code from a freed program. Executing isb() on the local CPU in the same non-migratable region as kick_all_cpus_sync() (e.g. under preempt_disable(), or via on_each_cpu() with an isb() callback) would close both migration windows. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796545068.gi= t.xukuohai@huawei.com?part=3D4