Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
2ac5206
livepatch/core: Allow implementation without ftrace
May 29, 2021
2538132
livepatch/core: Restrict livepatch patched/unpatched when plant kprobe
May 29, 2021
5267334
livepatch/core: Split livepatch consistency
May 29, 2021
3627ca4
livepatch/core: Supprt load and unload hooks
May 29, 2021
5fab5bb
livepatch/core: Support jump_label
May 29, 2021
607e697
livepatch/arm64: Support livepatch without ftrace
May 29, 2021
bb2fb61
livepatch/arm64: Fix func size less than limit
May 29, 2021
6b8b573
livepatch/arm64: Fix current backtracking in klp_check_calltrace
May 29, 2021
edb391b
livepatch/arm64: check active func in consistency stack checking
May 29, 2021
0ec4bd6
livepatch/core: Add livepatch consistency depends
May 29, 2021
889355b
arm/module: Use plt section indices for relocations
May 29, 2021
88b2c07
livepatch/core: Add support for arm for klp relocation
May 29, 2021
9e359f7
livepatch/arm: Support livepatch without ftrace
libin2015 May 29, 2021
62cbf70
livepatch/arm: Fix current backtracking in klp_check_calltrace
May 29, 2021
d0cabc3
livepatch/arm: Add support for livepatch plt
May 29, 2021
a86eca7
livepatch/arm: Check active func in consistency stack checking
May 29, 2021
12474d8
livepatch/core: Revert module_enable_ro and module_disable_ro
May 29, 2021
8958ee7
livepatch/x86: support livepatch without ftrace
May 29, 2021
ee6ddb6
livepatch/x86: check active func in consistency stack checking
May 29, 2021
48a998d
livepatch/ppc32: Support livepatch without ftrace
libin2015 May 29, 2021
1e1277a
livepatch/ppc32: Add support for longjump
May 29, 2021
e20f0a5
livepatch/ppc32: Fix func size less than limit
May 29, 2021
ec82dac
livepatch/ppc32: Fix current backtracking in klp_check_calltrace
May 29, 2021
006790f
livepatch/ppc32: Check active func in consistency stack checking
May 29, 2021
40c32d1
livepatch/ppc32: Ignore the first frame when checking stack
shaolexi May 29, 2021
2ce1a73
livepatch/ppc64: Implement livepatch without ftrace for ppc64be
May 29, 2021
7bf8706
livepatch/ppc64: Support use func_descr for new_func
May 29, 2021
d9b284c
livepatch/ppc64: Check active func in consistency stack checking
May 29, 2021
3f714e9
livepatch/ppc64: Implement per func_node livepatch trampoline
May 29, 2021
5ee6c47
livepatch/ppc64: Use module_alloc to alloc func_node
May 29, 2021
315f9cb
livepatch/ppc64: Make sure caller function in stack
May 29, 2021
d0e423a
livepatch/ppc64: Ignore the first frame when checking stack
shaolexi May 29, 2021
7846fcf
livepatch/ppc64: Sample testcase fix ppc64
May 29, 2021
f8e6bcd
livepatch/ppc64: Enable livepatch without ftrace
May 29, 2021
520deb6
livepatch/core: Support function force patched/unpatched
May 29, 2021
e8ef67e
livepatch: put memory alloc and free out stop machine
May 31, 2021
2501cec
livepatch: fix unload hook could not be excuted
Jun 23, 2021
a4ab930
livepatch: Add state describe for force
Oct 19, 2021
e4f028c
livepatch: checks only if the replaced instruction is on the stack
Oct 19, 2021
108cf88
livepatch/arm64: only check stack top
Oct 19, 2021
1e9df51
livepatch/arm: only check stack top
Oct 19, 2021
ff00659
livepatch/ppc32: only check stack top
Oct 19, 2021
38aa662
livepatch/ppc64: only check stack top
Oct 19, 2021
5fef18a
livepatch/x86: only check stack top
Oct 19, 2021
fbcdf89
livepatch: move arch_klp_mem_recycle after the return value judgment
Oct 19, 2021
4321455
livepatch: Fix compile warnning
Oct 19, 2021
32b0d02
livepatch: Add klp_{register,unregister}_patch for stop_machine model
Oct 19, 2021
96b009e
livepatch: Adapt livepatch-sample for stop_machine model
Oct 19, 2021
de27655
livepatch: Check whole stack when CONFIG_PREEMPT is set
Nov 15, 2021
cc1ffe4
livepatch: Fix crash when access the global variable in hook
Nov 26, 2021
048eaa3
livepatch/arm: fix incorrect stack detection
Nov 30, 2021
a59ce34
altra: enable CONFIG_LIVEPATCH
bobolmw Jan 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ config ARM
select RTC_LIB
select SET_FS
select SYS_SUPPORTS_APM_EMULATION
select HAVE_LIVEPATCH_WO_FTRACE
# Above selects are sorted alphabetically; please add new ones
# according to that. Thanks.
help
Expand Down Expand Up @@ -2050,3 +2051,5 @@ source "arch/arm/crypto/Kconfig"
endif

