Re: [PATCH] powerpc/ftrace: restore r2 to caller's stack on livepatch sibling call

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

 



Hi Ryan,

Thanks for the patch.

Ryan Sullivan <rysulliv@xxxxxxxxxx> writes:
> Currently, on PowerPC machines, sibling calls in livepatched functions
> cause the stack to be corrupted and are thus not supported by tools
> such as kpatch. Below is an example stack frame showing one such
> currupted stacks:
...
> diff --git a/arch/powerpc/kernel/trace/ftrace_entry.S b/arch/powerpc/kernel/trace/ftrace_entry.S
> index 76dbe9fd2c0f..4dfbe6076ad1 100644
> --- a/arch/powerpc/kernel/trace/ftrace_entry.S
> +++ b/arch/powerpc/kernel/trace/ftrace_entry.S
> @@ -244,6 +244,9 @@ livepatch_handler:
>  	mtlr	r12
>  	ld	r2,  -24(r11)
>  
> +	/* Restore toc to caller's stack in case of sibling call */
> +	std	r2, 24(r1)
> +

It would be good to have a comment here explaining why it's safe in all
cases to store the current r2 value back to the caller's save slot.

I haven't convinced myself that it is always safe, but I need to think
about it a bit harder O_o

cheers




[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