bpf: powerpc64: pad function address loads with NOPs
authorSandipan Das <sandipan@linux.vnet.ibm.com>
Thu, 24 May 2018 06:56:46 +0000 (12:26 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Aug 2018 05:50:31 +0000 (07:50 +0200)
commit39da0cf774db1f1ac41caa4d01a8c63903e5f85d
tree1385e7ca794961d371df10abc4782b867bef2418
parentcf957ba7c6e8ab922ae45f46a31b5f8370bcf889
bpf: powerpc64: pad function address loads with NOPs

[ Upstream commit 4ea69b2fd623dee2bbc77d3b6b7d8c0924e2026a ]

For multi-function programs, loading the address of a callee
function to a register requires emitting instructions whose
count varies from one to five depending on the nature of the
address.

Since we come to know of the callee's address only before the
extra pass, the number of instructions required to load this
address may vary from what was previously generated. This can
make the JITed image grow or shrink.

To avoid this, we should generate a constant five-instruction
when loading function addresses by padding the optimized load
sequence with NOPs.

Signed-off-by: Sandipan Das <sandipan@linux.vnet.ibm.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/net/bpf_jit_comp64.c