Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull arm64 fixes from Will Deacon:
"Nothing particularly interesting here, but all important fixes
nonetheless:

- Add missing PAN toggling in the futex code

- Fix missing #include that briefly caused issues in -next

- Allow changing of vmalloc permissions with set_memory_* (used by
bpf)"

* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
arm64: asm: Explicitly include linux/personality.h in asm/page.h
arm64: futex.h: Add missing PAN toggling
arm64: allow vmalloc regions to be set with set_memory_*

+22 -4
+2
arch/arm64/include/asm/futex.h
··· 121 121 return -EFAULT; 122 122 123 123 asm volatile("// futex_atomic_cmpxchg_inatomic\n" 124 + ALTERNATIVE("nop", SET_PSTATE_PAN(0), ARM64_HAS_PAN, CONFIG_ARM64_PAN) 124 125 " prfm pstl1strm, %2\n" 125 126 "1: ldxr %w1, %2\n" 126 127 " sub %w3, %w1, %w4\n" ··· 138 137 " .align 3\n" 139 138 " .quad 1b, 4b, 2b, 4b\n" 140 139 " .popsection\n" 140 + ALTERNATIVE("nop", SET_PSTATE_PAN(1), ARM64_HAS_PAN, CONFIG_ARM64_PAN) 141 141 : "+r" (ret), "=&r" (val), "+Q" (*uaddr), "=&r" (tmp) 142 142 : "r" (oldval), "r" (newval), "Ir" (-EFAULT) 143 143 : "memory");
+1
arch/arm64/include/asm/page.h
··· 39 39 40 40 #ifndef __ASSEMBLY__ 41 41 42 + #include <linux/personality.h> /* for READ_IMPLIES_EXEC */ 42 43 #include <asm/pgtable-types.h> 43 44 44 45 extern void __cpu_clear_user_page(void *p, unsigned long user);
+19 -4
arch/arm64/mm/pageattr.c
··· 14 14 #include <linux/mm.h> 15 15 #include <linux/module.h> 16 16 #include <linux/sched.h> 17 + #include <linux/vmalloc.h> 17 18 18 19 #include <asm/pgtable.h> 19 20 #include <asm/tlbflush.h> ··· 45 44 unsigned long end = start + size; 46 45 int ret; 47 46 struct page_change_data data; 47 + struct vm_struct *area; 48 48 49 49 if (!PAGE_ALIGNED(addr)) { 50 50 start &= PAGE_MASK; ··· 53 51 WARN_ON_ONCE(1); 54 52 } 55 53 56 - if (start < MODULES_VADDR || start >= MODULES_END) 57 - return -EINVAL; 58 - 59 - if (end < MODULES_VADDR || end >= MODULES_END) 54 + /* 55 + * Kernel VA mappings are always live, and splitting live section 56 + * mappings into page mappings may cause TLB conflicts. This means 57 + * we have to ensure that changing the permission bits of the range 58 + * we are operating on does not result in such splitting. 59 + * 60 + * Let's restrict ourselves to mappings created by vmalloc (or vmap). 61 + * Those are guaranteed to consist entirely of page mappings, and 62 + * splitting is never needed. 63 + * 64 + * So check whether the [addr, addr + size) interval is entirely 65 + * covered by precisely one VM area that has the VM_ALLOC flag set. 66 + */ 67 + area = find_vm_area((void *)addr); 68 + if (!area || 69 + end > (unsigned long)area->addr + area->size || 70 + !(area->flags & VM_ALLOC)) 60 71 return -EINVAL; 61 72 62 73 if (!numpages)