source "arch/arm/Kconfig.assembler"

source "kernel/livepatch/Kconfig"
39 changes: 39 additions & 0 deletions arch/arm/include/asm/livepatch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* livepatch.h - arm-specific Kernel Live Patching Core
*
* Copyright (C) 2018 Huawei Technologies Co., Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _ASM_ARM_LIVEPATCH_H
#define _ASM_ARM_LIVEPATCH_H

#include <linux/module.h>

struct klp_patch;
struct klp_func;

/* kernel livepatch instruction barrier */
#define klp_smp_isb() isb()

int arch_klp_patch_func(struct klp_func *func);
void arch_klp_unpatch_func(struct klp_func *func);

#ifdef CONFIG_LIVEPATCH_STOP_MACHINE_CONSISTENCY
int klp_check_calltrace(struct klp_patch *patch, int enable);
#endif

#endif /* _ASM_ARM_LIVEPATCH_H */
5 changes: 3 additions & 2 deletions arch/arm/include/asm/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ enum {
#endif

struct mod_plt_sec {
struct elf32_shdr *plt;
int plt_shndx;
int plt_count;
};

Expand All @@ -35,7 +35,8 @@ struct mod_arch_specific {
};

struct module;
u32 get_module_plt(struct module *mod, unsigned long loc, Elf32_Addr val);
u32 get_module_plt(struct module *mod, Elf32_Shdr *sechdrs,
unsigned long loc, Elf32_Addr val);

#ifdef CONFIG_THUMB2_KERNEL
#define HAVE_ARCH_KALLSYMS_SYMBOL_VALUE
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/include/asm/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp *,
#define TIF_SYSCALL_AUDIT 5 /* syscall auditing active */
#define TIF_SYSCALL_TRACEPOINT 6 /* syscall tracepoint instrumentation */
#define TIF_SECCOMP 7 /* seccomp syscall filtering active */
#define TIF_PATCH_PENDING 8 /* pending live patching update */

#define TIF_USING_IWMMXT 17
#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
Expand All @@ -149,6 +150,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp *,
#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
#define _TIF_SECCOMP (1 << TIF_SECCOMP)
#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
#define _TIF_PATCH_PENDING (1 << TIF_PATCH_PENDING)

/* Checks for any syscall work in entry-common.S */
#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
Expand Down
1 change: 1 addition & 0 deletions arch/arm/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ obj-$(CONFIG_ARM_ARCH_TIMER) += arch_timer.o
obj-$(CONFIG_FUNCTION_TRACER) += entry-ftrace.o
obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o insn.o patch.o
obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o insn.o patch.o
obj-$(CONFIG_LIVEPATCH) += livepatch.o insn.o patch.o
obj-$(CONFIG_JUMP_LABEL) += jump_label.o insn.o patch.o
obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
# Main staffs in KPROBES are in arch/arm/probes/ .
Expand Down
Loading