3
0
mirror of https://github.com/Qortal/Brooklyn.git synced 2025-02-01 07:42:18 +00:00
Brooklyn/include/linux/cfi.h

40 lines
1.0 KiB
C
Raw Permalink Normal View History

2022-04-02 13:17:33 +00:00
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Clang Control Flow Integrity (CFI) support.
*
2022-12-14 06:30:32 +00:00
* Copyright (C) 2022 Google LLC
2022-04-02 13:17:33 +00:00
*/
#ifndef _LINUX_CFI_H
#define _LINUX_CFI_H
2022-12-14 06:30:32 +00:00
#include <linux/bug.h>
#include <linux/module.h>
2022-04-02 13:17:33 +00:00
2022-12-14 06:30:32 +00:00
#ifdef CONFIG_CFI_CLANG
enum bug_trap_type report_cfi_failure(struct pt_regs *regs, unsigned long addr,
unsigned long *target, u32 type);
2022-12-14 06:30:32 +00:00
static inline enum bug_trap_type report_cfi_failure_noaddr(struct pt_regs *regs,
unsigned long addr)
{
return report_cfi_failure(regs, addr, NULL, 0);
}
2022-04-02 13:17:33 +00:00
2022-12-14 06:30:32 +00:00
#ifdef CONFIG_ARCH_USES_CFI_TRAPS
bool is_cfi_trap(unsigned long addr);
#endif
2022-04-02 13:17:33 +00:00
#endif /* CONFIG_CFI_CLANG */
2022-12-14 06:30:32 +00:00
#ifdef CONFIG_MODULES
#ifdef CONFIG_ARCH_USES_CFI_TRAPS
void module_cfi_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
struct module *mod);
#else
static inline void module_cfi_finalize(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
struct module *mod) {}
#endif /* CONFIG_ARCH_USES_CFI_TRAPS */
#endif /* CONFIG_MODULES */
2022-04-02 13:17:33 +00:00
#endif /* _LINUX_CFI_H */