Bug 104871

Summary: bcl+8 in arch/powerpc/kernel/vdso64/datapage.S causes branch prediction issues
Product: Platform Specific/Hardware Reporter: Aaron Sawdey (sawdey)
Component: PPC-64Assignee: platform_ppc-64
Status: CLOSED CODE_FIX    
Severity: high CC: michael, mikey
Priority: P1    
Hardware: PPC-64   
OS: Linux   
Kernel Version: all recent (3.11.10 through 4.3-rc2 at least) Subsystem:
Regression: No Bisected commit-id:

Description Aaron Sawdey 2015-09-22 20:09:14 UTC
The code in both 32 and 64 bit versions of datapage.S for vdso use a bcl+8 to capture the instruction address in the link register. On recent powerpc processors (i.e Power8) you will corrupt the link stack on-chip if you do a branch and link and then do not return. bcl+4 is a special case and is ok.

This code causes subsequent mispredicts of blr because the link stack is no longer correct.
Comment 1 Michael Neuling 2015-09-23 06:06:31 UTC
Thanks Aaron.  I've posted a patch to address this here:
  http://patchwork.ozlabs.org/patch/521590/
Comment 2 Michael Ellerman 2020-04-28 03:17:24 UTC
Fixed in:

c974809a26a1 ("powerpc/vdso: Avoid link stack corruption in __get_datapage()")

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c974809a26a13e40254dbe3cf46f49aa32acca11