lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aHoyjx1xJJVP6Khz@willie-the-truck>
Date: Fri, 18 Jul 2025 12:39:59 +0100
From: Will Deacon <will@...nel.org>
To: Sami Tolvanen <samitolvanen@...gle.com>
Cc: bpf@...r.kernel.org, Puranjay Mohan <puranjay@...nel.org>,
	Alexei Starovoitov <ast@...nel.org>,
	Daniel Borkmann <daniel@...earbox.net>,
	Catalin Marinas <catalin.marinas@....com>,
	Andrii Nakryiko <andrii@...nel.org>,
	Mark Rutland <mark.rutland@....com>,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	Maxwell Bland <mbland@...orola.com>
Subject: Re: [PATCH bpf-next v10 2/3] cfi: Move BPF CFI types and helpers to
 generic code

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@...gle.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