aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAKASHI Takahiro <takahiro.akashi@linaro.org>2017-10-30 15:24:17 +0900
committerAKASHI Takahiro <takahiro.akashi@linaro.org>2017-11-13 09:45:58 +0900
commitb5a877851669c7a22841b74195e389892f98eb38 (patch)
tree5efcb539bf4532880d905ac19223bd8ce53a9fb7
parent4ff49eea74201faf08ff2cfba8d2f51124729843 (diff)
downloadlinux-aarch64-arm64/livepatch.tar.gz
(tmp) arm64: livep fix for latest kernelarm64/livepatch
-rw-r--r--Makefile2
-rw-r--r--arch/arm64/Makefile8
-rw-r--r--arch/arm64/include/asm/thread_info.h4
-rw-r--r--arch/arm64/kernel/ftrace.c9
-rw-r--r--drivers/firmware/efi/libstub/Makefile2
-rw-r--r--include/asm-generic/vmlinux.lds.h4
-rw-r--r--include/linux/compiler.h4
7 files changed, 22 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index ccd981892ef2..c8939c019590 100644
--- a/Makefile
+++ b/Makefile
@@ -400,6 +400,8 @@ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common -fshort-wchar \
-Werror-implicit-function-declaration \
-Wno-format-security \
+ -Wno-attribute-alias \
+ -Wno-packed-not-aligned \
-std=gnu89 $(call cc-option,-fno-PIE)
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 5362897670a5..b61e07bf0760 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -83,11 +83,11 @@ endif
endif
ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
- CC_FLAGS_FTRACE := -fprolog-pad=2
- KBUILD_CPPFLAGS += -DCC_USING_PROLOG_PAD
- ifeq ($(call cc-option,-fprolog-pad=2),)
+ CC_FLAGS_FTRACE := --patchable-function-entry=2
+ KBUILD_CPPFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY
+ ifeq ($(call cc-option,--patchable-function-entry=2),)
$(warning Cannot use CONFIG_DYNAMIC_FTRACE_WITH_REGS: \
- -fprolog-pad not supported by compiler)
+ --patchable-function-entry not supported by compiler)
endif
endif
diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h
index ddded6497a8a..c9a7037e6633 100644
--- a/arch/arm64/include/asm/thread_info.h
+++ b/arch/arm64/include/asm/thread_info.h
@@ -87,6 +87,7 @@ void arch_setup_new_exec(void);
#define TIF_SYSCALL_AUDIT 9
#define TIF_SYSCALL_TRACEPOINT 10
#define TIF_SECCOMP 11
+#define TIF_PATCH_PENDING 6 /* FIXME */
#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
#define TIF_FREEZE 19
#define TIF_RESTORE_SIGMASK 20
@@ -102,13 +103,14 @@ void arch_setup_new_exec(void);
#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
#define _TIF_SECCOMP (1 << TIF_SECCOMP)
+#define _TIF_PATCH_PENDING (1 << TIF_PATCH_PENDING)
#define _TIF_UPROBE (1 << TIF_UPROBE)
#define _TIF_FSCHECK (1 << TIF_FSCHECK)
#define _TIF_32BIT (1 << TIF_32BIT)
#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
_TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE | \
- _TIF_UPROBE | _TIF_FSCHECK)
+ _TIF_PATCH_PENDING | _TIF_UPROBE | _TIF_FSCHECK)
#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
_TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \
diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
index 3e59f4062b8e..025315415a70 100644
--- a/arch/arm64/kernel/ftrace.c
+++ b/arch/arm64/kernel/ftrace.c
@@ -71,7 +71,9 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
{
unsigned long pc = rec->ip+REC_IP_BRANCH_OFFSET;
+#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
int ret;
+#endif
u32 old, new;
long offset = (long)pc - (long)addr;
@@ -126,8 +128,8 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
#endif /* CONFIG_ARM64_MODULE_PLTS */
}
-#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
old = aarch64_insn_gen_nop();
+#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
new = 0xaa1e03e9; /* mov x9,x30 */
ret = ftrace_modify_code(pc-REC_IP_BRANCH_OFFSET, old, new, true);
if (ret)
@@ -139,6 +141,8 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
return ftrace_modify_code(pc, old, new, true);
}
+/* FIXME */
+#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
unsigned long addr)
{
@@ -150,6 +154,7 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
return ftrace_modify_code(pc, old, new, true);
}
+#endif
/*
* Turn off the call to ftrace_caller() in instrumented function
@@ -164,7 +169,7 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec,
int ret;
/* FIXME */
-#ifdef CC_USING_PROLOG_PAD
+#ifdef CC_USING_PATCHABLE_FUNCTION_ENTRY
/* -fprolog-pad= does not generate a profiling call
initially; the NOPs are already there.
*/
diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile
index adaa4a964f0c..dc0a1a71fc0d 100644
--- a/drivers/firmware/efi/libstub/Makefile
+++ b/drivers/firmware/efi/libstub/Makefile
@@ -64,7 +64,7 @@ CFLAGS_arm64-stub.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
extra-$(CONFIG_EFI_ARMSTUB) := $(lib-y)
lib-$(CONFIG_EFI_ARMSTUB) := $(patsubst %.o,%.stub.o,$(lib-y))
-STUBCOPY_RM-y := -R *ksymtab* -R *kcrctab*
+STUBCOPY_RM-y := -R *ksymtab* -R *kcrctab* -R *patchable_function_entries
STUBCOPY_FLAGS-$(CONFIG_ARM64) += --prefix-alloc-sections=.init \
--prefix-symbols=__efistub_
STUBCOPY_RELOC-$(CONFIG_ARM64) := R_AARCH64_ABS
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index fd12fb5aac13..9432a4bf8bce 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -105,7 +105,9 @@
#ifdef CONFIG_FTRACE_MCOUNT_RECORD
#define MCOUNT_REC() . = ALIGN(8); \
VMLINUX_SYMBOL(__start_mcount_loc) = .; \
- *(__mcount_loc) *(__prolog_pads_loc) \
+ *(__mcount_loc) \
+ *(__patchable_function_entries) \
+ *(.init__patchable_function_entries) \
VMLINUX_SYMBOL(__stop_mcount_loc) = .;
#else
#define MCOUNT_REC()
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 6b0b4608cd89..8f1759f1817d 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -62,8 +62,8 @@ extern void __chk_io_ptr(const volatile void __iomem *);
#if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__)
#define notrace __attribute__((hotpatch(0,0)))
#else
-#ifdef CC_USING_PROLOG_PAD
-#define notrace __attribute__((prolog_pad(0)))
+#ifdef CC_USING_PATCHABLE_FUNCTION_ENTRY
+#define notrace __attribute__((patchable_function_entry(0)))
#else
#define notrace __attribute__((no_instrument_function))
#endif