All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>, bpf@vger.kernel.org
Cc: Nicholas Carlini <npc@anthropic.com>,
	Alexei Starovoitov <ast@kernel.org>,
	 Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	 kkd@meta.com, kernel-team@meta.com
Subject: Re: [PATCH bpf v3 4/7] bpf: Restrict CO-RE poisoning to relocatable instructions
Date: Mon, 14 Sep 2026 13:09:34 -0700	[thread overview]
Message-ID: <33cf9d2c1925225d19a20c7bdb1f1527a7893953.camel@gmail.com> (raw)
In-Reply-To: <20260914131701.2529725-5-memxor@gmail.com>

On Mon, 2026-09-14 at 15:16 +0200, Kumar Kartikeya Dwivedi wrote:
> check_subprogs() verifies that each subprogram ends in an exit or an
> unconditional jump before in-kernel CO-RE relocations are applied.
> An unresolved relocation can then replace that terminal instruction with
> an invalid helper call. The resulting fall-through into another subprogram
> breaks the CFG invariant used by postorder and stack liveness analysis,
> which can write past their per-subprogram arrays.
> 
> Handle instruction poisoning after the instruction has passed the same
> class and operand-form checks used for a resolved relocation. This rejects
> relocations targeting jumps, calls, exits, register-source arithmetic, or
> non-immediate loads before they can alter the control flow. Keep poisoning
> supported instructions, including both halves of a plain ldimm64, so an
> unresolved relocation in dead code remains valid.
> 
> The shared relocation code applies this restriction to both libbpf and
> in-kernel CO-RE.
> 
> Fixes: efcda22aa541 ("bpf: compute instructions postorder per subprogram")
> Reported-by: Nicholas Carlini <npc@anthropic.com>
> Suggested-by: Nicholas Carlini <npc@anthropic.com>
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
> ---

Acked-by: Eduard Zingerman <eddyz87@gmail.com>

I think this commit is fine.
The error code is returned and the diagnostics is show if instruction
cannot be patched.

  parent reply	other threads:[~2026-09-14 20:09 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 13:16 [PATCH bpf v3 0/7] Misc bug fixes - part 5 Kumar Kartikeya Dwivedi
2026-09-14 13:16 ` [PATCH bpf v3 1/7] bpf: Make post-verification instruction rewrites killable Kumar Kartikeya Dwivedi
2026-09-14 14:30   ` bot+bpf-ci
2026-09-14 18:52   ` Eduard Zingerman
2026-09-14 13:16 ` [PATCH bpf v3 2/7] bpf: Preserve packet pointer class displacement in regsafe() Kumar Kartikeya Dwivedi
2026-09-14 14:30   ` bot+bpf-ci
2026-09-14 18:53   ` Eduard Zingerman
2026-09-14 13:16 ` [PATCH bpf v3 3/7] selftests/bpf: Test packet pointer class displacement pruning Kumar Kartikeya Dwivedi
2026-09-14 13:16 ` [PATCH bpf v3 4/7] bpf: Restrict CO-RE poisoning to relocatable instructions Kumar Kartikeya Dwivedi
2026-09-14 14:08   ` sashiko-bot
2026-09-14 14:15   ` bot+bpf-ci
2026-09-14 20:13     ` Eduard Zingerman
2026-09-14 19:54   ` Andrii Nakryiko
2026-09-14 20:21     ` Alexei Starovoitov
2026-09-14 20:42       ` Kumar Kartikeya Dwivedi
2026-09-14 21:02         ` Andrii Nakryiko
2026-09-14 20:09   ` Eduard Zingerman [this message]
2026-09-14 13:16 ` [PATCH bpf v3 5/7] selftests/bpf: Test CO-RE instruction poisoning restrictions Kumar Kartikeya Dwivedi
2026-09-14 14:30   ` bot+bpf-ci
2026-09-14 20:46   ` Eduard Zingerman
2026-09-14 13:16 ` [PATCH bpf v3 6/7] bpf: Assign lock identity to callback map values Kumar Kartikeya Dwivedi
2026-09-14 14:30   ` bot+bpf-ci
2026-09-14 19:33   ` Eduard Zingerman
2026-09-14 13:16 ` [PATCH bpf v3 7/7] selftests/bpf: Check callback map value lock identity Kumar Kartikeya Dwivedi
2026-09-14 14:45   ` bot+bpf-ci

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=33cf9d2c1925225d19a20c7bdb1f1527a7893953.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=emil@etsalapatis.com \
    --cc=kernel-team@meta.com \
    --cc=kkd@meta.com \
    --cc=memxor@gmail.com \
    --cc=npc@anthropic.com \
    /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.