Re: [RFC PATCH 1/2] kprobes: Prohibit probing on CFI preamble symbol

From: Peter Zijlstra
Date: Mon Jul 10 2023 - 11:37:43 EST


On Mon, Jul 10, 2023 at 09:14:24PM +0900, Masami Hiramatsu (Google) wrote:


> +#ifdef CONFIG_CFI_CLANG
> +static bool is_cfi_preamble_symbol(unsigned long addr)
> +{
> + char symbuf[KSYM_NAME_LEN];
> +
> + if (lookup_symbol_name(addr, symbuf))
> + return false;
> +
> + return str_has_prefix("__cfi_", symbuf)
|| str_has_prefix("__pfx_", symbol);

The __pfx_ symbols can happen when !CFI_CLANG but still having
FUNCTION_PADDING_BYTES.

> +}
> +#else
> +#define is_cfi_preamble_symbol(addr) (0)
> +#endif

As such I think we can do the above unconditionally, without either
there should not be any matching symbols.