On 02/18/2016, 06:41 PM, Josh Poimboeuf wrote: > If __preempt_schedule() or __preempt_schedule_notrace() is referenced at > the beginning of a function, gcc can insert the asm inline "call > ___preempt_schedule[_notrace]" instruction before setting up a stack > frame, which breaks frame pointer convention if CONFIG_FRAME_POINTER is > enabled and can result in bad stack traces. > > Force a stack frame to be created if CONFIG_FRAME_POINTER is enabled by > listing the stack pointer as an output operand for the inline asm > statements. > > Specifically this fixes the following stacktool warnings: > > stacktool: drivers/scsi/hpsa.o: hpsa_scsi_do_simple_cmd.constprop.106()+0x79: call without frame pointer save/setup ... > Reported-by: Jiri Slaby <jslaby@xxxxxxx> This patch and adding lbug_with_loc to global_noreturns makes all stacktool warnings go away here. > Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx> > --- > arch/x86/include/asm/preempt.h | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h > index 01bcde8..d397deb 100644 > --- a/arch/x86/include/asm/preempt.h > +++ b/arch/x86/include/asm/preempt.h > @@ -94,10 +94,19 @@ static __always_inline bool should_resched(int preempt_offset) > > #ifdef CONFIG_PREEMPT > extern asmlinkage void ___preempt_schedule(void); > -# define __preempt_schedule() asm ("call ___preempt_schedule") > +# define __preempt_schedule() \ > +({ \ > + register void *__sp asm(_ASM_SP); \ > + asm volatile ("call ___preempt_schedule" : "+r"(__sp)); \ > +}) > + > extern asmlinkage void preempt_schedule(void); > extern asmlinkage void ___preempt_schedule_notrace(void); > -# define __preempt_schedule_notrace() asm ("call ___preempt_schedule_notrace") > +# define __preempt_schedule_notrace() \ > +({ \ > + register void *__sp asm(_ASM_SP); \ > + asm volatile ("call ___preempt_schedule_notrace" : "+r"(__sp)); \ > +}) > extern asmlinkage void preempt_schedule_notrace(void); > #endif > > thanks, -- js suse labs -- 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