mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 08:44:21 +08:00
f47d4ffe3a
Commit252c765bd7
("riscv, bpf: Add BPF exception tables") only addressed RV64, and broke the RV32 build [1]. Fix by gating the exception tables code with CONFIG_ARCH_RV64I. Further, silence a "-Wmissing-prototypes" warning [2] in the RV64 BPF JIT. [1] https://lore.kernel.org/llvm/202111020610.9oy9Rr0G-lkp@intel.com/ [2] https://lore.kernel.org/llvm/202110290334.2zdMyRq4-lkp@intel.com/ Fixes:252c765bd7
("riscv, bpf: Add BPF exception tables") Signed-off-by: Björn Töpel <bjorn@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Reviewed-by: Tong Tiangen <tongtiangen@huawei.com> Link: https://lore.kernel.org/bpf/20211103115453.397209-1-bjorn@kernel.org
34 lines
877 B
C
34 lines
877 B
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Copyright (C) 2009 Sunplus Core Technology Co., Ltd.
|
|
* Lennox Wu <lennox.wu@sunplusct.com>
|
|
* Chen Liqin <liqin.chen@sunplusct.com>
|
|
* Copyright (C) 2013 Regents of the University of California
|
|
*/
|
|
|
|
|
|
#include <linux/extable.h>
|
|
#include <linux/module.h>
|
|
#include <linux/uaccess.h>
|
|
|
|
#if defined(CONFIG_BPF_JIT) && defined(CONFIG_ARCH_RV64I)
|
|
int rv_bpf_fixup_exception(const struct exception_table_entry *ex, struct pt_regs *regs);
|
|
#endif
|
|
|
|
int fixup_exception(struct pt_regs *regs)
|
|
{
|
|
const struct exception_table_entry *fixup;
|
|
|
|
fixup = search_exception_tables(regs->epc);
|
|
if (!fixup)
|
|
return 0;
|
|
|
|
#if defined(CONFIG_BPF_JIT) && defined(CONFIG_ARCH_RV64I)
|
|
if (regs->epc >= BPF_JIT_REGION_START && regs->epc < BPF_JIT_REGION_END)
|
|
return rv_bpf_fixup_exception(fixup, regs);
|
|
#endif
|
|
|
|
regs->epc = fixup->fixup;
|
|
return 1;
|
|
}
|