arm64: ftrace: fix branch range checks
Mark Rutland authored
[ Upstream commit 3eefdf9d ]

The branch range checks in ftrace_make_call() and ftrace_make_nop() are
incorrect, erroneously permitting a forwards branch of 128M and
erroneously rejecting a backwards branch of 128M.

This is because both functions calculate the offset backwards,
calculating the offset *from* the target *to* the branch, rather than
the other way around as the later comparisons expect.

If an out-of-range branch were erroeously permitted, this would later be
rejected by aarch64_insn_gen_branch_imm() as branch_imm_common() checks
the bounds correctly, resulting in warnings and the placement of a BRK
instruction. Note that this can only happen for a forwards branch of
exactly 128M, and so the caller would need to be exactly 128M bytes
below the relevant ftrace trampoline.

If an in-range branch were erroeously rejected, then:

* For modules when CONFIG_ARM64_MODULE_PLTS=y, this would result in the
  use of a PLT entry, whi...
a39d42b0
Name Last commit Last update
Documentation x86/speculation/mmio: Add sysfs reporting for Processor MMIO Stale Data
LICENSES LICENSES/dual/CC-BY-4.0: Git rid of "smart quotes"
arch arm64: ftrace: fix branch range checks
block block: make bioset_exit() fully resilient against being called twice
certs certs: Add support for using elliptic curve keys for signing modules
crypto crypto: cryptd - Protect per-CPU resource by disabling BH.
drivers net: bgmac: Fix an erroneous kfree() in bgmac_remove()
fs io_uring: fix races with buffer table unregister
include x86/speculation/mmio: Add sysfs reporting for Processor MMIO Stale Data
init Kconfig: Add option for asm goto w/ tied outputs to workaround clang-13 bug
ipc ipc/mqueue: use get_tree_nodev() in mqueue_get_tree()
kernel dma-debug: make things less spammy under memory pressure
lib iov_iter: fix build issue due to possible type mis-match
mm mm/memremap: fix missing call to untrack_pfn() in pagemap_range()
net net: ax25: Fix deadlock caused by skb_recv_datagram in ax25_recvmsg
samples samples/landlock: Format with clang-format
scripts scripts/gdb: change kernel config dumping method
security KEYS: trusted: tpm2: Fix migratable logic
sound ALSA: hda/realtek - Add HW8326 support
tools KVM: x86/speculation: Disable Fill buffer clear within guests
usr usr/include/Makefile: add linux/nfc.h to the compile-test coverage
virt KVM: avoid NULL pointer dereference in kvm_dirty_ring_push
.clang-format clang-format: Update with the latest for_each macro list
.cocciconfig scripts: add Linux .cocciconfig for coccinelle
.get_maintainer.ignore Opt out of scripts/get_maintainer.pl
.gitattributes .gitattributes: use 'dts' diff driver for dts files
.gitignore .gitignore: ignore only top-level modules.builtin
.mailmap mailmap: add Andrej Shadura
COPYING COPYING: state that all contributions really are covered by this file
CREDITS MAINTAINERS: Move Daniel Drake to credits
Kbuild kbuild: rename hostprogs-y/always to hostprogs/always-y
Kconfig kbuild: ensure full rebuild when the compiler is updated
MAINTAINERS MAINTAINERS: add git tree for random.c
Makefile gcc-12: disable '-Wdangling-pointer' warning for now
README Drop all 00-INDEX files from Documentation/
Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.