Files
android_kernel_xiaomi_sm8450/arch/x86/include/asm/sections.h
Sami Tolvanen 13f7806690 ANDROID: x86: map CFI jump tables in pti_clone_entry_text
Allow CFI enabled entry code to make indirect calls by also mapping
CFI jump tables, and add a check to ensure the jump table section is
not empty.

Bug: 145210207
Change-Id: I4ad3506f7a365cd068009348d45b54e228e42e33
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2021-01-14 16:35:28 +00:00

39 lines
941 B
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_X86_SECTIONS_H
#define _ASM_X86_SECTIONS_H
#define arch_is_kernel_initmem_freed arch_is_kernel_initmem_freed
#include <asm-generic/sections.h>
#include <asm/extable.h>
extern char __brk_base[], __brk_limit[];
extern char __cfi_jt_start[], __cfi_jt_end[];
extern char __end_rodata_aligned[];
#if defined(CONFIG_X86_64)
extern char __end_rodata_hpage_align[];
#endif
extern char __end_of_kernel_reserve[];
extern unsigned long _brk_start, _brk_end;
static inline bool arch_is_kernel_initmem_freed(unsigned long addr)
{
/*
* If _brk_start has not been cleared, brk allocation is incomplete,
* and we can not make assumptions about its use.
*/
if (_brk_start)
return 0;
/*
* After brk allocation is complete, space between _brk_end and _end
* is available for allocation.
*/
return addr >= _brk_end && addr < (unsigned long)&_end;
}
#endif /* _ASM_X86_SECTIONS_H */