]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
bpf, arm64: Fix BTI type used for freplace attached functions
authorAlexander Duyck <alexanderduyck@fb.com>
Thu, 13 Jul 2023 16:49:31 +0000 (09:49 -0700)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Mon, 2 Oct 2023 15:20:39 +0000 (17:20 +0200)
commit3c109742d093cf45b09b06c0385aa13d7a922f91
tree1fca015ae00c20dd58389e4810bd2c42e382092c
parentcdf9efac889b6415141a49be56469bbaf77b840b
bpf, arm64: Fix BTI type used for freplace attached functions

BugLink: https://bugs.launchpad.net/bugs/2037005
[ Upstream commit a3f25d614bc73b45e8f02adc6769876dfd16ca84 ]

When running an freplace attached bpf program on an arm64 system w were
seeing the following issue:
  Unhandled 64-bit el1h sync exception on CPU47, ESR 0x0000000036000003 -- BTI

After a bit of work to track it down I determined that what appeared to be
happening is that the 'bti c' at the start of the program was somehow being
reached after a 'br' instruction. Further digging pointed me toward the
fact that the function was attached via freplace. This in turn led me to
build_plt which I believe is invoking the long jump which is triggering
this error.

To resolve it we can replace the 'bti c' with 'bti jc' and add a comment
explaining why this has to be modified as such.

Fixes: b2ad54e1533e ("bpf, arm64: Implement bpf_arch_text_poke() for arm64")
Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
Acked-by: Xu Kuohai <xukuohai@huawei.com>
Link: https://lore.kernel.org/r/168926677665.316237.9953845318337455525.stgit@ahduyck-xeon-server.home.arpa
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
arch/arm64/net/bpf_jit_comp.c