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>
Signed-off-by: Yousef Algadri <yusufgadrie@gmail.com>
Change-Id: I3c13715855843178ae7590814bb785037ae041c0
Signed-off-by: Panchajanya Sarkar <panchajanya@azure-dev.live>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
This commit is contained in:
Sultan Alsawaf
2020-03-10 21:19:28 -07:00
committed by UtsavBalar1231
parent 5432c1e3e8
commit c8cfdec485
2 changed files with 2 additions and 7 deletions

View File

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

View File

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