Kernel sources for Moto G9 (Play) (Guamp)
Find a file
Emil Renner Berthing 545b602395 riscv: Fix auipc+jalr relocation range checks
commit 0966d385830de3470b7131db8e86c0c5bc9c52dc upstream.

RISC-V can do PC-relative jumps with a 32bit range using the following
two instructions:

	auipc	t0, imm20	; t0 = PC + imm20 * 2^12
	jalr	ra, t0, imm12	; ra = PC + 4, PC = t0 + imm12

Crucially both the 20bit immediate imm20 and the 12bit immediate imm12
are treated as two's-complement signed values. For this reason the
immediates are usually calculated like this:

	imm20 = (offset + 0x800) >> 12
	imm12 = offset & 0xfff

..where offset is the signed offset from the auipc instruction. When
the 11th bit of offset is 0 the addition of 0x800 doesn't change the top
20 bits and imm12 considered positive. When the 11th bit is 1 the carry
of the addition by 0x800 means imm20 is one higher, but since imm12 is
then considered negative the two's complement representation means it
all cancels out nicely.

However, this addition by 0x800 (2^11) means an offset greater than or
equal to 2^31 - 2^11 would overflow so imm20 is considered negative and
result in a backwards jump. Similarly the lower range of offset is also
moved down by 2^11 and hence the true 32bit range is

	[-2^31 - 2^11, 2^31 - 2^11)

Signed-off-by: Emil Renner Berthing <kernel@esmil.dk>
Fixes: e2c0cdfba7 ("RISC-V: User-facing API")
Cc: stable@vger.kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-03-16 13:20:27 +01:00
arch riscv: Fix auipc+jalr relocation range checks 2022-03-16 13:20:27 +01:00
block block: Fix fsync always failed if once failed 2022-03-08 19:04:08 +01:00
certs certs: Trigger creation of RSA module signing key if it's not an RSA key 2021-09-22 11:47:51 +02:00
crypto crypto: pcrypt - Delay write to padata->info 2021-11-26 11:36:11 +01:00
Documentation x86/speculation: Update link to AMD speculation whitepaper 2022-03-11 10:15:11 +01:00
drivers net: macb: Fix lost RX packet wakeup race in NAPI receive 2022-03-16 13:20:27 +01:00
firmware Fix built-in early-load Intel microcode alignment 2020-01-23 08:21:29 +01:00
fs btrfs: add missing run of delayed items after unlink during log replay 2022-03-08 19:04:10 +01:00
include net/mlx5: Fix size field in bufferx_reg struct 2022-03-16 13:20:26 +01:00
init kbuild: add CONFIG_LD_IS_LLD 2022-03-11 10:15:12 +01:00
ipc shm: extend forced shm destroy to support objects from several IPC nses 2021-12-08 08:50:11 +01:00
kernel tracing: Ensure trace buffer is at least 4096 bytes large 2022-03-16 13:20:27 +01:00
lib lib/iov_iter: initialize "flags" in new pipe_buffer 2022-02-23 11:58:41 +01:00
LICENSES LICENSES: Remove CC-BY-SA-4.0 license text 2018-10-18 11:28:50 +02:00
mm memfd: fix F_SEAL_WRITE after shmem huge page allocated 2022-03-08 19:04:10 +01:00
net net-sysfs: add check for netdevice being present to speed_show 2022-03-16 13:20:27 +01:00
samples samples/kretprobes: Fix return value if register_kretprobe() failed 2021-11-26 11:36:11 +01:00
scripts kconfig: let 'shell' return enough output for deep path names 2022-02-23 11:58:42 +01:00
security ima: Allow template selection with ima_template[_fmt]= after ima_hash= 2022-02-16 12:51:43 +01:00
sound ASoC: ops: Shift tested values in snd_soc_put_volsw() by +min 2022-03-08 19:04:07 +01:00
tools selftests/memfd: clean up mapping in mfd_fail_write 2022-03-16 13:20:27 +01:00
usr initramfs: restore default compression behavior 2020-04-13 10:44:59 +02:00
virt KVM: remember position in kvm->vcpus array 2021-09-26 13:39:46 +02:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap libnvdimm-for-4.19_misc 2018-08-25 18:13:10 -07:00
COPYING
CREDITS 9p: remove Ron Minnich from MAINTAINERS 2018-08-17 16:20:26 -07:00
Kbuild
Kconfig
MAINTAINERS Documentation/llvm: add documentation on building w/ Clang/LLVM 2020-09-26 18:01:31 +02:00
Makefile Linux 4.19.234 2022-03-11 10:15:13 +01:00
README

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.
See Documentation/00-INDEX for a list of what is contained in each file.

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.