mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
RISC-V updates for late v7.2-rc
- Fix a fault caused when the RISC-V Zbb-enabled strlen() is executed on a string that ends right before a page boundary, when the next page is unmapped - Fix a race with the misaligned vector performance testing code that can prevent the outcome of the test from being stored into the vDSO cache - Fix a kernel warning generated by the ftrace code when ftrace_modify_call_code() runs against a ftrace-traced function where a kprobe has already been attached. This shows up in the bpf kselftests -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEElRDoIDdEz9/svf2Kx4+xDQu9KksFAmp+hQMACgkQx4+xDQu9 KktD/hAAgVmzmzpnDwAEpENS57aWo9oNp8uihbM9Dlsi/MVzKKrT0AEsJbjifAQQ IBOIca4z+/R4TBxDif/npui/Z3JRsGzCR2iePbjmg1g78j79P3KTEihF2AN+pVnP Syx5lj6ilOMd9vvI7Akigceh+ZxNQ/OMPrfDFQtWHqyiJgy4Iskr9sM2elTsUx65 rEyYzqlHneq8L4GgeAWzzq4jbaWpEanlsGHKQ8WXC3UFdtZI70pFCrRSQ8qHx59k ZkDW280CaAUX52cqUc7W8EBgIXHG0vgfzyJ66NIumKo7eTlU0OXzLz4x41S05hep OEueIcyLMfMus7nfUZD6AeWrp4xJE0UW7aBD0COV9w1+uPJptahla8vH/NPcFLee uMuAP7S3B9Q/h3LlHUIQKIPa4jT1di2piuQZMScJokzjaEV2/xi7pt0N0kG8pHbu t1pc56KswXZzqqqHPHt9lS2NZimCnWw3ZS4mu8WJ/r/qMm7iLt2lSAySGfoCsdXi Eo3Fg2+HQr53ttm9SRUlKv6/iA3VIW60ZCz/n3eTcym7roz6HWqUqiZNmI/m6TW2 M33gGnvxm78+DxXbt5GNbHpbZQOxHM6xEZrmMwiWc4jXqh7IiD03ITMk8dq2ojNi oLm1qrv3Cv8MCXi2i/Hr+8qs+oVYm/Z6Jl7M9BsHEB1WuSPBrtw= =KAg1 -----END PGP SIGNATURE----- Merge tag 'riscv-for-linus-v7.2-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux Pull RISC-V fixes from Paul Walmsley: - Fix a fault caused when the RISC-V Zbb-enabled strlen() is executed on a string that ends right before a page boundary, when the next page is unmapped - Fix a race with the misaligned vector performance testing code that can prevent the outcome of the test from being stored into the vDSO cache - Fix a kernel warning generated by the ftrace code when ftrace_modify_call_code() runs against a ftrace-traced function where a kprobe has already been attached. This shows up in the bpf kselftests * tag 'riscv-for-linus-v7.2-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux: riscv: lib: Fix ZBB strnlen reading past count boundary riscv: hwprobe: Register unaligned probes before usermode riscv: ftrace: Fix ftrace_modify_call failure on kprobed functions
This commit is contained in:
commit
97a91cc439
|
|
@ -12,6 +12,7 @@
|
|||
#include <linux/stop_machine.h>
|
||||
#include <asm/cacheflush.h>
|
||||
#include <asm/text-patching.h>
|
||||
#include <asm/insn.h>
|
||||
|
||||
#ifdef CONFIG_DYNAMIC_FTRACE
|
||||
void ftrace_arch_code_modify_prepare(void)
|
||||
|
|
@ -63,7 +64,9 @@ static int __ftrace_modify_call(unsigned long source, unsigned long target, bool
|
|||
if (copy_from_kernel_nofault(replaced, (void *)source, 2 * MCOUNT_INSN_SIZE))
|
||||
return -EFAULT;
|
||||
|
||||
if (replaced[0] != call[0]) {
|
||||
/* Bypass the check if the auipc insn is a kprobe breakpoint */
|
||||
if (replaced[0] != call[0] &&
|
||||
!(riscv_insn_is_ebreak(replaced[0]) || riscv_insn_is_c_ebreak(replaced[0]))) {
|
||||
pr_err("%p: expected (%08x) but got (%08x)\n",
|
||||
(void *)source, call[0], replaced[0]);
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -411,4 +411,10 @@ static int __init check_unaligned_access_all_cpus(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
late_initcall(check_unaligned_access_all_cpus);
|
||||
/*
|
||||
* Run after clocksource_done_booting() so measure_cycles() uses a stable
|
||||
* clocksource, but before rootfs_initcall() enables usermode helpers. Those
|
||||
* helpers can reach hwprobe and populate the vDSO cache, so async hwprobe
|
||||
* probes must be registered first.
|
||||
*/
|
||||
fs_initcall_sync(check_unaligned_access_all_cpus);
|
||||
|
|
|
|||
|
|
@ -83,8 +83,13 @@ strnlen_zbb:
|
|||
sub t3, t3, t2
|
||||
slli t2, t2, 3
|
||||
|
||||
/* Aligned boundary. */
|
||||
/*
|
||||
* Aligned boundary. Use the address of the last valid byte
|
||||
* (s + count - 1) to avoid loading a word past the count
|
||||
* boundary in the loop below. count == 0 is handled above.
|
||||
*/
|
||||
add t4, a0, a1
|
||||
addi t4, t4, -1
|
||||
andi t4, t4, -SZREG
|
||||
|
||||
/* Get the first word. */
|
||||
|
|
@ -120,6 +125,9 @@ strnlen_zbb:
|
|||
|
||||
bgtu t3, a0, 2f
|
||||
|
||||
/* All remaining bytes are in the first word, no loop needed. */
|
||||
bgeu t0, t4, 2f
|
||||
|
||||
/* Prepare for the word comparison loop. */
|
||||
addi t2, t0, SZREG
|
||||
li t3, -1
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user