arm64 fixes for -rc1

- Fix randconfig build failure due to missing include of asm/insn.h.
 
 - Reject unaligned hardware watchpoints which were silently being
   truncated.
 
 - Fix crash in KVM initialisation by deferring the read-only remapping
   of the kernel data and bss sections.
 -----BEGIN PGP SIGNATURE-----
 
 iQFEBAABCgAuFiEEPxTL6PPUbjXGY88ct6xw3ITBYzQFAmo9LYkQHHdpbGxAa2Vy
 bmVsLm9yZwAKCRC3rHDchMFjNKwJCACHfG4pnvgpqlPintNCHhFD1ITuQCJBP+zs
 UXtUA3iMCA5jEpVmXx7XHrXj4fALkXVFFvia2XVDVTOcj57lbv4+xi8x8Q+DID6G
 K47sXjpodBc1sNmNWiDRQn67l6EejFpxpfJzVfXEMw0wu0AWfcY+skNUuKdRdN0N
 EVMn/0iCHQgs7X4orL9PySYn7lx7mv8WLXCquvRKHKRTEZkFN8l4p2bFWX1RCbzY
 zEQY62uAZfZPDUEnP3aWBjvRhDsDZIdxXLQAU6OfOWXTK4XsoJOuKE84dboNHTB3
 EGkeioeYlKbPpKJDzDdZPZjO/M4IUfhINAGuHGw61S6ChxZD6UEZ
 =7FJU
 -----END PGP SIGNATURE-----

Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux

Pull arm64 fixes from Will Deacon:
 "Small crop of arm64 fixes for -rc1. We've got a build fix for a new
  randconfig permutation, a fix for a long-standing truncation issue
  with hardware watchpoints and a KVM initialisation fix for the newly
  merged remapping of the kernel data and bss sections:

   - Fix randconfig build failure due to missing include of asm/insn.h

   - Reject unaligned hardware watchpoints which were silently being
     truncated

   - Fix crash in KVM initialisation by deferring the read-only
     remapping of the kernel data and bss sections"

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
  arm64: mm: Defer read-only remap of data/bss linear alias
  arm64/hw_breakpoint: reject unaligned watchpoints that would truncate BAS
  arm64: static_call: include asm/insns.h
This commit is contained in:
Linus Torvalds 2026-06-26 08:40:35 -07:00
commit e7c93451ee
3 changed files with 16 additions and 5 deletions

View File

@ -559,6 +559,15 @@ int hw_breakpoint_arch_parse(struct perf_event *bp,
else
alignment_mask = 0x7;
offset = hw->address & alignment_mask;
/*
* BAS is an 8-bit field in WCR/BCR; the shift below would
* silently drop the high bits of ctrl.len when offset + len
* exceeds 8, programming hardware to watch fewer bytes than
* the user requested.
*/
if (((u32)hw->ctrl.len << offset) > ARM_BREAKPOINT_LEN_8)
return -EINVAL;
}
hw->address &= ~alignment_mask;

View File

@ -2,6 +2,7 @@
#include <linux/static_call.h>
#include <linux/memory.h>
#include <asm/text-patching.h>
#include <asm/insn.h>
void arch_static_call_transform(void *site, void *tramp, void *func, bool tail)
{

View File

@ -1198,11 +1198,6 @@ static void __init map_mem(void)
__map_memblock(start, end, pgprot_tagged(PAGE_KERNEL),
flags);
}
/* Map the kernel data/bss read-only in the linear map */
__map_memblock(init_end, kernel_end, PAGE_KERNEL_RO, flags);
flush_tlb_kernel_range((unsigned long)lm_alias(__init_end),
(unsigned long)lm_alias(__bss_stop));
}
void mark_rodata_ro(void)
@ -1221,6 +1216,12 @@ void mark_rodata_ro(void)
update_mapping_prot(__pa_symbol(_text), (unsigned long)_text,
(unsigned long)_stext - (unsigned long)_text,
PAGE_KERNEL_RO);
/* Map the kernel data/bss read-only in the linear map */
update_mapping_prot(__pa_symbol(__init_end),
(unsigned long)lm_alias(__init_end),
(unsigned long)__bss_stop - (unsigned long)__init_end,
PAGE_KERNEL_RO);
}
static void __init declare_vma(struct vm_struct *vma,