OSDN Git Service

MIPS: BPF: Quit clobbering callee saved registers in JIT code.
authorDavid Daney <david.daney@cavium.com>
Tue, 14 Mar 2017 21:21:43 +0000 (14:21 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Mar 2018 08:17:49 +0000 (09:17 +0100)
commite50c396af21ca45061f8550563825c8b84556075
tree81b74d4fefbbc8a7779b53f2bb162f470c231a44
parent57a84887bc773d937bc87a558ffdf2f21f91c786
MIPS: BPF: Quit clobbering callee saved registers in JIT code.

[ Upstream commit 1ef0910cfd681f0bd0b81f8809935b2006e9cfb9 ]

If bpf_needs_clear_a() returns true, only actually clear it if it is
ever used.  If it is not used, we don't save and restore it, so the
clearing has the nasty side effect of clobbering caller state.

Also, don't emit stack pointer adjustment instructions if the
adjustment amount is zero.

Signed-off-by: David Daney <david.daney@cavium.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Steven J. Hill <steven.hill@cavium.com>
Cc: linux-mips@linux-mips.org
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/15745/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/mips/net/bpf_jit.c