From: Will Deacon <will@kernel.org>
To: Sami Tolvanen <samitolvanen@google.com>
Cc: bpf@vger.kernel.org, Puranjay Mohan <puranjay@kernel.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Catalin Marinas <catalin.marinas@arm.com>,
Andrii Nakryiko <andrii@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Maxwell Bland <mbland@motorola.com>
Subject: Re: [PATCH bpf-next v10 2/3] cfi: Move BPF CFI types and helpers to generic code
Date: Fri, 18 Jul 2025 12:39:59 +0100 [thread overview]
Message-ID: <aHoyjx1xJJVP6Khz@willie-the-truck> (raw)
In-Reply-To: <20250715225733.3921432-7-samitolvanen@google.com>
On Tue, Jul 15, 2025 at 10:57:36PM +0000, Sami Tolvanen wrote:
> Instead of duplicating the same code for each architecture, move
> the CFI type hash variables for BPF function types and related
> helper functions to generic CFI code, and allow architectures to
> override the function definitions if needed.
>
> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
> ---
> arch/riscv/include/asm/cfi.h | 16 ---------------
> arch/riscv/kernel/cfi.c | 24 -----------------------
> arch/x86/include/asm/cfi.h | 9 ---------
> arch/x86/kernel/alternative.c | 12 ------------
> include/linux/cfi.h | 37 +++++++++++++++++++++++++++--------
> kernel/cfi.c | 25 +++++++++++++++++++++++
> 6 files changed, 54 insertions(+), 69 deletions(-)
[...]
> @@ -27,6 +29,29 @@ enum bug_trap_type report_cfi_failure(struct pt_regs *regs, unsigned long addr,
> return BUG_TRAP_TYPE_BUG;
> }
>
> +u32 __weak cfi_get_func_hash(void *func)
> +{
> + u32 hash;
> +
> + if (get_kernel_nofault(hash, func - cfi_get_offset()))
> + return 0;
> +
> + return hash;
> +}
Do you really need the '__weak' function definition here, or could you
use an '#ifndef cfi_get_func_hash' guard, a bit like you're doing for
cfi_get_offset()?
Will
next prev parent reply other threads:[~2025-07-18 12:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-15 22:57 [PATCH bpf-next v10 0/3] Support kCFI + BPF on arm64 Sami Tolvanen
2025-07-15 22:57 ` [PATCH bpf-next v10 1/3] cfi: add C CFI type macro Sami Tolvanen
2025-07-18 11:33 ` Will Deacon
2025-07-15 22:57 ` [PATCH bpf-next v10 2/3] cfi: Move BPF CFI types and helpers to generic code Sami Tolvanen
2025-07-18 11:39 ` Will Deacon [this message]
2025-07-18 22:27 ` Sami Tolvanen
2025-07-15 22:57 ` [PATCH bpf-next v10 3/3] arm64/cfi,bpf: Support kCFI + BPF on arm64 Sami Tolvanen
2025-07-18 11:42 ` Will Deacon
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=aHoyjx1xJJVP6Khz@willie-the-truck \
--to=will@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=catalin.marinas@arm.com \
--cc=daniel@iogearbox.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mbland@motorola.com \
--cc=puranjay@kernel.org \
--cc=samitolvanen@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).