(internal only) Re: [kpatch] [PATCH] livepatch v7: move x86 specific ftrace handler code to arch/x86

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



你的email客户端没配置好?tab全变成空格了。

于 2014/12/19 13:37, Li Bin 写道:
> The execution flow redirection related implemention in the livepatch
> ftrace handler is depended on the specific architecture. This patch
> introduces klp_arch_set_pc(like kgdb_arch_set_pc) interface to change
> the pt_regs.
> 
> Signed-off-by: Li Bin <huawei.libin@xxxxxxxxxx>
> ---
>  arch/x86/include/asm/livepatch.h |    5 +++++
>  kernel/livepatch/core.c          |    2 +-
>  2 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/include/asm/livepatch.h b/arch/x86/include/asm/livepatch.h
> index c2ae592..4cdec4e 100644
> --- a/arch/x86/include/asm/livepatch.h
> +++ b/arch/x86/include/asm/livepatch.h
> @@ -21,6 +21,7 @@
>  #define _ASM_X86_LIVEPATCH_H
> 
>  #include <linux/module.h>
> +#include <linux/ftrace.h>
> 
>  #ifdef CONFIG_LIVE_PATCHING
>  #ifndef CC_USING_FENTRY
> @@ -29,6 +30,10 @@
>  extern int klp_write_module_reloc(struct module *mod, unsigned long type,
>                   unsigned long loc, unsigned long value);
> 
> +static inline void klp_arch_set_pc(struct pt_regs *regs, unsigned long ip)
> +{
> +   regs->ip = ip;
> +}
>  #else
>  #error Live patching support is disabled; check CONFIG_LIVE_PATCHING
>  #endif
> diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
> index 0004a71..c4c04fd 100644
> --- a/kernel/livepatch/core.c
> +++ b/kernel/livepatch/core.c
> @@ -271,7 +271,7 @@ static void notrace klp_ftrace_handler(unsigned long ip,
>  {
>     struct klp_func *func = ops->private;
> 
> -   regs->ip = (unsigned long)func->new_func;
> +   klp_arch_set_pc(regs, (unsigned long)func->new_func);
>  }
> 
>  static int klp_disable_func(struct klp_func *func)
> 

--
To unsubscribe from this list: send the line "unsubscribe live-patching" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux