mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2026-01-04 20:44:27 +00:00
The return values of fixup_exception() and arm64_bpf_fixup_exception() represent a boolean condition rather than an error code, so for clarity it would be better to return `bool` rather than `int`. This patch adjusts the code accordingly. While we're modifying the prototype, we also remove the unnecessary `extern` keyword, so that this won't look out of place when we make subsequent additions to the header. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Andrii Nakryiko <andrii@kernel.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: James Morse <james.morse@arm.com> Cc: Jean-Philippe Brucker <jean-philippe@linaro.org> Cc: Robin Murphy <robin.murphy@arm.com> Cc: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20211019160219.5202-9-mark.rutland@arm.com Signed-off-by: Will Deacon <will@kernel.org>
48 lines
1.3 KiB
C
48 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef __ASM_EXTABLE_H
|
|
#define __ASM_EXTABLE_H
|
|
|
|
/*
|
|
* The exception table consists of pairs of relative offsets: the first
|
|
* is the relative offset to an instruction that is allowed to fault,
|
|
* and the second is the relative offset at which the program should
|
|
* continue. No registers are modified, so it is entirely up to the
|
|
* continuation code to figure out what to do.
|
|
*
|
|
* All the routines below use bits of fixup code that are out of line
|
|
* with the main instruction path. This means when everything is well,
|
|
* we don't even have to jump over them. Further, they do not intrude
|
|
* on our cache or tlb entries.
|
|
*/
|
|
|
|
struct exception_table_entry
|
|
{
|
|
int insn, fixup;
|
|
};
|
|
|
|
#define ARCH_HAS_RELATIVE_EXTABLE
|
|
|
|
static inline bool in_bpf_jit(struct pt_regs *regs)
|
|
{
|
|
if (!IS_ENABLED(CONFIG_BPF_JIT))
|
|
return false;
|
|
|
|
return regs->pc >= BPF_JIT_REGION_START &&
|
|
regs->pc < BPF_JIT_REGION_END;
|
|
}
|
|
|
|
#ifdef CONFIG_BPF_JIT
|
|
bool arm64_bpf_fixup_exception(const struct exception_table_entry *ex,
|
|
struct pt_regs *regs);
|
|
#else /* !CONFIG_BPF_JIT */
|
|
static inline
|
|
bool arm64_bpf_fixup_exception(const struct exception_table_entry *ex,
|
|
struct pt_regs *regs)
|
|
{
|
|
return false;
|
|
}
|
|
#endif /* !CONFIG_BPF_JIT */
|
|
|
|
bool fixup_exception(struct pt_regs *regs);
|
|
#endif
|