sys_ni: Fix cond_syscall() alias for LTO

When using LTO, the conditional syscall aliases aren't weak, and instead
override implemented syscalls rather than serve as a fallback for
missing syscalls. Fix the cond_syscall() alias using an attribute so
that it gets properly evaluated at link time.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
This commit is contained in:
Sultan Alsawaf 2020-03-10 21:19:28 -07:00 committed by spakkkk
parent 23055407dc
commit da7364b282
2 changed files with 2 additions and 9 deletions

View File

@ -23,10 +23,8 @@
#endif
#ifndef cond_syscall
#define cond_syscall(x) asm( \
".weak " __stringify(x) "\n\t" \
".set " __stringify(x) "," \
__stringify(sys_ni_syscall))
#define cond_syscall(x) \
long __attribute__((weak, alias("sys_ni_syscall"))) x(void);
#endif
#ifndef SYSCALL_ALIAS

View File

@ -32,11 +32,6 @@ KCOV_INSTRUMENT_kcov.o := n
KASAN_SANITIZE_kcov.o := n
CFLAGS_kcov.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
ifndef CONFIG_CFI_CLANG
# cond_syscall is currently not gcc LTO compatible
CFLAGS_sys_ni.o = $(DISABLE_LTO)
endif
# Don't instrument error handlers
CFLAGS_cfi.o = $(DISABLE_CFI_CLANG)