Re: [PATCH] ftrace: don't allow IPMODIFY without proper compiler support (was Re: Re: livepatching tree for linux-next)

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

 



On Wed, 14 Jan 2015, Masami Hiramatsu wrote:

> > diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h
> > index f45acad..29fa417 100644
> > --- a/arch/x86/include/asm/ftrace.h
> > +++ b/arch/x86/include/asm/ftrace.h
> > @@ -4,8 +4,10 @@
> >  #ifdef CONFIG_FUNCTION_TRACER
> >  #ifdef CC_USING_FENTRY
> >  # define MCOUNT_ADDR		((long)(__fentry__))
> > +# define arch_ftrace_ipmodify_compiler_support(void) ({ 1; })
> >  #else
> >  # define MCOUNT_ADDR		((long)(mcount))
> > +#define arch_ftrace_ipmodify_compiler_support(void) ({ 0; })
> 
> Hmm, can we just define ARCH_FTRACE_SUPPORT_IPMODIFY here?

Yup, that's more or less what Steven suggested as well. I'll send v2.

> > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> > index 929a733..11370fd 100644
> > --- a/kernel/trace/ftrace.c
> > +++ b/kernel/trace/ftrace.c
> > @@ -1809,6 +1809,11 @@ static int __ftrace_hash_update_ipmodify(struct ftrace_ops *ops,
> >  	if (!(ops->flags & FTRACE_OPS_FL_IPMODIFY))
> >  		return 0;
> >  
> > +	if (!arch_ftrace_ipmodify_compiler_support()) {
> > +		WARN(1, "Your compiler doesn't support features necessary for IPMODIFY");
> > +		return 0;
> > +	}
> 
> Actually, if ftrace doesn't support IPMODIFY, I would like to just drop
> the entire code for CONFIG_KPROBES_ON_FTRACE(this is a hidden config),
> instead of checking at runtime.
> 
> So, there are 2 ifdefs of code in kernel/kprobes.c for 
> CONFIG_KPROBES_ON_FTRACE, those should also check 
> ARCH_FTRACE_SUPPORT_IPMODIFY too.

Makes sense. Will send that as a followup patch once the way how to do 
this in ftrace is settled.

Thanks,

-- 
Jiri Kosina
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-next" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux