All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pawan Gupta" <pawan.kumar.gupta@linux.intel.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH 6.18.y 2/6] x86/bugs: Enable IBPB flush on BPF JIT allocation
Date: Tue, 14 Jul 2026 01:24:40 +0000	[thread overview]
Message-ID: <20260714012440.D8EA01F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260713-cbpf-jit-spray-hardening-6-18-y-v1-2-755f60c55705@linux.intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] BPF JIT allocations trigger a system-wide IPI broadcast for IBPB flushing, allowing an attacker to cause a severe local Denial of Service (DoS) by spamming BPF program loads.
--

--- Patch [2]: [PATCH 6.18.y 2/6] x86/bugs: Enable IBPB flush on BPF JIT allocation ---
commit 6fe177facacbbf6baebd63b419b7a3255bc1668f
Author: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>

x86/bugs: Enable IBPB flush on BPF JIT allocation

This commit enables an IBPB flush on BPF JIT memory reuse to mitigate
Spectre-v2 JIT spraying attacks. It adds bpf_arch_ibpb() to broadcast the
required MSR write system-wide when BPF JIT is active.

> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index d7fa03bf51b45..fd0b7880cf7e5 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
[ ... ]
> @@ -2383,6 +2396,27 @@ static void __init spectre_v2_update_mitigation(void)
>  		pr_info("%s\n", spectre_v2_strings[spectre_v2_enabled]);
>  }
>  
> +#ifdef CONFIG_BPF_JIT
> +static void __bpf_arch_ibpb(void *unused)
> +{
> +	write_ibpb();
> +}
> +
> +void bpf_arch_ibpb(void)
> +{
> +	on_each_cpu(__bpf_arch_ibpb, NULL, 1);
> +}

[Severity: High]
Does this introduce a potential local denial of service vector?

During BPF JIT compilation, bpf_prog_pack_alloc() invokes the predictor
flush unconditionally:

kernel/bpf/core.c:bpf_prog_pack_alloc() {
    ...
found_free_area:
	static_call_cond(bpf_arch_pred_flush)();
    ...
}

Since this results in calling bpf_arch_ibpb() which uses on_each_cpu() with
wait=1, won't this trigger a synchronous system-wide IPI broadcast on every
BPF program load?

If a user spams BPF program loads or unloads in a tight loop, could this
create an IPI storm that starves other tasks and locks up the system?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260713-cbpf-jit-spray-hardening-6-18-y-v1-0-755f60c55705@linux.intel.com?part=2

  reply	other threads:[~2026-07-14  1:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14  1:11 [PATCH 6.18.y 0/6] cBPF JIT spray hardening Pawan Gupta
2026-07-14  1:11 ` Pawan Gupta
2026-07-14  1:11 ` [PATCH 6.18.y 1/6] bpf: Support for hardening against JIT spraying Pawan Gupta
2026-07-14  1:11   ` Pawan Gupta
2026-07-14  1:23   ` sashiko-bot
2026-07-14  1:11 ` [PATCH 6.18.y 2/6] x86/bugs: Enable IBPB flush on BPF JIT allocation Pawan Gupta
2026-07-14  1:11   ` Pawan Gupta
2026-07-14  1:24   ` sashiko-bot [this message]
2026-07-14  1:12 ` [PATCH 6.18.y 3/6] bpf: Restrict JIT predictor flush to cBPF Pawan Gupta
2026-07-14  1:12   ` Pawan Gupta
2026-07-14  1:24   ` sashiko-bot
2026-07-14  1:12 ` [PATCH 6.18.y 4/6] bpf: Skip redundant IBPB in pack allocator Pawan Gupta
2026-07-14  1:12   ` Pawan Gupta
2026-07-14  1:12 ` [PATCH 6.18.y 5/6] bpf: Prefer packs that won't trigger an IBPB flush on allocation Pawan Gupta
2026-07-14  1:12   ` Pawan Gupta
2026-07-14  1:12 ` [PATCH 6.18.y 6/6] bpf: Prefer dirty packs for eBPF allocations Pawan Gupta
2026-07-14  1:12   ` Pawan Gupta
2026-07-15  0:12 ` [PATCH 6.18.y 0/6] cBPF JIT spray hardening Sasha Levin
2026-07-15  0:12   ` Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260714012440.D8EA01F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.