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 branch 'akpm' (patches from Andrew)

Merge yet more updates from Andrew Morton:

- Almost all of the rest of MM (memcg, slab-generic, slab, pagealloc,
gup, hugetlb, pagemap, memremap)

- Various other things (hfs, ocfs2, kmod, misc, seqfile)

* akpm: (34 commits)
ipc/util.c: sysvipc_find_ipc() should increase position index
kernel/gcov/fs.c: gcov_seq_next() should increase position index
fs/seq_file.c: seq_read(): add info message about buggy .next functions
drivers/dma/tegra20-apb-dma.c: fix platform_get_irq.cocci warnings
change email address for Pali Rohár
selftests: kmod: test disabling module autoloading
selftests: kmod: fix handling test numbers above 9
docs: admin-guide: document the kernel.modprobe sysctl
fs/filesystems.c: downgrade user-reachable WARN_ONCE() to pr_warn_once()
kmod: make request_module() return an error when autoloading is disabled
mm/memremap: set caching mode for PCI P2PDMA memory to WC
mm/memory_hotplug: add pgprot_t to mhp_params
powerpc/mm: thread pgprot_t through create_section_mapping()
x86/mm: introduce __set_memory_prot()
x86/mm: thread pgprot_t through init_memory_mapping()
mm/memory_hotplug: rename mhp_restrictions to mhp_params
mm/memory_hotplug: drop the flags field from struct mhp_restrictions
mm/special: create generic fallbacks for pte_special() and pte_mkspecial()
mm/vma: introduce VM_ACCESS_FLAGS
mm/vma: define a default value for VM_DATA_DEFAULT_FLAGS
...

+706 -366
+1
.mailmap
··· 210 210 Oleksij Rempel <linux@rempel-privat.de> <fixed-term.Oleksij.Rempel@de.bosch.com> 211 211 Oleksij Rempel <linux@rempel-privat.de> <o.rempel@pengutronix.de> 212 212 Oleksij Rempel <linux@rempel-privat.de> <ore@pengutronix.de> 213 + Pali Rohár <pali@kernel.org> <pali.rohar@gmail.com> 213 214 Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> 214 215 Patrick Mochel <mochel@digitalimplant.org> 215 216 Paul Burton <paulburton@kernel.org> <paul.burton@imgtec.com>
+4 -4
Documentation/ABI/testing/sysfs-platform-dell-laptop
··· 2 2 Date: December 2014 3 3 KernelVersion: 3.19 4 4 Contact: Gabriele Mazzotta <gabriele.mzt@gmail.com>, 5 - Pali Rohár <pali.rohar@gmail.com> 5 + Pali Rohár <pali@kernel.org> 6 6 Description: 7 7 This file allows to control the automatic keyboard 8 8 illumination mode on some systems that have an ambient ··· 13 13 Date: December 2014 14 14 KernelVersion: 3.19 15 15 Contact: Gabriele Mazzotta <gabriele.mzt@gmail.com>, 16 - Pali Rohár <pali.rohar@gmail.com> 16 + Pali Rohár <pali@kernel.org> 17 17 Description: 18 18 This file allows to specifiy the on/off threshold value, 19 19 as reported by the ambient light sensor. ··· 22 22 Date: December 2014 23 23 KernelVersion: 3.19 24 24 Contact: Gabriele Mazzotta <gabriele.mzt@gmail.com>, 25 - Pali Rohár <pali.rohar@gmail.com> 25 + Pali Rohár <pali@kernel.org> 26 26 Description: 27 27 This file allows to control the input triggers that 28 28 turn on the keyboard backlight illumination that is ··· 45 45 Date: December 2014 46 46 KernelVersion: 3.19 47 47 Contact: Gabriele Mazzotta <gabriele.mzt@gmail.com>, 48 - Pali Rohár <pali.rohar@gmail.com> 48 + Pali Rohár <pali@kernel.org> 49 49 Description: 50 50 This file allows to specify the interval after which the 51 51 keyboard illumination is disabled because of inactivity.
+8
Documentation/admin-guide/kernel-parameters.txt
··· 1471 1471 hpet_mmap= [X86, HPET_MMAP] Allow userspace to mmap HPET 1472 1472 registers. Default set by CONFIG_HPET_MMAP_DEFAULT. 1473 1473 1474 + hugetlb_cma= [HW] The size of a cma area used for allocation 1475 + of gigantic hugepages. 1476 + Format: nn[KMGTPE] 1477 + 1478 + Reserve a cma area of given size and allocate gigantic 1479 + hugepages using the cma allocator. If enabled, the 1480 + boot-time allocation of gigantic hugepages is skipped. 1481 + 1474 1482 hugepages= [HW,X86-32,IA-64] HugeTLB pages to allocate at boot. 1475 1483 hugepagesz= [HW,IA-64,PPC,X86-64] The size of the HugeTLB pages. 1476 1484 On x86-64 and powerpc, this option can be specified
+21
Documentation/admin-guide/sysctl/kernel.rst
··· 446 446 successful IPC object allocation. If an IPC object allocation syscall 447 447 fails, it is undefined if the value remains unmodified or is reset to -1. 448 448 449 + modprobe: 450 + ========= 451 + 452 + The path to the usermode helper for autoloading kernel modules, by 453 + default "/sbin/modprobe". This binary is executed when the kernel 454 + requests a module. For example, if userspace passes an unknown 455 + filesystem type to mount(), then the kernel will automatically request 456 + the corresponding filesystem module by executing this usermode helper. 457 + This usermode helper should insert the needed module into the kernel. 458 + 459 + This sysctl only affects module autoloading. It has no effect on the 460 + ability to explicitly insert modules. 461 + 462 + If this sysctl is set to the empty string, then module autoloading is 463 + completely disabled. The kernel will not try to execute a usermode 464 + helper at all, nor will it call the kernel_module_request LSM hook. 465 + 466 + If CONFIG_STATIC_USERMODEHELPER=y is set in the kernel configuration, 467 + then the configured static usermode helper overrides this sysctl, 468 + except that the empty string is still accepted to completely disable 469 + module autoloading as described above. 449 470 450 471 nmi_watchdog 451 472 ============
+8 -8
MAINTAINERS
··· 727 727 F: arch/alpha/ 728 728 729 729 ALPS PS/2 TOUCHPAD DRIVER 730 - R: Pali Rohár <pali.rohar@gmail.com> 730 + R: Pali Rohár <pali@kernel.org> 731 731 F: drivers/input/mouse/alps.* 732 732 733 733 ALTERA I2C CONTROLLER DRIVER ··· 4774 4774 4775 4775 DELL LAPTOP DRIVER 4776 4776 M: Matthew Garrett <mjg59@srcf.ucam.org> 4777 - M: Pali Rohár <pali.rohar@gmail.com> 4777 + M: Pali Rohár <pali@kernel.org> 4778 4778 L: platform-driver-x86@vger.kernel.org 4779 4779 S: Maintained 4780 4780 F: drivers/platform/x86/dell-laptop.c 4781 4781 4782 4782 DELL LAPTOP FREEFALL DRIVER 4783 - M: Pali Rohár <pali.rohar@gmail.com> 4783 + M: Pali Rohár <pali@kernel.org> 4784 4784 S: Maintained 4785 4785 F: drivers/platform/x86/dell-smo8800.c 4786 4786 4787 4787 DELL LAPTOP RBTN DRIVER 4788 - M: Pali Rohár <pali.rohar@gmail.com> 4788 + M: Pali Rohár <pali@kernel.org> 4789 4789 S: Maintained 4790 4790 F: drivers/platform/x86/dell-rbtn.* 4791 4791 4792 4792 DELL LAPTOP SMM DRIVER 4793 - M: Pali Rohár <pali.rohar@gmail.com> 4793 + M: Pali Rohár <pali@kernel.org> 4794 4794 S: Maintained 4795 4795 F: drivers/hwmon/dell-smm-hwmon.c 4796 4796 F: include/uapi/linux/i8k.h ··· 4802 4802 F: drivers/platform/x86/dell_rbu.c 4803 4803 4804 4804 DELL SMBIOS DRIVER 4805 - M: Pali Rohár <pali.rohar@gmail.com> 4805 + M: Pali Rohár <pali@kernel.org> 4806 4806 M: Mario Limonciello <mario.limonciello@dell.com> 4807 4807 L: platform-driver-x86@vger.kernel.org 4808 4808 S: Maintained ··· 4835 4835 4836 4836 DELL WMI NOTIFICATIONS DRIVER 4837 4837 M: Matthew Garrett <mjg59@srcf.ucam.org> 4838 - M: Pali Rohár <pali.rohar@gmail.com> 4838 + M: Pali Rohár <pali@kernel.org> 4839 4839 S: Maintained 4840 4840 F: drivers/platform/x86/dell-wmi.c 4841 4841 ··· 11950 11950 F: drivers/media/i2c/ad5820.c 11951 11951 11952 11952 NOKIA N900 POWER SUPPLY DRIVERS 11953 - R: Pali Rohár <pali.rohar@gmail.com> 11953 + R: Pali Rohár <pali@kernel.org> 11954 11954 F: include/linux/power/bq2415x_charger.h 11955 11955 F: include/linux/power/bq27xxx_battery.h 11956 11956 F: drivers/power/supply/bq2415x_charger.c
-3
arch/alpha/include/asm/page.h
··· 90 90 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 91 91 #endif /* CONFIG_DISCONTIGMEM */ 92 92 93 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 94 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 95 - 96 93 #include <asm-generic/memory_model.h> 97 94 #include <asm-generic/getorder.h> 98 95
-2
arch/alpha/include/asm/pgtable.h
··· 268 268 extern inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_FOW); } 269 269 extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 270 270 extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 271 - extern inline int pte_special(pte_t pte) { return 0; } 272 271 273 272 extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOW; return pte; } 274 273 extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~(__DIRTY_BITS); return pte; } ··· 275 276 extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_FOW; return pte; } 276 277 extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= __DIRTY_BITS; return pte; } 277 278 extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= __ACCESS_BITS; return pte; } 278 - extern inline pte_t pte_mkspecial(pte_t pte) { return pte; } 279 279 280 280 #define PAGE_DIR_OFFSET(tsk,address) pgd_offset((tsk),(address)) 281 281
+1 -1
arch/arc/include/asm/page.h
··· 102 102 #define virt_addr_valid(kaddr) pfn_valid(virt_to_pfn(kaddr)) 103 103 104 104 /* Default Permissions for stack/heaps pages (Non Executable) */ 105 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 105 + #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_NON_EXEC 106 106 107 107 #define WANT_PAGE_VIRTUAL 1 108 108
+1 -3
arch/arm/include/asm/page.h
··· 161 161 162 162 #endif /* !__ASSEMBLY__ */ 163 163 164 - #define VM_DATA_DEFAULT_FLAGS \ 165 - (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \ 166 - VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 164 + #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_TSK_EXEC 167 165 168 166 #include <asm-generic/getorder.h> 169 167
-2
arch/arm/include/asm/pgtable-2level.h
··· 211 211 #define pmd_addr_end(addr,end) (end) 212 212 213 213 #define set_pte_ext(ptep,pte,ext) cpu_set_pte_ext(ptep,pte,ext) 214 - #define pte_special(pte) (0) 215 - static inline pte_t pte_mkspecial(pte_t pte) { return pte; } 216 214 217 215 /* 218 216 * We don't have huge page support for short descriptors, for the moment
+2 -13
arch/arm/include/asm/pgtable.h
··· 243 243 extern void __sync_icache_dcache(pte_t pteval); 244 244 #endif 245 245 246 - static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, 247 - pte_t *ptep, pte_t pteval) 248 - { 249 - unsigned long ext = 0; 250 - 251 - if (addr < TASK_SIZE && pte_valid_user(pteval)) { 252 - if (!pte_special(pteval)) 253 - __sync_icache_dcache(pteval); 254 - ext |= PTE_EXT_NG; 255 - } 256 - 257 - set_pte_ext(ptep, pteval, ext); 258 - } 246 + void set_pte_at(struct mm_struct *mm, unsigned long addr, 247 + pte_t *ptep, pte_t pteval); 259 248 260 249 static inline pte_t clear_pte_bit(pte_t pte, pgprot_t prot) 261 250 {
+1 -1
arch/arm/mach-omap2/omap-secure.c
··· 5 5 * Copyright (C) 2011 Texas Instruments, Inc. 6 6 * Santosh Shilimkar <santosh.shilimkar@ti.com> 7 7 * Copyright (C) 2012 Ivaylo Dimitrov <freemangordon@abv.bg> 8 - * Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com> 8 + * Copyright (C) 2013 Pali Rohár <pali@kernel.org> 9 9 */ 10 10 11 11 #include <linux/arm-smccc.h>
+1 -1
arch/arm/mach-omap2/omap-secure.h
··· 5 5 * Copyright (C) 2011 Texas Instruments, Inc. 6 6 * Santosh Shilimkar <santosh.shilimkar@ti.com> 7 7 * Copyright (C) 2012 Ivaylo Dimitrov <freemangordon@abv.bg> 8 - * Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com> 8 + * Copyright (C) 2013 Pali Rohár <pali@kernel.org> 9 9 */ 10 10 #ifndef OMAP_ARCH_OMAP_SECURE_H 11 11 #define OMAP_ARCH_OMAP_SECURE_H
+1 -1
arch/arm/mach-omap2/omap-smc.S
··· 6 6 * Written by Santosh Shilimkar <santosh.shilimkar@ti.com> 7 7 * 8 8 * Copyright (C) 2012 Ivaylo Dimitrov <freemangordon@abv.bg> 9 - * Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com> 9 + * Copyright (C) 2013 Pali Rohár <pali@kernel.org> 10 10 */ 11 11 12 12 #include <linux/linkage.h>
+1 -1
arch/arm/mm/fault.c
··· 189 189 */ 190 190 static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma) 191 191 { 192 - unsigned int mask = VM_READ | VM_WRITE | VM_EXEC; 192 + unsigned int mask = VM_ACCESS_FLAGS; 193 193 194 194 if ((fsr & FSR_WRITE) && !(fsr & FSR_CM)) 195 195 mask = VM_WRITE;
+14
arch/arm/mm/mmu.c
··· 1646 1646 build_mem_type_table(); 1647 1647 early_paging_init(mdesc); 1648 1648 } 1649 + 1650 + void set_pte_at(struct mm_struct *mm, unsigned long addr, 1651 + pte_t *ptep, pte_t pteval) 1652 + { 1653 + unsigned long ext = 0; 1654 + 1655 + if (addr < TASK_SIZE && pte_valid_user(pteval)) { 1656 + if (!pte_special(pteval)) 1657 + __sync_icache_dcache(pteval); 1658 + ext |= PTE_EXT_NG; 1659 + } 1660 + 1661 + set_pte_ext(ptep, pteval, ext); 1662 + }
+1 -3
arch/arm64/include/asm/page.h
··· 36 36 37 37 #endif /* !__ASSEMBLY__ */ 38 38 39 - #define VM_DATA_DEFAULT_FLAGS \ 40 - (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \ 41 - VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 39 + #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_TSK_EXEC 42 40 43 41 #include <asm-generic/getorder.h> 44 42
+1 -1
arch/arm64/mm/fault.c
··· 445 445 const struct fault_info *inf; 446 446 struct mm_struct *mm = current->mm; 447 447 vm_fault_t fault, major = 0; 448 - unsigned long vm_flags = VM_READ | VM_WRITE | VM_EXEC; 448 + unsigned long vm_flags = VM_ACCESS_FLAGS; 449 449 unsigned int mm_flags = FAULT_FLAG_DEFAULT; 450 450 451 451 if (kprobe_page_fault(regs, esr))
+6
arch/arm64/mm/init.c
··· 29 29 #include <linux/mm.h> 30 30 #include <linux/kexec.h> 31 31 #include <linux/crash_dump.h> 32 + #include <linux/hugetlb.h> 32 33 33 34 #include <asm/boot.h> 34 35 #include <asm/fixmap.h> ··· 458 457 high_memory = __va(memblock_end_of_DRAM() - 1) + 1; 459 458 460 459 dma_contiguous_reserve(arm64_dma32_phys_limit); 460 + 461 + #ifdef CONFIG_ARM64_4K_PAGES 462 + hugetlb_cma_reserve(PUD_SHIFT - PAGE_SHIFT); 463 + #endif 464 + 461 465 } 462 466 463 467 void __init bootmem_init(void)
+4 -3
arch/arm64/mm/mmu.c
··· 1374 1374 } 1375 1375 1376 1376 int arch_add_memory(int nid, u64 start, u64 size, 1377 - struct mhp_restrictions *restrictions) 1377 + struct mhp_params *params) 1378 1378 { 1379 1379 int ret, flags = 0; 1380 1380 ··· 1382 1382 flags = NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS; 1383 1383 1384 1384 __create_pgd_mapping(swapper_pg_dir, start, __phys_to_virt(start), 1385 - size, PAGE_KERNEL, __pgd_pgtable_alloc, flags); 1385 + size, params->pgprot, __pgd_pgtable_alloc, 1386 + flags); 1386 1387 1387 1388 memblock_clear_nomap(start, size); 1388 1389 1389 1390 ret = __add_pages(nid, start >> PAGE_SHIFT, size >> PAGE_SHIFT, 1390 - restrictions); 1391 + params); 1391 1392 if (ret) 1392 1393 __remove_pgd_mapping(swapper_pg_dir, 1393 1394 __phys_to_virt(start), size);
+1 -4
arch/c6x/include/asm/page.h
··· 2 2 #ifndef _ASM_C6X_PAGE_H 3 3 #define _ASM_C6X_PAGE_H 4 4 5 - #define VM_DATA_DEFAULT_FLAGS \ 6 - (VM_READ | VM_WRITE | \ 7 - ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \ 8 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 5 + #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_TSK_EXEC 9 6 10 7 #include <asm-generic/page.h> 11 8
-3
arch/csky/include/asm/page.h
··· 85 85 PHYS_OFFSET_OFFSET) 86 86 #define virt_to_page(x) (mem_map + MAP_NR(x)) 87 87 88 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 89 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 90 - 91 88 #define pfn_to_kaddr(x) __va(PFN_PHYS(x)) 92 89 93 90 #include <asm-generic/memory_model.h>
-3
arch/csky/include/asm/pgtable.h
··· 110 110 extern void load_pgd(unsigned long pg_dir); 111 111 extern pte_t invalid_pte_table[PTRS_PER_PTE]; 112 112 113 - static inline int pte_special(pte_t pte) { return 0; } 114 - static inline pte_t pte_mkspecial(pte_t pte) { return pte; } 115 - 116 113 static inline void set_pte(pte_t *p, pte_t pte) 117 114 { 118 115 *p = pte;
-2
arch/h8300/include/asm/page.h
··· 6 6 #include <linux/types.h> 7 7 8 8 #define MAP_NR(addr) (((uintptr_t)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) 9 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 10 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 11 9 12 10 #ifndef __ASSEMBLY__ 13 11 extern unsigned long rom_length;
+1 -2
arch/hexagon/include/asm/page.h
··· 93 93 #define virt_to_page(kaddr) pfn_to_page(PFN_DOWN(__pa(kaddr))) 94 94 95 95 /* Default vm area behavior is non-executable. */ 96 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \ 97 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 96 + #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_NON_EXEC 98 97 99 98 #define pfn_valid(pfn) ((pfn) < max_mapnr) 100 99 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
-2
arch/hexagon/include/asm/pgtable.h
··· 158 158 159 159 /* Seems to be zero even in architectures where the zero page is firewalled? */ 160 160 #define FIRST_USER_ADDRESS 0UL 161 - #define pte_special(pte) 0 162 - #define pte_mkspecial(pte) (pte) 163 161 164 162 /* HUGETLB not working currently */ 165 163 #ifdef CONFIG_HUGETLB_PAGE
+1 -4
arch/ia64/include/asm/page.h
··· 218 218 219 219 #define PAGE_OFFSET RGN_BASE(RGN_KERNEL) 220 220 221 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \ 222 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC | \ 223 - (((current->personality & READ_IMPLIES_EXEC) != 0) \ 224 - ? VM_EXEC : 0)) 221 + #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_TSK_EXEC 225 222 226 223 #define GATE_ADDR RGN_BASE(RGN_GATE) 227 224
-2
arch/ia64/include/asm/pgtable.h
··· 298 298 #define pte_exec(pte) ((pte_val(pte) & _PAGE_AR_RX) != 0) 299 299 #define pte_dirty(pte) ((pte_val(pte) & _PAGE_D) != 0) 300 300 #define pte_young(pte) ((pte_val(pte) & _PAGE_A) != 0) 301 - #define pte_special(pte) 0 302 301 303 302 /* 304 303 * Note: we convert AR_RWX to AR_RX and AR_RW to AR_R by clearing the 2nd bit in the ··· 310 311 #define pte_mkclean(pte) (__pte(pte_val(pte) & ~_PAGE_D)) 311 312 #define pte_mkdirty(pte) (__pte(pte_val(pte) | _PAGE_D)) 312 313 #define pte_mkhuge(pte) (__pte(pte_val(pte))) 313 - #define pte_mkspecial(pte) (pte) 314 314 315 315 /* 316 316 * Because ia64's Icache and Dcache is not coherent (on a cpu), we need to
+5 -2
arch/ia64/mm/init.c
··· 670 670 671 671 #ifdef CONFIG_MEMORY_HOTPLUG 672 672 int arch_add_memory(int nid, u64 start, u64 size, 673 - struct mhp_restrictions *restrictions) 673 + struct mhp_params *params) 674 674 { 675 675 unsigned long start_pfn = start >> PAGE_SHIFT; 676 676 unsigned long nr_pages = size >> PAGE_SHIFT; 677 677 int ret; 678 678 679 - ret = __add_pages(nid, start_pfn, nr_pages, restrictions); 679 + if (WARN_ON_ONCE(params->pgprot.pgprot != PAGE_KERNEL.pgprot)) 680 + return -EINVAL; 681 + 682 + ret = __add_pages(nid, start_pfn, nr_pages, params); 680 683 if (ret) 681 684 printk("%s: Problem encountered in __add_pages() as ret=%d\n", 682 685 __func__, ret);
-10
arch/m68k/include/asm/mcf_pgtable.h
··· 235 235 return pte_val(pte) & CF_PAGE_ACCESSED; 236 236 } 237 237 238 - static inline int pte_special(pte_t pte) 239 - { 240 - return 0; 241 - } 242 - 243 238 static inline pte_t pte_wrprotect(pte_t pte) 244 239 { 245 240 pte_val(pte) &= ~CF_PAGE_WRITABLE; ··· 304 309 static inline pte_t pte_mkcache(pte_t pte) 305 310 { 306 311 pte_val(pte) &= ~CF_PAGE_NOCACHE; 307 - return pte; 308 - } 309 - 310 - static inline pte_t pte_mkspecial(pte_t pte) 311 - { 312 312 return pte; 313 313 } 314 314
-2
arch/m68k/include/asm/motorola_pgtable.h
··· 174 174 static inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_RONLY); } 175 175 static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 176 176 static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 177 - static inline int pte_special(pte_t pte) { return 0; } 178 177 179 178 static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_RONLY; return pte; } 180 179 static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } ··· 191 192 pte_val(pte) = (pte_val(pte) & _CACHEMASK040) | m68k_supervisor_cachemode; 192 193 return pte; 193 194 } 194 - static inline pte_t pte_mkspecial(pte_t pte) { return pte; } 195 195 196 196 #define PAGE_DIR_OFFSET(tsk,address) pgd_offset((tsk),(address)) 197 197
-3
arch/m68k/include/asm/page.h
··· 65 65 #define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT)) 66 66 #define __pfn_to_phys(pfn) PFN_PHYS(pfn) 67 67 68 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 69 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 70 - 71 68 #include <asm-generic/getorder.h> 72 69 73 70 #endif /* _M68K_PAGE_H */
-2
arch/m68k/include/asm/sun3_pgtable.h
··· 155 155 static inline int pte_write(pte_t pte) { return pte_val(pte) & SUN3_PAGE_WRITEABLE; } 156 156 static inline int pte_dirty(pte_t pte) { return pte_val(pte) & SUN3_PAGE_MODIFIED; } 157 157 static inline int pte_young(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; } 158 - static inline int pte_special(pte_t pte) { return 0; } 159 158 160 159 static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_WRITEABLE; return pte; } 161 160 static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_MODIFIED; return pte; } ··· 167 168 //static inline pte_t pte_mkcache(pte_t pte) { pte_val(pte) &= SUN3_PAGE_NOCACHE; return pte; } 168 169 // until then, use: 169 170 static inline pte_t pte_mkcache(pte_t pte) { return pte; } 170 - static inline pte_t pte_mkspecial(pte_t pte) { return pte; } 171 171 172 172 extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; 173 173 extern pgd_t kernel_pg_dir[PTRS_PER_PGD];
-2
arch/microblaze/include/asm/page.h
··· 194 194 195 195 #ifdef CONFIG_MMU 196 196 197 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 198 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 199 197 #endif /* CONFIG_MMU */ 200 198 201 199 #endif /* __KERNEL__ */
-4
arch/microblaze/include/asm/pgtable.h
··· 77 77 * Undefined behaviour if not.. 78 78 */ 79 79 80 - static inline int pte_special(pte_t pte) { return 0; } 81 - 82 - static inline pte_t pte_mkspecial(pte_t pte) { return pte; } 83 - 84 80 /* Start and end of the vmalloc area. */ 85 81 /* Make sure to map the vmalloc area above the pinned kernel memory area 86 82 of 32Mb. */
+1 -4
arch/mips/include/asm/page.h
··· 253 253 #define virt_addr_valid(kaddr) \ 254 254 __virt_addr_valid((const volatile void *) (kaddr)) 255 255 256 - #define VM_DATA_DEFAULT_FLAGS \ 257 - (VM_READ | VM_WRITE | \ 258 - ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \ 259 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 256 + #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_TSK_EXEC 260 257 261 258 #include <asm-generic/memory_model.h> 262 259 #include <asm-generic/getorder.h>
+30 -14
arch/mips/include/asm/pgtable.h
··· 270 270 extern pgd_t swapper_pg_dir[]; 271 271 272 272 /* 273 + * Platform specific pte_special() and pte_mkspecial() definitions 274 + * are required only when ARCH_HAS_PTE_SPECIAL is enabled. 275 + */ 276 + #if defined(CONFIG_ARCH_HAS_PTE_SPECIAL) 277 + #if defined(CONFIG_PHYS_ADDR_T_64BIT) && defined(CONFIG_CPU_MIPS32) 278 + static inline int pte_special(pte_t pte) 279 + { 280 + return pte.pte_low & _PAGE_SPECIAL; 281 + } 282 + 283 + static inline pte_t pte_mkspecial(pte_t pte) 284 + { 285 + pte.pte_low |= _PAGE_SPECIAL; 286 + return pte; 287 + } 288 + #else 289 + static inline int pte_special(pte_t pte) 290 + { 291 + return pte_val(pte) & _PAGE_SPECIAL; 292 + } 293 + 294 + static inline pte_t pte_mkspecial(pte_t pte) 295 + { 296 + pte_val(pte) |= _PAGE_SPECIAL; 297 + return pte; 298 + } 299 + #endif 300 + #endif /* CONFIG_ARCH_HAS_PTE_SPECIAL */ 301 + 302 + /* 273 303 * The following only work if pte_present() is true. 274 304 * Undefined behaviour if not.. 275 305 */ ··· 307 277 static inline int pte_write(pte_t pte) { return pte.pte_low & _PAGE_WRITE; } 308 278 static inline int pte_dirty(pte_t pte) { return pte.pte_low & _PAGE_MODIFIED; } 309 279 static inline int pte_young(pte_t pte) { return pte.pte_low & _PAGE_ACCESSED; } 310 - static inline int pte_special(pte_t pte) { return pte.pte_low & _PAGE_SPECIAL; } 311 280 312 281 static inline pte_t pte_wrprotect(pte_t pte) 313 282 { ··· 367 338 } 368 339 return pte; 369 340 } 370 - 371 - static inline pte_t pte_mkspecial(pte_t pte) 372 - { 373 - pte.pte_low |= _PAGE_SPECIAL; 374 - return pte; 375 - } 376 341 #else 377 342 static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } 378 343 static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } 379 344 static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 380 - static inline int pte_special(pte_t pte) { return pte_val(pte) & _PAGE_SPECIAL; } 381 345 382 346 static inline pte_t pte_wrprotect(pte_t pte) 383 347 { ··· 411 389 pte_val(pte) |= _PAGE_ACCESSED; 412 390 if (!(pte_val(pte) & _PAGE_NO_READ)) 413 391 pte_val(pte) |= _PAGE_SILENT_READ; 414 - return pte; 415 - } 416 - 417 - static inline pte_t pte_mkspecial(pte_t pte) 418 - { 419 - pte_val(pte) |= _PAGE_SPECIAL; 420 392 return pte; 421 393 } 422 394
-3
arch/nds32/include/asm/page.h
··· 59 59 60 60 #endif /* !__ASSEMBLY__ */ 61 61 62 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 63 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 64 - 65 62 #endif /* __KERNEL__ */ 66 63 67 64 #endif
-9
arch/nds32/include/asm/pgtable.h
··· 286 286 PTE_BIT_FUNC(mkdirty, |=_PAGE_D); 287 287 PTE_BIT_FUNC(mkold, &=~_PAGE_YOUNG); 288 288 PTE_BIT_FUNC(mkyoung, |=_PAGE_YOUNG); 289 - static inline int pte_special(pte_t pte) 290 - { 291 - return 0; 292 - } 293 - 294 - static inline pte_t pte_mkspecial(pte_t pte) 295 - { 296 - return pte; 297 - } 298 289 299 290 /* 300 291 * Mark the prot value as uncacheable and unbufferable.
+1 -1
arch/nds32/mm/fault.c
··· 79 79 struct vm_area_struct *vma; 80 80 int si_code; 81 81 vm_fault_t fault; 82 - unsigned int mask = VM_READ | VM_WRITE | VM_EXEC; 82 + unsigned int mask = VM_ACCESS_FLAGS; 83 83 unsigned int flags = FAULT_FLAG_DEFAULT; 84 84 85 85 error_code = error_code & (ITYPE_mskINST | ITYPE_mskETYPE);
+1 -2
arch/nios2/include/asm/page.h
··· 98 98 # define virt_to_page(vaddr) pfn_to_page(PFN_DOWN(virt_to_phys(vaddr))) 99 99 # define virt_addr_valid(vaddr) pfn_valid(PFN_DOWN(virt_to_phys(vaddr))) 100 100 101 - # define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \ 102 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 101 + # define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_NON_EXEC 103 102 104 103 #include <asm-generic/memory_model.h> 105 104
-3
arch/nios2/include/asm/pgtable.h
··· 113 113 { return pte_val(pte) & _PAGE_DIRTY; } 114 114 static inline int pte_young(pte_t pte) \ 115 115 { return pte_val(pte) & _PAGE_ACCESSED; } 116 - static inline int pte_special(pte_t pte) { return 0; } 117 116 118 117 #define pgprot_noncached pgprot_noncached 119 118 ··· 166 167 pte_val(pte) |= _PAGE_DIRTY; 167 168 return pte; 168 169 } 169 - 170 - static inline pte_t pte_mkspecial(pte_t pte) { return pte; } 171 170 172 171 static inline pte_t pte_mkyoung(pte_t pte) 173 172 {
-5
arch/openrisc/include/asm/page.h
··· 86 86 87 87 #endif /* __ASSEMBLY__ */ 88 88 89 - 90 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 91 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 92 - 93 - 94 89 #include <asm-generic/memory_model.h> 95 90 #include <asm-generic/getorder.h> 96 91
-2
arch/openrisc/include/asm/pgtable.h
··· 236 236 static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC; } 237 237 static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 238 238 static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 239 - static inline int pte_special(pte_t pte) { return 0; } 240 - static inline pte_t pte_mkspecial(pte_t pte) { return pte; } 241 239 242 240 static inline pte_t pte_wrprotect(pte_t pte) 243 241 {
-3
arch/parisc/include/asm/page.h
··· 180 180 #define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) 181 181 #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 182 182 183 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 184 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 185 - 186 183 #include <asm-generic/memory_model.h> 187 184 #include <asm-generic/getorder.h> 188 185 #include <asm/pdc.h>
-2
arch/parisc/include/asm/pgtable.h
··· 377 377 static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 378 378 static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 379 379 static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } 380 - static inline int pte_special(pte_t pte) { return 0; } 381 380 382 381 static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } 383 382 static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } ··· 384 385 static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } 385 386 static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } 386 387 static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_WRITE; return pte; } 387 - static inline pte_t pte_mkspecial(pte_t pte) { return pte; } 388 388 389 389 /* 390 390 * Huge pte definitions.
+2 -1
arch/powerpc/include/asm/book3s/64/hash.h
··· 251 251 extern void hash__vmemmap_remove_mapping(unsigned long start, 252 252 unsigned long page_size); 253 253 254 - int hash__create_section_mapping(unsigned long start, unsigned long end, int nid); 254 + int hash__create_section_mapping(unsigned long start, unsigned long end, 255 + int nid, pgprot_t prot); 255 256 int hash__remove_section_mapping(unsigned long start, unsigned long end); 256 257 257 258 #endif /* !__ASSEMBLY__ */
+2 -1
arch/powerpc/include/asm/book3s/64/radix.h
··· 294 294 } 295 295 296 296 #ifdef CONFIG_MEMORY_HOTPLUG 297 - int radix__create_section_mapping(unsigned long start, unsigned long end, int nid); 297 + int radix__create_section_mapping(unsigned long start, unsigned long end, 298 + int nid, pgprot_t prot); 298 299 int radix__remove_section_mapping(unsigned long start, unsigned long end); 299 300 #endif /* CONFIG_MEMORY_HOTPLUG */ 300 301 #endif /* __ASSEMBLY__ */
+2 -7
arch/powerpc/include/asm/page.h
··· 240 240 * and needs to be executable. This means the whole heap ends 241 241 * up being executable. 242 242 */ 243 - #define VM_DATA_DEFAULT_FLAGS32 \ 244 - (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \ 245 - VM_READ | VM_WRITE | \ 246 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 247 - 248 - #define VM_DATA_DEFAULT_FLAGS64 (VM_READ | VM_WRITE | \ 249 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 243 + #define VM_DATA_DEFAULT_FLAGS32 VM_DATA_FLAGS_TSK_EXEC 244 + #define VM_DATA_DEFAULT_FLAGS64 VM_DATA_FLAGS_NON_EXEC 250 245 251 246 #ifdef __powerpc64__ 252 247 #include <asm/page_64.h>
+2 -5
arch/powerpc/include/asm/page_64.h
··· 94 94 * stack by default, so in the absence of a PT_GNU_STACK program header 95 95 * we turn execute permission off. 96 96 */ 97 - #define VM_STACK_DEFAULT_FLAGS32 (VM_READ | VM_WRITE | VM_EXEC | \ 98 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 99 - 100 - #define VM_STACK_DEFAULT_FLAGS64 (VM_READ | VM_WRITE | \ 101 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 97 + #define VM_STACK_DEFAULT_FLAGS32 VM_DATA_FLAGS_EXEC 98 + #define VM_STACK_DEFAULT_FLAGS64 VM_DATA_FLAGS_NON_EXEC 102 99 103 100 #define VM_STACK_DEFAULT_FLAGS \ 104 101 (is_32bit_task() ? \
+2 -1
arch/powerpc/include/asm/sparsemem.h
··· 13 13 #endif /* CONFIG_SPARSEMEM */ 14 14 15 15 #ifdef CONFIG_MEMORY_HOTPLUG 16 - extern int create_section_mapping(unsigned long start, unsigned long end, int nid); 16 + extern int create_section_mapping(unsigned long start, unsigned long end, 17 + int nid, pgprot_t prot); 17 18 extern int remove_section_mapping(unsigned long start, unsigned long end); 18 19 19 20 #ifdef CONFIG_PPC_BOOK3S_64
+3 -2
arch/powerpc/mm/book3s64/hash_utils.c
··· 809 809 return 0; 810 810 } 811 811 812 - int hash__create_section_mapping(unsigned long start, unsigned long end, int nid) 812 + int hash__create_section_mapping(unsigned long start, unsigned long end, 813 + int nid, pgprot_t prot) 813 814 { 814 815 int rc; 815 816 ··· 820 819 } 821 820 822 821 rc = htab_bolt_mapping(start, end, __pa(start), 823 - pgprot_val(PAGE_KERNEL), mmu_linear_psize, 822 + pgprot_val(prot), mmu_linear_psize, 824 823 mmu_kernel_ssize); 825 824 826 825 if (rc < 0) {
+4 -3
arch/powerpc/mm/book3s64/pgtable.c
··· 171 171 } 172 172 173 173 #ifdef CONFIG_MEMORY_HOTPLUG 174 - int __meminit create_section_mapping(unsigned long start, unsigned long end, int nid) 174 + int __meminit create_section_mapping(unsigned long start, unsigned long end, 175 + int nid, pgprot_t prot) 175 176 { 176 177 if (radix_enabled()) 177 - return radix__create_section_mapping(start, end, nid); 178 + return radix__create_section_mapping(start, end, nid, prot); 178 179 179 - return hash__create_section_mapping(start, end, nid); 180 + return hash__create_section_mapping(start, end, nid, prot); 180 181 } 181 182 182 183 int __meminit remove_section_mapping(unsigned long start, unsigned long end)
+1 -1
arch/powerpc/mm/book3s64/pkeys.c
··· 315 315 static inline bool vma_is_pkey_exec_only(struct vm_area_struct *vma) 316 316 { 317 317 /* Do this check first since the vm_flags should be hot */ 318 - if ((vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC)) != VM_EXEC) 318 + if ((vma->vm_flags & VM_ACCESS_FLAGS) != VM_EXEC) 319 319 return false; 320 320 321 321 return (vma_pkey(vma) == vma->vm_mm->context.execute_only_pkey);
+11 -7
arch/powerpc/mm/book3s64/radix_pgtable.c
··· 254 254 255 255 static int __meminit create_physical_mapping(unsigned long start, 256 256 unsigned long end, 257 - int nid) 257 + int nid, pgprot_t _prot) 258 258 { 259 259 unsigned long vaddr, addr, mapping_size = 0; 260 260 bool prev_exec, exec = false; ··· 290 290 prot = PAGE_KERNEL_X; 291 291 exec = true; 292 292 } else { 293 - prot = PAGE_KERNEL; 293 + prot = _prot; 294 294 exec = false; 295 295 } 296 296 ··· 334 334 335 335 WARN_ON(create_physical_mapping(reg->base, 336 336 reg->base + reg->size, 337 - -1)); 337 + -1, PAGE_KERNEL)); 338 338 } 339 339 340 340 /* Find out how many PID bits are supported */ ··· 713 713 714 714 spin_unlock(&init_mm.page_table_lock); 715 715 pte_clear(&init_mm, params->aligned_start, params->pte); 716 - create_physical_mapping(__pa(params->aligned_start), __pa(params->start), -1); 717 - create_physical_mapping(__pa(params->end), __pa(params->aligned_end), -1); 716 + create_physical_mapping(__pa(params->aligned_start), 717 + __pa(params->start), -1, PAGE_KERNEL); 718 + create_physical_mapping(__pa(params->end), __pa(params->aligned_end), 719 + -1, PAGE_KERNEL); 718 720 spin_lock(&init_mm.page_table_lock); 719 721 return 0; 720 722 } ··· 873 871 radix__flush_tlb_kernel_range(start, end); 874 872 } 875 873 876 - int __meminit radix__create_section_mapping(unsigned long start, unsigned long end, int nid) 874 + int __meminit radix__create_section_mapping(unsigned long start, 875 + unsigned long end, int nid, 876 + pgprot_t prot) 877 877 { 878 878 if (end >= RADIX_VMALLOC_START) { 879 879 pr_warn("Outside the supported range\n"); 880 880 return -1; 881 881 } 882 882 883 - return create_physical_mapping(__pa(start), __pa(end), nid); 883 + return create_physical_mapping(__pa(start), __pa(end), nid, prot); 884 884 } 885 885 886 886 int __meminit radix__remove_section_mapping(unsigned long start, unsigned long end)
+6 -4
arch/powerpc/mm/mem.c
··· 90 90 } 91 91 #endif 92 92 93 - int __weak create_section_mapping(unsigned long start, unsigned long end, int nid) 93 + int __weak create_section_mapping(unsigned long start, unsigned long end, 94 + int nid, pgprot_t prot) 94 95 { 95 96 return -ENODEV; 96 97 } ··· 123 122 } 124 123 125 124 int __ref arch_add_memory(int nid, u64 start, u64 size, 126 - struct mhp_restrictions *restrictions) 125 + struct mhp_params *params) 127 126 { 128 127 unsigned long start_pfn = start >> PAGE_SHIFT; 129 128 unsigned long nr_pages = size >> PAGE_SHIFT; ··· 132 131 resize_hpt_for_hotplug(memblock_phys_mem_size()); 133 132 134 133 start = (unsigned long)__va(start); 135 - rc = create_section_mapping(start, start + size, nid); 134 + rc = create_section_mapping(start, start + size, nid, 135 + params->pgprot); 136 136 if (rc) { 137 137 pr_warn("Unable to create mapping for hot added memory 0x%llx..0x%llx: %d\n", 138 138 start, start + size, rc); 139 139 return -EFAULT; 140 140 } 141 141 142 - return __add_pages(nid, start_pfn, nr_pages, restrictions); 142 + return __add_pages(nid, start_pfn, nr_pages, params); 143 143 } 144 144 145 145 void __ref arch_remove_memory(int nid, u64 start, u64 size,
+1 -2
arch/riscv/include/asm/page.h
··· 137 137 138 138 #define virt_addr_valid(vaddr) (pfn_valid(virt_to_pfn(vaddr))) 139 139 140 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \ 141 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 140 + #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_NON_EXEC 142 141 143 142 #include <asm-generic/memory_model.h> 144 143 #include <asm-generic/getorder.h>
+1 -2
arch/s390/include/asm/page.h
··· 181 181 182 182 #define virt_addr_valid(kaddr) pfn_valid(virt_to_pfn(kaddr)) 183 183 184 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \ 185 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 184 + #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_NON_EXEC 186 185 187 186 #include <asm-generic/memory_model.h> 188 187 #include <asm-generic/getorder.h>
+1 -1
arch/s390/mm/fault.c
··· 580 580 int access; 581 581 vm_fault_t fault; 582 582 583 - access = VM_READ | VM_EXEC | VM_WRITE; 583 + access = VM_ACCESS_FLAGS; 584 584 fault = do_exception(regs, access); 585 585 if (unlikely(fault)) 586 586 do_fault_error(regs, access, fault);
+6 -3
arch/s390/mm/init.c
··· 268 268 #endif /* CONFIG_CMA */ 269 269 270 270 int arch_add_memory(int nid, u64 start, u64 size, 271 - struct mhp_restrictions *restrictions) 271 + struct mhp_params *params) 272 272 { 273 273 unsigned long start_pfn = PFN_DOWN(start); 274 274 unsigned long size_pages = PFN_DOWN(size); 275 275 int rc; 276 276 277 - if (WARN_ON_ONCE(restrictions->altmap)) 277 + if (WARN_ON_ONCE(params->altmap)) 278 + return -EINVAL; 279 + 280 + if (WARN_ON_ONCE(params->pgprot.pgprot != PAGE_KERNEL.pgprot)) 278 281 return -EINVAL; 279 282 280 283 rc = vmem_add_mapping(start, size); 281 284 if (rc) 282 285 return rc; 283 286 284 - rc = __add_pages(nid, start_pfn, size_pages, restrictions); 287 + rc = __add_pages(nid, start_pfn, size_pages, params); 285 288 if (rc) 286 289 vmem_remove_mapping(start, size); 287 290 return rc;
-3
arch/sh/include/asm/page.h
··· 182 182 #endif 183 183 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 184 184 185 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 186 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 187 - 188 185 #include <asm-generic/memory_model.h> 189 186 #include <asm-generic/getorder.h> 190 187
+5 -2
arch/sh/mm/init.c
··· 406 406 407 407 #ifdef CONFIG_MEMORY_HOTPLUG 408 408 int arch_add_memory(int nid, u64 start, u64 size, 409 - struct mhp_restrictions *restrictions) 409 + struct mhp_params *params) 410 410 { 411 411 unsigned long start_pfn = PFN_DOWN(start); 412 412 unsigned long nr_pages = size >> PAGE_SHIFT; 413 413 int ret; 414 414 415 + if (WARN_ON_ONCE(params->pgprot.pgprot != PAGE_KERNEL.pgprot) 416 + return -EINVAL; 417 + 415 418 /* We only have ZONE_NORMAL, so this is easy.. */ 416 - ret = __add_pages(nid, start_pfn, nr_pages, restrictions); 419 + ret = __add_pages(nid, start_pfn, nr_pages, params); 417 420 if (unlikely(ret)) 418 421 printk("%s: Failed, __add_pages() == %d\n", __func__, ret); 419 422
-3
arch/sparc/include/asm/page_32.h
··· 133 133 #define pfn_valid(pfn) (((pfn) >= (pfn_base)) && (((pfn)-(pfn_base)) < max_mapnr)) 134 134 #define virt_addr_valid(kaddr) ((((unsigned long)(kaddr)-PAGE_OFFSET)>>PAGE_SHIFT) < max_mapnr) 135 135 136 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 137 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 138 - 139 136 #include <asm-generic/memory_model.h> 140 137 #include <asm-generic/getorder.h> 141 138
-3
arch/sparc/include/asm/page_64.h
··· 158 158 159 159 #endif /* !(__ASSEMBLY__) */ 160 160 161 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 162 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 163 - 164 161 #include <asm-generic/getorder.h> 165 162 166 163 #endif /* _SPARC64_PAGE_H */
-7
arch/sparc/include/asm/pgtable_32.h
··· 223 223 return pte_val(pte) & SRMMU_REF; 224 224 } 225 225 226 - static inline int pte_special(pte_t pte) 227 - { 228 - return 0; 229 - } 230 - 231 226 static inline pte_t pte_wrprotect(pte_t pte) 232 227 { 233 228 return __pte(pte_val(pte) & ~SRMMU_WRITE); ··· 252 257 { 253 258 return __pte(pte_val(pte) | SRMMU_REF); 254 259 } 255 - 256 - #define pte_mkspecial(pte) (pte) 257 260 258 261 #define pfn_pte(pfn, prot) mk_pte(pfn_to_page(pfn), prot) 259 262
+5 -5
arch/sparc/include/asm/pgtable_64.h
··· 907 907 (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))) 908 908 909 909 /* Find an entry in the third-level page table.. */ 910 - #define pte_index(dir, address) \ 911 - ((pte_t *) __pmd_page(*(dir)) + \ 912 - ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) 913 - #define pte_offset_kernel pte_index 914 - #define pte_offset_map pte_index 910 + #define pte_index(address) \ 911 + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 912 + #define pte_offset_kernel(dir, address) \ 913 + ((pte_t *) __pmd_page(*(dir)) + pte_index(address)) 914 + #define pte_offset_map(dir, address) pte_offset_kernel((dir), (address)) 915 915 #define pte_unmap(pte) do { } while (0) 916 916 917 917 /* We cannot include <linux/mm_types.h> at this point yet: */
-10
arch/um/include/asm/pgtable.h
··· 167 167 return(pte_present(pte) && (pte_get_bits(pte, _PAGE_NEWPROT))); 168 168 } 169 169 170 - static inline int pte_special(pte_t pte) 171 - { 172 - return 0; 173 - } 174 - 175 170 /* 176 171 * ================================= 177 172 * Flags setting section. ··· 239 244 static inline pte_t pte_mknewpage(pte_t pte) 240 245 { 241 246 pte_set_bits(pte, _PAGE_NEWPAGE); 242 - return(pte); 243 - } 244 - 245 - static inline pte_t pte_mkspecial(pte_t pte) 246 - { 247 247 return(pte); 248 248 } 249 249
-3
arch/unicore32/include/asm/page.h
··· 69 69 70 70 #endif /* !__ASSEMBLY__ */ 71 71 72 - #define VM_DATA_DEFAULT_FLAGS \ 73 - (VM_READ | VM_WRITE | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 74 - 75 72 #include <asm-generic/getorder.h> 76 73 77 74 #endif
-3
arch/unicore32/include/asm/pgtable.h
··· 177 177 #define pte_dirty(pte) (pte_val(pte) & PTE_DIRTY) 178 178 #define pte_young(pte) (pte_val(pte) & PTE_YOUNG) 179 179 #define pte_exec(pte) (pte_val(pte) & PTE_EXEC) 180 - #define pte_special(pte) (0) 181 180 182 181 #define PTE_BIT_FUNC(fn, op) \ 183 182 static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } ··· 187 188 PTE_BIT_FUNC(mkdirty, |= PTE_DIRTY); 188 189 PTE_BIT_FUNC(mkold, &= ~PTE_YOUNG); 189 190 PTE_BIT_FUNC(mkyoung, |= PTE_YOUNG); 190 - 191 - static inline pte_t pte_mkspecial(pte_t pte) { return pte; } 192 191 193 192 /* 194 193 * Mark the prot value as uncacheable.
+1 -1
arch/unicore32/mm/fault.c
··· 149 149 */ 150 150 static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma) 151 151 { 152 - unsigned int mask = VM_READ | VM_WRITE | VM_EXEC; 152 + unsigned int mask = VM_ACCESS_FLAGS; 153 153 154 154 if (!(fsr ^ 0x12)) /* write? */ 155 155 mask = VM_WRITE;
+1 -6
arch/x86/include/asm/page_types.h
··· 35 35 36 36 #define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) 37 37 38 - #define VM_DATA_DEFAULT_FLAGS \ 39 - (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ 40 - VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 38 + #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_TSK_EXEC 41 39 42 40 #define __PHYSICAL_START ALIGN(CONFIG_PHYSICAL_START, \ 43 41 CONFIG_PHYSICAL_ALIGN) ··· 70 72 } 71 73 72 74 bool pfn_range_is_mapped(unsigned long start_pfn, unsigned long end_pfn); 73 - 74 - extern unsigned long init_memory_mapping(unsigned long start, 75 - unsigned long end); 76 75 77 76 extern void initmem_init(void); 78 77
+6
arch/x86/include/asm/pgtable.h
··· 860 860 * 861 861 * this function returns the index of the entry in the pte page which would 862 862 * control the given virtual address 863 + * 864 + * Also define macro so we can test if pte_index is defined for arch. 863 865 */ 866 + #define pte_index pte_index 864 867 static inline unsigned long pte_index(unsigned long address) 865 868 { 866 869 return (address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1); ··· 1080 1077 } 1081 1078 1082 1079 void __init poking_init(void); 1080 + 1081 + unsigned long init_memory_mapping(unsigned long start, 1082 + unsigned long end, pgprot_t prot); 1083 1083 1084 1084 # ifdef CONFIG_RANDOMIZE_MEMORY 1085 1085 void __meminit init_trampoline(void);
+1
arch/x86/include/asm/set_memory.h
··· 34 34 * The caller is required to take care of these. 35 35 */ 36 36 37 + int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot); 37 38 int _set_memory_uc(unsigned long addr, int numpages); 38 39 int _set_memory_wc(unsigned long addr, int numpages); 39 40 int _set_memory_wt(unsigned long addr, int numpages);
+2 -1
arch/x86/kernel/amd_gart_64.c
··· 744 744 745 745 start_pfn = PFN_DOWN(aper_base); 746 746 if (!pfn_range_is_mapped(start_pfn, end_pfn)) 747 - init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT); 747 + init_memory_mapping(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT, 748 + PAGE_KERNEL); 748 749 749 750 pr_info("PCI-DMA: using GART IOMMU.\n"); 750 751 iommu_size = check_iommu_size(info.aper_base, aper_size);
+4
arch/x86/kernel/setup.c
··· 16 16 #include <linux/pci.h> 17 17 #include <linux/root_dev.h> 18 18 #include <linux/sfi.h> 19 + #include <linux/hugetlb.h> 19 20 #include <linux/tboot.h> 20 21 #include <linux/usb/xhci-dbgp.h> 21 22 ··· 1157 1156 1158 1157 initmem_init(); 1159 1158 dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT); 1159 + 1160 + if (boot_cpu_has(X86_FEATURE_GBPAGES)) 1161 + hugetlb_cma_reserve(PUD_SHIFT - PAGE_SHIFT); 1160 1162 1161 1163 /* 1162 1164 * Reserve memory for crash kernel after SRAT is parsed so that it
+5 -4
arch/x86/mm/init.c
··· 467 467 * the physical memory. To access them they are temporarily mapped. 468 468 */ 469 469 unsigned long __ref init_memory_mapping(unsigned long start, 470 - unsigned long end) 470 + unsigned long end, pgprot_t prot) 471 471 { 472 472 struct map_range mr[NR_RANGE_MR]; 473 473 unsigned long ret = 0; ··· 481 481 482 482 for (i = 0; i < nr_range; i++) 483 483 ret = kernel_physical_mapping_init(mr[i].start, mr[i].end, 484 - mr[i].page_size_mask); 484 + mr[i].page_size_mask, 485 + prot); 485 486 486 487 add_pfn_range_mapped(start >> PAGE_SHIFT, ret >> PAGE_SHIFT); 487 488 ··· 522 521 */ 523 522 can_use_brk_pgt = max(start, (u64)pgt_buf_end<<PAGE_SHIFT) >= 524 523 min(end, (u64)pgt_buf_top<<PAGE_SHIFT); 525 - init_memory_mapping(start, end); 524 + init_memory_mapping(start, end, PAGE_KERNEL); 526 525 mapped_ram_size += end - start; 527 526 can_use_brk_pgt = true; 528 527 } ··· 662 661 #endif 663 662 664 663 /* the ISA range is always mapped regardless of memory holes */ 665 - init_memory_mapping(0, ISA_END_ADDRESS); 664 + init_memory_mapping(0, ISA_END_ADDRESS, PAGE_KERNEL); 666 665 667 666 /* Init the trampoline, possibly with KASLR memory offset */ 668 667 init_trampoline();
+16 -3
arch/x86/mm/init_32.c
··· 257 257 unsigned long __init 258 258 kernel_physical_mapping_init(unsigned long start, 259 259 unsigned long end, 260 - unsigned long page_size_mask) 260 + unsigned long page_size_mask, 261 + pgprot_t prot) 261 262 { 262 263 int use_pse = page_size_mask == (1<<PG_LEVEL_2M); 263 264 unsigned long last_map_addr = end; ··· 820 819 821 820 #ifdef CONFIG_MEMORY_HOTPLUG 822 821 int arch_add_memory(int nid, u64 start, u64 size, 823 - struct mhp_restrictions *restrictions) 822 + struct mhp_params *params) 824 823 { 825 824 unsigned long start_pfn = start >> PAGE_SHIFT; 826 825 unsigned long nr_pages = size >> PAGE_SHIFT; 826 + int ret; 827 827 828 - return __add_pages(nid, start_pfn, nr_pages, restrictions); 828 + /* 829 + * The page tables were already mapped at boot so if the caller 830 + * requests a different mapping type then we must change all the 831 + * pages with __set_memory_prot(). 832 + */ 833 + if (params->pgprot.pgprot != PAGE_KERNEL.pgprot) { 834 + ret = __set_memory_prot(start, nr_pages, params->pgprot); 835 + if (ret) 836 + return ret; 837 + } 838 + 839 + return __add_pages(nid, start_pfn, nr_pages, params); 829 840 } 830 841 831 842 void arch_remove_memory(int nid, u64 start, u64 size,
+22 -18
arch/x86/mm/init_64.c
··· 585 585 */ 586 586 static unsigned long __meminit 587 587 phys_pud_init(pud_t *pud_page, unsigned long paddr, unsigned long paddr_end, 588 - unsigned long page_size_mask, bool init) 588 + unsigned long page_size_mask, pgprot_t _prot, bool init) 589 589 { 590 590 unsigned long pages = 0, paddr_next; 591 591 unsigned long paddr_last = paddr_end; ··· 595 595 for (; i < PTRS_PER_PUD; i++, paddr = paddr_next) { 596 596 pud_t *pud; 597 597 pmd_t *pmd; 598 - pgprot_t prot = PAGE_KERNEL; 598 + pgprot_t prot = _prot; 599 599 600 600 vaddr = (unsigned long)__va(paddr); 601 601 pud = pud_page + pud_index(vaddr); ··· 644 644 if (page_size_mask & (1<<PG_LEVEL_1G)) { 645 645 pages++; 646 646 spin_lock(&init_mm.page_table_lock); 647 + 648 + prot = __pgprot(pgprot_val(prot) | __PAGE_KERNEL_LARGE); 649 + 647 650 set_pte_init((pte_t *)pud, 648 651 pfn_pte((paddr & PUD_MASK) >> PAGE_SHIFT, 649 - PAGE_KERNEL_LARGE), 652 + prot), 650 653 init); 651 654 spin_unlock(&init_mm.page_table_lock); 652 655 paddr_last = paddr_next; ··· 672 669 673 670 static unsigned long __meminit 674 671 phys_p4d_init(p4d_t *p4d_page, unsigned long paddr, unsigned long paddr_end, 675 - unsigned long page_size_mask, bool init) 672 + unsigned long page_size_mask, pgprot_t prot, bool init) 676 673 { 677 674 unsigned long vaddr, vaddr_end, vaddr_next, paddr_next, paddr_last; 678 675 ··· 682 679 683 680 if (!pgtable_l5_enabled()) 684 681 return phys_pud_init((pud_t *) p4d_page, paddr, paddr_end, 685 - page_size_mask, init); 682 + page_size_mask, prot, init); 686 683 687 684 for (; vaddr < vaddr_end; vaddr = vaddr_next) { 688 685 p4d_t *p4d = p4d_page + p4d_index(vaddr); ··· 705 702 if (!p4d_none(*p4d)) { 706 703 pud = pud_offset(p4d, 0); 707 704 paddr_last = phys_pud_init(pud, paddr, __pa(vaddr_end), 708 - page_size_mask, init); 705 + page_size_mask, prot, init); 709 706 continue; 710 707 } 711 708 712 709 pud = alloc_low_page(); 713 710 paddr_last = phys_pud_init(pud, paddr, __pa(vaddr_end), 714 - page_size_mask, init); 711 + page_size_mask, prot, init); 715 712 716 713 spin_lock(&init_mm.page_table_lock); 717 714 p4d_populate_init(&init_mm, p4d, pud, init); ··· 725 722 __kernel_physical_mapping_init(unsigned long paddr_start, 726 723 unsigned long paddr_end, 727 724 unsigned long page_size_mask, 728 - bool init) 725 + pgprot_t prot, bool init) 729 726 { 730 727 bool pgd_changed = false; 731 728 unsigned long vaddr, vaddr_start, vaddr_end, vaddr_next, paddr_last; ··· 746 743 paddr_last = phys_p4d_init(p4d, __pa(vaddr), 747 744 __pa(vaddr_end), 748 745 page_size_mask, 749 - init); 746 + prot, init); 750 747 continue; 751 748 } 752 749 753 750 p4d = alloc_low_page(); 754 751 paddr_last = phys_p4d_init(p4d, __pa(vaddr), __pa(vaddr_end), 755 - page_size_mask, init); 752 + page_size_mask, prot, init); 756 753 757 754 spin_lock(&init_mm.page_table_lock); 758 755 if (pgtable_l5_enabled()) ··· 781 778 unsigned long __meminit 782 779 kernel_physical_mapping_init(unsigned long paddr_start, 783 780 unsigned long paddr_end, 784 - unsigned long page_size_mask) 781 + unsigned long page_size_mask, pgprot_t prot) 785 782 { 786 783 return __kernel_physical_mapping_init(paddr_start, paddr_end, 787 - page_size_mask, true); 784 + page_size_mask, prot, true); 788 785 } 789 786 790 787 /* ··· 799 796 unsigned long page_size_mask) 800 797 { 801 798 return __kernel_physical_mapping_init(paddr_start, paddr_end, 802 - page_size_mask, false); 799 + page_size_mask, PAGE_KERNEL, 800 + false); 803 801 } 804 802 805 803 #ifndef CONFIG_NUMA ··· 847 843 } 848 844 849 845 int add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages, 850 - struct mhp_restrictions *restrictions) 846 + struct mhp_params *params) 851 847 { 852 848 int ret; 853 849 854 - ret = __add_pages(nid, start_pfn, nr_pages, restrictions); 850 + ret = __add_pages(nid, start_pfn, nr_pages, params); 855 851 WARN_ON_ONCE(ret); 856 852 857 853 /* update max_pfn, max_low_pfn and high_memory */ ··· 862 858 } 863 859 864 860 int arch_add_memory(int nid, u64 start, u64 size, 865 - struct mhp_restrictions *restrictions) 861 + struct mhp_params *params) 866 862 { 867 863 unsigned long start_pfn = start >> PAGE_SHIFT; 868 864 unsigned long nr_pages = size >> PAGE_SHIFT; 869 865 870 - init_memory_mapping(start, start + size); 866 + init_memory_mapping(start, start + size, params->pgprot); 871 867 872 - return add_pages(nid, start_pfn, nr_pages, restrictions); 868 + return add_pages(nid, start_pfn, nr_pages, params); 873 869 } 874 870 875 871 #define PAGE_INUSE 0xFD
+2 -1
arch/x86/mm/mm_internal.h
··· 12 12 13 13 unsigned long kernel_physical_mapping_init(unsigned long start, 14 14 unsigned long end, 15 - unsigned long page_size_mask); 15 + unsigned long page_size_mask, 16 + pgprot_t prot); 16 17 unsigned long kernel_physical_mapping_change(unsigned long start, 17 18 unsigned long end, 18 19 unsigned long page_size_mask);
+13
arch/x86/mm/pat/set_memory.c
··· 1795 1795 CPA_PAGES_ARRAY, pages); 1796 1796 } 1797 1797 1798 + /* 1799 + * _set_memory_prot is an internal helper for callers that have been passed 1800 + * a pgprot_t value from upper layers and a reservation has already been taken. 1801 + * If you want to set the pgprot to a specific page protocol, use the 1802 + * set_memory_xx() functions. 1803 + */ 1804 + int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot) 1805 + { 1806 + return change_page_attr_set_clr(&addr, numpages, prot, 1807 + __pgprot(~pgprot_val(prot)), 0, 0, 1808 + NULL); 1809 + } 1810 + 1798 1811 int _set_memory_uc(unsigned long addr, int numpages) 1799 1812 { 1800 1813 /*
+1 -1
arch/x86/mm/pkeys.c
··· 63 63 static inline bool vma_is_pkey_exec_only(struct vm_area_struct *vma) 64 64 { 65 65 /* Do this check first since the vm_flags should be hot */ 66 - if ((vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC)) != VM_EXEC) 66 + if ((vma->vm_flags & VM_ACCESS_FLAGS) != VM_EXEC) 67 67 return false; 68 68 if (vma_pkey(vma) != vma->vm_mm->context.execute_only_pkey) 69 69 return false;
+2 -1
arch/x86/platform/uv/bios_uv.c
··· 352 352 if (type == EFI_MEMORY_MAPPED_IO) 353 353 return ioremap(phys_addr, size); 354 354 355 - last_map_pfn = init_memory_mapping(phys_addr, phys_addr + size); 355 + last_map_pfn = init_memory_mapping(phys_addr, phys_addr + size, 356 + PAGE_KERNEL); 356 357 if ((last_map_pfn << PAGE_SHIFT) < phys_addr + size) { 357 358 unsigned long top = last_map_pfn << PAGE_SHIFT; 358 359 efi_ioremap(top, size - (top - phys_addr), type, attribute);
+2 -8
arch/x86/um/asm/vm-flags.h
··· 9 9 10 10 #ifdef CONFIG_X86_32 11 11 12 - #define VM_DATA_DEFAULT_FLAGS \ 13 - (VM_READ | VM_WRITE | \ 14 - ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ 15 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 12 + #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_TSK_EXEC 16 13 17 14 #else 18 15 19 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 20 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 21 - #define VM_STACK_DEFAULT_FLAGS (VM_GROWSDOWN | VM_READ | VM_WRITE | \ 22 - VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 16 + #define VM_STACK_DEFAULT_FLAGS (VM_GROWSDOWN | VM_DATA_FLAGS_EXEC) 23 17 24 18 #endif 25 19 #endif
-3
arch/xtensa/include/asm/page.h
··· 203 203 204 204 #endif /* __ASSEMBLY__ */ 205 205 206 - #define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ 207 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 208 - 209 206 #include <asm-generic/memory_model.h> 210 207 #endif /* _XTENSA_PAGE_H */
-3
arch/xtensa/include/asm/pgtable.h
··· 266 266 static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITABLE; } 267 267 static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 268 268 static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 269 - static inline int pte_special(pte_t pte) { return 0; } 270 269 271 270 static inline pte_t pte_wrprotect(pte_t pte) 272 271 { pte_val(pte) &= ~(_PAGE_WRITABLE | _PAGE_HW_WRITE); return pte; } ··· 279 280 { pte_val(pte) |= _PAGE_ACCESSED; return pte; } 280 281 static inline pte_t pte_mkwrite(pte_t pte) 281 282 { pte_val(pte) |= _PAGE_WRITABLE; return pte; } 282 - static inline pte_t pte_mkspecial(pte_t pte) 283 - { return pte; } 284 283 285 284 #define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) & ~_PAGE_CA_MASK)) 286 285
+2 -2
drivers/char/hw_random/omap3-rom-rng.c
··· 4 4 * Copyright (C) 2009 Nokia Corporation 5 5 * Author: Juha Yrjola <juha.yrjola@solidboot.com> 6 6 * 7 - * Copyright (C) 2013 Pali Rohár <pali.rohar@gmail.com> 7 + * Copyright (C) 2013 Pali Rohár <pali@kernel.org> 8 8 * 9 9 * This file is licensed under the terms of the GNU General Public 10 10 * License version 2. This program is licensed "as is" without any ··· 178 178 179 179 MODULE_ALIAS("platform:omap3-rom-rng"); 180 180 MODULE_AUTHOR("Juha Yrjola"); 181 - MODULE_AUTHOR("Pali Rohár <pali.rohar@gmail.com>"); 181 + MODULE_AUTHOR("Pali Rohár <pali@kernel.org>"); 182 182 MODULE_LICENSE("GPL");
-1
drivers/dma/tegra20-apb-dma.c
··· 1493 1493 irq = platform_get_irq(pdev, i); 1494 1494 if (irq < 0) { 1495 1495 ret = irq; 1496 - dev_err(&pdev->dev, "No irq resource for chan %d\n", i); 1497 1496 goto err_pm_disable; 1498 1497 } 1499 1498
+2 -2
drivers/hwmon/dell-smm-hwmon.c
··· 7 7 * Hwmon integration: 8 8 * Copyright (C) 2011 Jean Delvare <jdelvare@suse.de> 9 9 * Copyright (C) 2013, 2014 Guenter Roeck <linux@roeck-us.net> 10 - * Copyright (C) 2014, 2015 Pali Rohár <pali.rohar@gmail.com> 10 + * Copyright (C) 2014, 2015 Pali Rohár <pali@kernel.org> 11 11 */ 12 12 13 13 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ··· 86 86 #define I8K_HWMON_HAVE_FAN3 (1 << 12) 87 87 88 88 MODULE_AUTHOR("Massimo Dal Zotto (dz@debian.org)"); 89 - MODULE_AUTHOR("Pali Rohár <pali.rohar@gmail.com>"); 89 + MODULE_AUTHOR("Pali Rohár <pali@kernel.org>"); 90 90 MODULE_DESCRIPTION("Dell laptop SMM BIOS hwmon driver"); 91 91 MODULE_LICENSE("GPL"); 92 92 MODULE_ALIAS("i8k");
+2 -2
drivers/platform/x86/dell-laptop.c
··· 4 4 * 5 5 * Copyright (c) Red Hat <mjg@redhat.com> 6 6 * Copyright (c) 2014 Gabriele Mazzotta <gabriele.mzt@gmail.com> 7 - * Copyright (c) 2014 Pali Rohár <pali.rohar@gmail.com> 7 + * Copyright (c) 2014 Pali Rohár <pali@kernel.org> 8 8 * 9 9 * Based on documentation in the libsmbios package: 10 10 * Copyright (C) 2005-2014 Dell Inc. ··· 2295 2295 2296 2296 MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>"); 2297 2297 MODULE_AUTHOR("Gabriele Mazzotta <gabriele.mzt@gmail.com>"); 2298 - MODULE_AUTHOR("Pali Rohár <pali.rohar@gmail.com>"); 2298 + MODULE_AUTHOR("Pali Rohár <pali@kernel.org>"); 2299 2299 MODULE_DESCRIPTION("Dell laptop driver"); 2300 2300 MODULE_LICENSE("GPL");
+2 -2
drivers/platform/x86/dell-rbtn.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-or-later 2 2 /* 3 3 Dell Airplane Mode Switch driver 4 - Copyright (C) 2014-2015 Pali Rohár <pali.rohar@gmail.com> 4 + Copyright (C) 2014-2015 Pali Rohár <pali@kernel.org> 5 5 6 6 */ 7 7 ··· 495 495 "(default true)"); 496 496 MODULE_DEVICE_TABLE(acpi, rbtn_ids); 497 497 MODULE_DESCRIPTION("Dell Airplane Mode Switch driver"); 498 - MODULE_AUTHOR("Pali Rohár <pali.rohar@gmail.com>"); 498 + MODULE_AUTHOR("Pali Rohár <pali@kernel.org>"); 499 499 MODULE_LICENSE("GPL");
+1 -1
drivers/platform/x86/dell-rbtn.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 2 /* 3 3 Dell Airplane Mode Switch driver 4 - Copyright (C) 2014-2015 Pali Rohár <pali.rohar@gmail.com> 4 + Copyright (C) 2014-2015 Pali Rohár <pali@kernel.org> 5 5 6 6 */ 7 7
+2 -2
drivers/platform/x86/dell-smbios-base.c
··· 4 4 * 5 5 * Copyright (c) Red Hat <mjg@redhat.com> 6 6 * Copyright (c) 2014 Gabriele Mazzotta <gabriele.mzt@gmail.com> 7 - * Copyright (c) 2014 Pali Rohár <pali.rohar@gmail.com> 7 + * Copyright (c) 2014 Pali Rohár <pali@kernel.org> 8 8 * 9 9 * Based on documentation in the libsmbios package: 10 10 * Copyright (C) 2005-2014 Dell Inc. ··· 645 645 646 646 MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>"); 647 647 MODULE_AUTHOR("Gabriele Mazzotta <gabriele.mzt@gmail.com>"); 648 - MODULE_AUTHOR("Pali Rohár <pali.rohar@gmail.com>"); 648 + MODULE_AUTHOR("Pali Rohár <pali@kernel.org>"); 649 649 MODULE_AUTHOR("Mario Limonciello <mario.limonciello@dell.com>"); 650 650 MODULE_DESCRIPTION("Common functions for kernel modules using Dell SMBIOS"); 651 651 MODULE_LICENSE("GPL");
+1 -1
drivers/platform/x86/dell-smbios-smm.c
··· 4 4 * 5 5 * Copyright (c) Red Hat <mjg@redhat.com> 6 6 * Copyright (c) 2014 Gabriele Mazzotta <gabriele.mzt@gmail.com> 7 - * Copyright (c) 2014 Pali Rohár <pali.rohar@gmail.com> 7 + * Copyright (c) 2014 Pali Rohár <pali@kernel.org> 8 8 * Copyright (c) 2017 Dell Inc. 9 9 */ 10 10 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+1 -1
drivers/platform/x86/dell-smbios.h
··· 4 4 * 5 5 * Copyright (c) Red Hat <mjg@redhat.com> 6 6 * Copyright (c) 2014 Gabriele Mazzotta <gabriele.mzt@gmail.com> 7 - * Copyright (c) 2014 Pali Rohár <pali.rohar@gmail.com> 7 + * Copyright (c) 2014 Pali Rohár <pali@kernel.org> 8 8 * 9 9 * Based on documentation in the libsmbios package: 10 10 * Copyright (C) 2005-2014 Dell Inc.
+1 -1
drivers/platform/x86/dell-smo8800.c
··· 3 3 * dell-smo8800.c - Dell Latitude ACPI SMO88XX freefall sensor driver 4 4 * 5 5 * Copyright (C) 2012 Sonal Santan <sonal.santan@gmail.com> 6 - * Copyright (C) 2014 Pali Rohár <pali.rohar@gmail.com> 6 + * Copyright (C) 2014 Pali Rohár <pali@kernel.org> 7 7 * 8 8 * This is loosely based on lis3lv02d driver. 9 9 */
+2 -2
drivers/platform/x86/dell-wmi.c
··· 3 3 * Dell WMI hotkeys 4 4 * 5 5 * Copyright (C) 2008 Red Hat <mjg@redhat.com> 6 - * Copyright (C) 2014-2015 Pali Rohár <pali.rohar@gmail.com> 6 + * Copyright (C) 2014-2015 Pali Rohár <pali@kernel.org> 7 7 * 8 8 * Portions based on wistron_btns.c: 9 9 * Copyright (C) 2005 Miloslav Trmac <mitr@volny.cz> ··· 29 29 #include "dell-wmi-descriptor.h" 30 30 31 31 MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>"); 32 - MODULE_AUTHOR("Pali Rohár <pali.rohar@gmail.com>"); 32 + MODULE_AUTHOR("Pali Rohár <pali@kernel.org>"); 33 33 MODULE_DESCRIPTION("Dell laptop WMI hotkeys driver"); 34 34 MODULE_LICENSE("GPL"); 35 35
+2 -2
drivers/power/supply/bq2415x_charger.c
··· 2 2 /* 3 3 * bq2415x charger driver 4 4 * 5 - * Copyright (C) 2011-2013 Pali Rohár <pali.rohar@gmail.com> 5 + * Copyright (C) 2011-2013 Pali Rohár <pali@kernel.org> 6 6 * 7 7 * Datasheets: 8 8 * http://www.ti.com/product/bq24150 ··· 1788 1788 }; 1789 1789 module_i2c_driver(bq2415x_driver); 1790 1790 1791 - MODULE_AUTHOR("Pali Rohár <pali.rohar@gmail.com>"); 1791 + MODULE_AUTHOR("Pali Rohár <pali@kernel.org>"); 1792 1792 MODULE_DESCRIPTION("bq2415x charger driver"); 1793 1793 MODULE_LICENSE("GPL");
+1 -1
drivers/power/supply/bq27xxx_battery.c
··· 4 4 * Copyright (C) 2008 Rodolfo Giometti <giometti@linux.it> 5 5 * Copyright (C) 2008 Eurotech S.p.A. <info@eurotech.it> 6 6 * Copyright (C) 2010-2011 Lars-Peter Clausen <lars@metafoo.de> 7 - * Copyright (C) 2011 Pali Rohár <pali.rohar@gmail.com> 7 + * Copyright (C) 2011 Pali Rohár <pali@kernel.org> 8 8 * Copyright (C) 2017 Liam Breck <kernel@networkimprov.net> 9 9 * 10 10 * Based on a previous work by Copyright (C) 2008 Texas Instruments, Inc.
+1 -1
drivers/power/supply/isp1704_charger.c
··· 3 3 * ISP1704 USB Charger Detection driver 4 4 * 5 5 * Copyright (C) 2010 Nokia Corporation 6 - * Copyright (C) 2012 - 2013 Pali Rohár <pali.rohar@gmail.com> 6 + * Copyright (C) 2012 - 2013 Pali Rohár <pali@kernel.org> 7 7 */ 8 8 9 9 #include <linux/kernel.h>
+2 -2
drivers/power/supply/rx51_battery.c
··· 2 2 /* 3 3 * Nokia RX-51 battery driver 4 4 * 5 - * Copyright (C) 2012 Pali Rohár <pali.rohar@gmail.com> 5 + * Copyright (C) 2012 Pali Rohár <pali@kernel.org> 6 6 */ 7 7 8 8 #include <linux/module.h> ··· 278 278 module_platform_driver(rx51_battery_driver); 279 279 280 280 MODULE_ALIAS("platform:rx51-battery"); 281 - MODULE_AUTHOR("Pali Rohár <pali.rohar@gmail.com>"); 281 + MODULE_AUTHOR("Pali Rohár <pali@kernel.org>"); 282 282 MODULE_DESCRIPTION("Nokia RX-51 battery driver"); 283 283 MODULE_LICENSE("GPL");
+1 -1
drivers/staging/gasket/gasket_core.c
··· 689 689 690 690 /* Make sure that no wrong flags are set. */ 691 691 requested_permissions = 692 - (vma->vm_flags & (VM_WRITE | VM_READ | VM_EXEC)); 692 + (vma->vm_flags & VM_ACCESS_FLAGS); 693 693 if (requested_permissions & ~(bar_permissions)) { 694 694 dev_dbg(gasket_dev->dev, 695 695 "Attempting to map a region with requested permissions 0x%x, but region has permissions 0x%x.\n",
+3 -1
fs/filesystems.c
··· 272 272 fs = __get_fs_type(name, len); 273 273 if (!fs && (request_module("fs-%.*s", len, name) == 0)) { 274 274 fs = __get_fs_type(name, len); 275 - WARN_ONCE(!fs, "request_module fs-%.*s succeeded, but still no fs?\n", len, name); 275 + if (!fs) 276 + pr_warn_once("request_module fs-%.*s succeeded, but still no fs?\n", 277 + len, name); 276 278 } 277 279 278 280 if (dot && fs && !(fs->fs_flags & FS_HAS_SUBTYPE)) {
+4
fs/hfsplus/attributes.c
··· 292 292 return -ENOENT; 293 293 } 294 294 295 + /* Avoid btree corruption */ 296 + hfs_bnode_read(fd->bnode, fd->search_key, 297 + fd->keyoffset, fd->keylength); 298 + 295 299 err = hfs_brec_remove(fd); 296 300 if (err) 297 301 return err;
+4
fs/ocfs2/alloc.c
··· 7402 7402 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; 7403 7403 struct ocfs2_inline_data *idata = &di->id2.i_data; 7404 7404 7405 + /* No need to punch hole beyond i_size. */ 7406 + if (start >= i_size_read(inode)) 7407 + return 0; 7408 + 7405 7409 if (end > i_size_read(inode)) 7406 7410 end = i_size_read(inode); 7407 7411
+5 -2
fs/seq_file.c
··· 232 232 loff_t pos = m->index; 233 233 234 234 p = m->op->next(m, p, &m->index); 235 - if (pos == m->index) 236 - /* Buggy ->next function */ 235 + if (pos == m->index) { 236 + pr_info_ratelimited("buggy seq_file .next function %ps " 237 + "did not updated position index\n", 238 + m->op->next); 237 239 m->index++; 240 + } 238 241 if (!p || IS_ERR(p)) { 239 242 err = PTR_ERR(p); 240 243 break;
+1 -1
fs/udf/ecma_167.h
··· 5 5 * http://www.ecma.ch 6 6 * 7 7 * Copyright (c) 2001-2002 Ben Fennema 8 - * Copyright (c) 2017-2019 Pali Rohár <pali.rohar@gmail.com> 8 + * Copyright (c) 2017-2019 Pali Rohár <pali@kernel.org> 9 9 * All rights reserved. 10 10 * 11 11 * Redistribution and use in source and binary forms, with or without
+1 -1
fs/udf/osta_udf.h
··· 5 5 * http://www.osta.org 6 6 * 7 7 * Copyright (c) 2001-2004 Ben Fennema 8 - * Copyright (c) 2017-2019 Pali Rohár <pali.rohar@gmail.com> 8 + * Copyright (c) 2017-2019 Pali Rohár <pali@kernel.org> 9 9 * All rights reserved. 10 10 * 11 11 * Redistribution and use in source and binary forms, with or without
+12 -2
include/linux/cma.h
··· 4 4 5 5 #include <linux/init.h> 6 6 #include <linux/types.h> 7 + #include <linux/numa.h> 7 8 8 9 /* 9 10 * There is always at least global CMA area and a few optional ··· 25 24 extern unsigned long cma_get_size(const struct cma *cma); 26 25 extern const char *cma_get_name(const struct cma *cma); 27 26 28 - extern int __init cma_declare_contiguous(phys_addr_t base, 27 + extern int __init cma_declare_contiguous_nid(phys_addr_t base, 29 28 phys_addr_t size, phys_addr_t limit, 30 29 phys_addr_t alignment, unsigned int order_per_bit, 31 - bool fixed, const char *name, struct cma **res_cma); 30 + bool fixed, const char *name, struct cma **res_cma, 31 + int nid); 32 + static inline int __init cma_declare_contiguous(phys_addr_t base, 33 + phys_addr_t size, phys_addr_t limit, 34 + phys_addr_t alignment, unsigned int order_per_bit, 35 + bool fixed, const char *name, struct cma **res_cma) 36 + { 37 + return cma_declare_contiguous_nid(base, size, limit, alignment, 38 + order_per_bit, fixed, name, res_cma, NUMA_NO_NODE); 39 + } 32 40 extern int cma_init_reserved_mem(phys_addr_t base, phys_addr_t size, 33 41 unsigned int order_per_bit, 34 42 const char *name,
+12
include/linux/hugetlb.h
··· 895 895 return ptl; 896 896 } 897 897 898 + #if defined(CONFIG_HUGETLB_PAGE) && defined(CONFIG_CMA) 899 + extern void __init hugetlb_cma_reserve(int order); 900 + extern void __init hugetlb_cma_check(void); 901 + #else 902 + static inline __init void hugetlb_cma_reserve(int order) 903 + { 904 + } 905 + static inline __init void hugetlb_cma_check(void) 906 + { 907 + } 908 + #endif 909 + 898 910 #endif /* _LINUX_HUGETLB_H */
+3
include/linux/memblock.h
··· 348 348 349 349 phys_addr_t memblock_phys_alloc_range(phys_addr_t size, phys_addr_t align, 350 350 phys_addr_t start, phys_addr_t end); 351 + phys_addr_t memblock_alloc_range_nid(phys_addr_t size, 352 + phys_addr_t align, phys_addr_t start, 353 + phys_addr_t end, int nid, bool exact_nid); 351 354 phys_addr_t memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid); 352 355 353 356 static inline phys_addr_t memblock_phys_alloc(phys_addr_t size,
+11 -10
include/linux/memory_hotplug.h
··· 58 58 }; 59 59 60 60 /* 61 - * Restrictions for the memory hotplug: 62 - * flags: MHP_ flags 63 - * altmap: alternative allocator for memmap array 61 + * Extended parameters for memory hotplug: 62 + * altmap: alternative allocator for memmap array (optional) 63 + * pgprot: page protection flags to apply to newly created page tables 64 + * (required) 64 65 */ 65 - struct mhp_restrictions { 66 - unsigned long flags; 66 + struct mhp_params { 67 67 struct vmem_altmap *altmap; 68 + pgprot_t pgprot; 68 69 }; 69 70 70 71 /* ··· 115 114 extern int try_online_node(int nid); 116 115 117 116 extern int arch_add_memory(int nid, u64 start, u64 size, 118 - struct mhp_restrictions *restrictions); 117 + struct mhp_params *params); 119 118 extern u64 max_mem_size; 120 119 121 120 extern int memhp_online_type_from_str(const char *str); ··· 136 135 137 136 /* reasonably generic interface to expand the physical pages */ 138 137 extern int __add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages, 139 - struct mhp_restrictions *restrictions); 138 + struct mhp_params *params); 140 139 141 140 #ifndef CONFIG_ARCH_HAS_ADD_PAGES 142 141 static inline int add_pages(int nid, unsigned long start_pfn, 143 - unsigned long nr_pages, struct mhp_restrictions *restrictions) 142 + unsigned long nr_pages, struct mhp_params *params) 144 143 { 145 - return __add_pages(nid, start_pfn, nr_pages, restrictions); 144 + return __add_pages(nid, start_pfn, nr_pages, params); 146 145 } 147 146 #else /* ARCH_HAS_ADD_PAGES */ 148 147 int add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages, 149 - struct mhp_restrictions *restrictions); 148 + struct mhp_params *params); 150 149 #endif /* ARCH_HAS_ADD_PAGES */ 151 150 152 151 #ifdef CONFIG_NUMA
+33 -1
include/linux/mm.h
··· 343 343 /* Bits set in the VMA until the stack is in its final location */ 344 344 #define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ) 345 345 346 + #define TASK_EXEC ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) 347 + 348 + /* Common data flag combinations */ 349 + #define VM_DATA_FLAGS_TSK_EXEC (VM_READ | VM_WRITE | TASK_EXEC | \ 350 + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 351 + #define VM_DATA_FLAGS_NON_EXEC (VM_READ | VM_WRITE | VM_MAYREAD | \ 352 + VM_MAYWRITE | VM_MAYEXEC) 353 + #define VM_DATA_FLAGS_EXEC (VM_READ | VM_WRITE | VM_EXEC | \ 354 + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) 355 + 356 + #ifndef VM_DATA_DEFAULT_FLAGS /* arch can override this */ 357 + #define VM_DATA_DEFAULT_FLAGS VM_DATA_FLAGS_EXEC 358 + #endif 359 + 346 360 #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 347 361 #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 348 362 #endif ··· 368 354 #endif 369 355 370 356 #define VM_STACK_FLAGS (VM_STACK | VM_STACK_DEFAULT_FLAGS | VM_ACCOUNT) 357 + 358 + /* VMA basic access permission flags */ 359 + #define VM_ACCESS_FLAGS (VM_READ | VM_WRITE | VM_EXEC) 360 + 371 361 372 362 /* 373 363 * Special vmas that are non-mergable, non-mlock()able. ··· 650 632 651 633 static inline bool vma_is_accessible(struct vm_area_struct *vma) 652 634 { 653 - return vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC); 635 + return vma->vm_flags & VM_ACCESS_FLAGS; 654 636 } 655 637 656 638 #ifdef CONFIG_SHMEM ··· 1927 1909 } 1928 1910 #endif 1929 1911 1912 + #ifndef CONFIG_ARCH_HAS_PTE_SPECIAL 1913 + static inline int pte_special(pte_t pte) 1914 + { 1915 + return 0; 1916 + } 1917 + 1918 + static inline pte_t pte_mkspecial(pte_t pte) 1919 + { 1920 + return pte; 1921 + } 1922 + #endif 1923 + 1930 1924 #ifndef CONFIG_ARCH_HAS_PTE_DEVMAP 1931 1925 static inline int pte_devmap(pte_t pte) 1932 1926 { ··· 2719 2689 int remap_pfn_range(struct vm_area_struct *, unsigned long addr, 2720 2690 unsigned long pfn, unsigned long size, pgprot_t); 2721 2691 int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *); 2692 + int vm_insert_pages(struct vm_area_struct *vma, unsigned long addr, 2693 + struct page **pages, unsigned long *num); 2722 2694 int vm_map_pages(struct vm_area_struct *vma, struct page **pages, 2723 2695 unsigned long num); 2724 2696 int vm_map_pages_zero(struct vm_area_struct *vma, struct page **pages,
+1 -1
include/linux/power/bq2415x_charger.h
··· 2 2 /* 3 3 * bq2415x charger driver 4 4 * 5 - * Copyright (C) 2011-2013 Pali Rohár <pali.rohar@gmail.com> 5 + * Copyright (C) 2011-2013 Pali Rohár <pali@kernel.org> 6 6 */ 7 7 8 8 #ifndef BQ2415X_CHARGER_H
+1 -1
include/linux/slab.h
··· 501 501 * :ref:`Documentation/core-api/mm-api.rst <mm-api-gfp-flags>` 502 502 * 503 503 * The recommended usage of the @flags is described at 504 - * :ref:`Documentation/core-api/memory-allocation.rst <memory-allocation>` 504 + * :ref:`Documentation/core-api/memory-allocation.rst <memory_allocation>` 505 505 * 506 506 * Below is a brief outline of the most useful GFP flags 507 507 *
+1 -1
ipc/util.c
··· 764 764 total++; 765 765 } 766 766 767 + *new_pos = pos + 1; 767 768 if (total >= ids->in_use) 768 769 return NULL; 769 770 770 771 for (; pos < ipc_mni; pos++) { 771 772 ipc = idr_find(&ids->ipcs_idr, pos); 772 773 if (ipc != NULL) { 773 - *new_pos = pos + 1; 774 774 rcu_read_lock(); 775 775 ipc_lock_object(ipc); 776 776 return ipc;
+1 -1
kernel/gcov/fs.c
··· 108 108 { 109 109 struct gcov_iterator *iter = data; 110 110 111 + (*pos)++; 111 112 if (gcov_iter_next(iter)) 112 113 return NULL; 113 - (*pos)++; 114 114 115 115 return iter; 116 116 }
+2 -2
kernel/kmod.c
··· 120 120 * invoke it. 121 121 * 122 122 * If module auto-loading support is disabled then this function 123 - * becomes a no-operation. 123 + * simply returns -ENOENT. 124 124 */ 125 125 int __request_module(bool wait, const char *fmt, ...) 126 126 { ··· 137 137 WARN_ON_ONCE(wait && current_is_async()); 138 138 139 139 if (!modprobe_path[0]) 140 - return 0; 140 + return -ENOENT; 141 141 142 142 va_start(args, fmt); 143 143 ret = vsnprintf(module_name, MODULE_NAME_LEN, fmt, args);
+9 -7
mm/cma.c
··· 220 220 } 221 221 222 222 /** 223 - * cma_declare_contiguous() - reserve custom contiguous area 223 + * cma_declare_contiguous_nid() - reserve custom contiguous area 224 224 * @base: Base address of the reserved area optional, use 0 for any 225 225 * @size: Size of the reserved area (in bytes), 226 226 * @limit: End address of the reserved memory (optional, 0 for any). ··· 229 229 * @fixed: hint about where to place the reserved area 230 230 * @name: The name of the area. See function cma_init_reserved_mem() 231 231 * @res_cma: Pointer to store the created cma region. 232 + * @nid: nid of the free area to find, %NUMA_NO_NODE for any node 232 233 * 233 234 * This function reserves memory from early allocator. It should be 234 235 * called by arch specific code once the early allocator (memblock or bootmem) ··· 239 238 * If @fixed is true, reserve contiguous area at exactly @base. If false, 240 239 * reserve in range from @base to @limit. 241 240 */ 242 - int __init cma_declare_contiguous(phys_addr_t base, 241 + int __init cma_declare_contiguous_nid(phys_addr_t base, 243 242 phys_addr_t size, phys_addr_t limit, 244 243 phys_addr_t alignment, unsigned int order_per_bit, 245 - bool fixed, const char *name, struct cma **res_cma) 244 + bool fixed, const char *name, struct cma **res_cma, 245 + int nid) 246 246 { 247 247 phys_addr_t memblock_end = memblock_end_of_DRAM(); 248 248 phys_addr_t highmem_start; ··· 338 336 * memory in case of failure. 339 337 */ 340 338 if (base < highmem_start && limit > highmem_start) { 341 - addr = memblock_phys_alloc_range(size, alignment, 342 - highmem_start, limit); 339 + addr = memblock_alloc_range_nid(size, alignment, 340 + highmem_start, limit, nid, false); 343 341 limit = highmem_start; 344 342 } 345 343 346 344 if (!addr) { 347 - addr = memblock_phys_alloc_range(size, alignment, base, 348 - limit); 345 + addr = memblock_alloc_range_nid(size, alignment, base, 346 + limit, nid, false); 349 347 if (!addr) { 350 348 ret = -ENOMEM; 351 349 goto err;
+109
mm/hugetlb.c
··· 28 28 #include <linux/jhash.h> 29 29 #include <linux/numa.h> 30 30 #include <linux/llist.h> 31 + #include <linux/cma.h> 31 32 32 33 #include <asm/page.h> 33 34 #include <asm/pgtable.h> ··· 45 44 int hugetlb_max_hstate __read_mostly; 46 45 unsigned int default_hstate_idx; 47 46 struct hstate hstates[HUGE_MAX_HSTATE]; 47 + 48 + static struct cma *hugetlb_cma[MAX_NUMNODES]; 49 + 48 50 /* 49 51 * Minimum page order among possible hugepage sizes, set to a proper value 50 52 * at boot time. ··· 1232 1228 1233 1229 static void free_gigantic_page(struct page *page, unsigned int order) 1234 1230 { 1231 + /* 1232 + * If the page isn't allocated using the cma allocator, 1233 + * cma_release() returns false. 1234 + */ 1235 + if (IS_ENABLED(CONFIG_CMA) && 1236 + cma_release(hugetlb_cma[page_to_nid(page)], page, 1 << order)) 1237 + return; 1238 + 1235 1239 free_contig_range(page_to_pfn(page), 1 << order); 1236 1240 } 1237 1241 ··· 1248 1236 int nid, nodemask_t *nodemask) 1249 1237 { 1250 1238 unsigned long nr_pages = 1UL << huge_page_order(h); 1239 + 1240 + if (IS_ENABLED(CONFIG_CMA)) { 1241 + struct page *page; 1242 + int node; 1243 + 1244 + for_each_node_mask(node, *nodemask) { 1245 + if (!hugetlb_cma[node]) 1246 + continue; 1247 + 1248 + page = cma_alloc(hugetlb_cma[node], nr_pages, 1249 + huge_page_order(h), true); 1250 + if (page) 1251 + return page; 1252 + } 1253 + } 1251 1254 1252 1255 return alloc_contig_pages(nr_pages, gfp_mask, nid, nodemask); 1253 1256 } ··· 1308 1281 set_compound_page_dtor(page, NULL_COMPOUND_DTOR); 1309 1282 set_page_refcounted(page); 1310 1283 if (hstate_is_gigantic(h)) { 1284 + /* 1285 + * Temporarily drop the hugetlb_lock, because 1286 + * we might block in free_gigantic_page(). 1287 + */ 1288 + spin_unlock(&hugetlb_lock); 1311 1289 destroy_compound_gigantic_page(page, huge_page_order(h)); 1312 1290 free_gigantic_page(page, huge_page_order(h)); 1291 + spin_lock(&hugetlb_lock); 1313 1292 } else { 1314 1293 __free_pages(page, huge_page_order(h)); 1315 1294 } ··· 2572 2539 2573 2540 for (i = 0; i < h->max_huge_pages; ++i) { 2574 2541 if (hstate_is_gigantic(h)) { 2542 + if (IS_ENABLED(CONFIG_CMA) && hugetlb_cma[0]) { 2543 + pr_warn_once("HugeTLB: hugetlb_cma is enabled, skip boot time allocation\n"); 2544 + break; 2545 + } 2575 2546 if (!alloc_bootmem_huge_page(h)) 2576 2547 break; 2577 2548 } else if (!alloc_pool_huge_page(h, ··· 3231 3194 default_hstate.max_huge_pages = default_hstate_max_huge_pages; 3232 3195 } 3233 3196 3197 + hugetlb_cma_check(); 3234 3198 hugetlb_init_hstates(); 3235 3199 gather_bootmem_prealloc(); 3236 3200 report_hugepages(); ··· 5544 5506 spin_unlock(&hugetlb_lock); 5545 5507 } 5546 5508 } 5509 + 5510 + #ifdef CONFIG_CMA 5511 + static unsigned long hugetlb_cma_size __initdata; 5512 + static bool cma_reserve_called __initdata; 5513 + 5514 + static int __init cmdline_parse_hugetlb_cma(char *p) 5515 + { 5516 + hugetlb_cma_size = memparse(p, &p); 5517 + return 0; 5518 + } 5519 + 5520 + early_param("hugetlb_cma", cmdline_parse_hugetlb_cma); 5521 + 5522 + void __init hugetlb_cma_reserve(int order) 5523 + { 5524 + unsigned long size, reserved, per_node; 5525 + int nid; 5526 + 5527 + cma_reserve_called = true; 5528 + 5529 + if (!hugetlb_cma_size) 5530 + return; 5531 + 5532 + if (hugetlb_cma_size < (PAGE_SIZE << order)) { 5533 + pr_warn("hugetlb_cma: cma area should be at least %lu MiB\n", 5534 + (PAGE_SIZE << order) / SZ_1M); 5535 + return; 5536 + } 5537 + 5538 + /* 5539 + * If 3 GB area is requested on a machine with 4 numa nodes, 5540 + * let's allocate 1 GB on first three nodes and ignore the last one. 5541 + */ 5542 + per_node = DIV_ROUND_UP(hugetlb_cma_size, nr_online_nodes); 5543 + pr_info("hugetlb_cma: reserve %lu MiB, up to %lu MiB per node\n", 5544 + hugetlb_cma_size / SZ_1M, per_node / SZ_1M); 5545 + 5546 + reserved = 0; 5547 + for_each_node_state(nid, N_ONLINE) { 5548 + int res; 5549 + 5550 + size = min(per_node, hugetlb_cma_size - reserved); 5551 + size = round_up(size, PAGE_SIZE << order); 5552 + 5553 + res = cma_declare_contiguous_nid(0, size, 0, PAGE_SIZE << order, 5554 + 0, false, "hugetlb", 5555 + &hugetlb_cma[nid], nid); 5556 + if (res) { 5557 + pr_warn("hugetlb_cma: reservation failed: err %d, node %d", 5558 + res, nid); 5559 + continue; 5560 + } 5561 + 5562 + reserved += size; 5563 + pr_info("hugetlb_cma: reserved %lu MiB on node %d\n", 5564 + size / SZ_1M, nid); 5565 + 5566 + if (reserved >= hugetlb_cma_size) 5567 + break; 5568 + } 5569 + } 5570 + 5571 + void __init hugetlb_cma_check(void) 5572 + { 5573 + if (!hugetlb_cma_size || cma_reserve_called) 5574 + return; 5575 + 5576 + pr_warn("hugetlb_cma: the option isn't supported by current arch\n"); 5577 + } 5578 + 5579 + #endif /* CONFIG_CMA */
+1 -1
mm/memblock.c
··· 1349 1349 * Return: 1350 1350 * Physical address of allocated memory block on success, %0 on failure. 1351 1351 */ 1352 - static phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size, 1352 + phys_addr_t __init memblock_alloc_range_nid(phys_addr_t size, 1353 1353 phys_addr_t align, phys_addr_t start, 1354 1354 phys_addr_t end, int nid, 1355 1355 bool exact_nid)
+3
mm/memcontrol.c
··· 2336 2336 usage = page_counter_read(&memcg->memory); 2337 2337 high = READ_ONCE(memcg->high); 2338 2338 2339 + if (usage <= high) 2340 + continue; 2341 + 2339 2342 /* 2340 2343 * Prevent division by 0 in overage calculation by acting as if 2341 2344 * it was a threshold of 1 page
+151 -17
mm/memory.c
··· 1419 1419 } 1420 1420 EXPORT_SYMBOL_GPL(zap_vma_ptes); 1421 1421 1422 - pte_t *__get_locked_pte(struct mm_struct *mm, unsigned long addr, 1423 - spinlock_t **ptl) 1422 + static pmd_t *walk_to_pmd(struct mm_struct *mm, unsigned long addr) 1424 1423 { 1425 1424 pgd_t *pgd; 1426 1425 p4d_t *p4d; ··· 1438 1439 return NULL; 1439 1440 1440 1441 VM_BUG_ON(pmd_trans_huge(*pmd)); 1442 + return pmd; 1443 + } 1444 + 1445 + pte_t *__get_locked_pte(struct mm_struct *mm, unsigned long addr, 1446 + spinlock_t **ptl) 1447 + { 1448 + pmd_t *pmd = walk_to_pmd(mm, addr); 1449 + 1450 + if (!pmd) 1451 + return NULL; 1441 1452 return pte_alloc_map_lock(mm, pmd, addr, ptl); 1453 + } 1454 + 1455 + static int validate_page_before_insert(struct page *page) 1456 + { 1457 + if (PageAnon(page) || PageSlab(page) || page_has_type(page)) 1458 + return -EINVAL; 1459 + flush_dcache_page(page); 1460 + return 0; 1461 + } 1462 + 1463 + static int insert_page_into_pte_locked(struct mm_struct *mm, pte_t *pte, 1464 + unsigned long addr, struct page *page, pgprot_t prot) 1465 + { 1466 + if (!pte_none(*pte)) 1467 + return -EBUSY; 1468 + /* Ok, finally just insert the thing.. */ 1469 + get_page(page); 1470 + inc_mm_counter_fast(mm, mm_counter_file(page)); 1471 + page_add_file_rmap(page, false); 1472 + set_pte_at(mm, addr, pte, mk_pte(page, prot)); 1473 + return 0; 1442 1474 } 1443 1475 1444 1476 /* ··· 1487 1457 pte_t *pte; 1488 1458 spinlock_t *ptl; 1489 1459 1490 - retval = -EINVAL; 1491 - if (PageAnon(page) || PageSlab(page) || page_has_type(page)) 1460 + retval = validate_page_before_insert(page); 1461 + if (retval) 1492 1462 goto out; 1493 1463 retval = -ENOMEM; 1494 - flush_dcache_page(page); 1495 1464 pte = get_locked_pte(mm, addr, &ptl); 1496 1465 if (!pte) 1497 1466 goto out; 1498 - retval = -EBUSY; 1499 - if (!pte_none(*pte)) 1500 - goto out_unlock; 1501 - 1502 - /* Ok, finally just insert the thing.. */ 1503 - get_page(page); 1504 - inc_mm_counter_fast(mm, mm_counter_file(page)); 1505 - page_add_file_rmap(page, false); 1506 - set_pte_at(mm, addr, pte, mk_pte(page, prot)); 1507 - 1508 - retval = 0; 1509 - out_unlock: 1467 + retval = insert_page_into_pte_locked(mm, pte, addr, page, prot); 1510 1468 pte_unmap_unlock(pte, ptl); 1511 1469 out: 1512 1470 return retval; 1513 1471 } 1472 + 1473 + #ifdef pte_index 1474 + static int insert_page_in_batch_locked(struct mm_struct *mm, pmd_t *pmd, 1475 + unsigned long addr, struct page *page, pgprot_t prot) 1476 + { 1477 + int err; 1478 + 1479 + if (!page_count(page)) 1480 + return -EINVAL; 1481 + err = validate_page_before_insert(page); 1482 + return err ? err : insert_page_into_pte_locked( 1483 + mm, pte_offset_map(pmd, addr), addr, page, prot); 1484 + } 1485 + 1486 + /* insert_pages() amortizes the cost of spinlock operations 1487 + * when inserting pages in a loop. Arch *must* define pte_index. 1488 + */ 1489 + static int insert_pages(struct vm_area_struct *vma, unsigned long addr, 1490 + struct page **pages, unsigned long *num, pgprot_t prot) 1491 + { 1492 + pmd_t *pmd = NULL; 1493 + spinlock_t *pte_lock = NULL; 1494 + struct mm_struct *const mm = vma->vm_mm; 1495 + unsigned long curr_page_idx = 0; 1496 + unsigned long remaining_pages_total = *num; 1497 + unsigned long pages_to_write_in_pmd; 1498 + int ret; 1499 + more: 1500 + ret = -EFAULT; 1501 + pmd = walk_to_pmd(mm, addr); 1502 + if (!pmd) 1503 + goto out; 1504 + 1505 + pages_to_write_in_pmd = min_t(unsigned long, 1506 + remaining_pages_total, PTRS_PER_PTE - pte_index(addr)); 1507 + 1508 + /* Allocate the PTE if necessary; takes PMD lock once only. */ 1509 + ret = -ENOMEM; 1510 + if (pte_alloc(mm, pmd)) 1511 + goto out; 1512 + pte_lock = pte_lockptr(mm, pmd); 1513 + 1514 + while (pages_to_write_in_pmd) { 1515 + int pte_idx = 0; 1516 + const int batch_size = min_t(int, pages_to_write_in_pmd, 8); 1517 + 1518 + spin_lock(pte_lock); 1519 + for (; pte_idx < batch_size; ++pte_idx) { 1520 + int err = insert_page_in_batch_locked(mm, pmd, 1521 + addr, pages[curr_page_idx], prot); 1522 + if (unlikely(err)) { 1523 + spin_unlock(pte_lock); 1524 + ret = err; 1525 + remaining_pages_total -= pte_idx; 1526 + goto out; 1527 + } 1528 + addr += PAGE_SIZE; 1529 + ++curr_page_idx; 1530 + } 1531 + spin_unlock(pte_lock); 1532 + pages_to_write_in_pmd -= batch_size; 1533 + remaining_pages_total -= batch_size; 1534 + } 1535 + if (remaining_pages_total) 1536 + goto more; 1537 + ret = 0; 1538 + out: 1539 + *num = remaining_pages_total; 1540 + return ret; 1541 + } 1542 + #endif /* ifdef pte_index */ 1543 + 1544 + /** 1545 + * vm_insert_pages - insert multiple pages into user vma, batching the pmd lock. 1546 + * @vma: user vma to map to 1547 + * @addr: target start user address of these pages 1548 + * @pages: source kernel pages 1549 + * @num: in: number of pages to map. out: number of pages that were *not* 1550 + * mapped. (0 means all pages were successfully mapped). 1551 + * 1552 + * Preferred over vm_insert_page() when inserting multiple pages. 1553 + * 1554 + * In case of error, we may have mapped a subset of the provided 1555 + * pages. It is the caller's responsibility to account for this case. 1556 + * 1557 + * The same restrictions apply as in vm_insert_page(). 1558 + */ 1559 + int vm_insert_pages(struct vm_area_struct *vma, unsigned long addr, 1560 + struct page **pages, unsigned long *num) 1561 + { 1562 + #ifdef pte_index 1563 + const unsigned long end_addr = addr + (*num * PAGE_SIZE) - 1; 1564 + 1565 + if (addr < vma->vm_start || end_addr >= vma->vm_end) 1566 + return -EFAULT; 1567 + if (!(vma->vm_flags & VM_MIXEDMAP)) { 1568 + BUG_ON(down_read_trylock(&vma->vm_mm->mmap_sem)); 1569 + BUG_ON(vma->vm_flags & VM_PFNMAP); 1570 + vma->vm_flags |= VM_MIXEDMAP; 1571 + } 1572 + /* Defer page refcount checking till we're about to map that page. */ 1573 + return insert_pages(vma, addr, pages, num, vma->vm_page_prot); 1574 + #else 1575 + unsigned long idx = 0, pgcount = *num; 1576 + int err; 1577 + 1578 + for (; idx < pgcount; ++idx) { 1579 + err = vm_insert_page(vma, addr + (PAGE_SIZE * idx), pages[idx]); 1580 + if (err) 1581 + break; 1582 + } 1583 + *num = pgcount - idx; 1584 + return err; 1585 + #endif /* ifdef pte_index */ 1586 + } 1587 + EXPORT_SYMBOL(vm_insert_pages); 1514 1588 1515 1589 /** 1516 1590 * vm_insert_page - insert single page into user vma
+7 -4
mm/memory_hotplug.c
··· 304 304 * add the new pages. 305 305 */ 306 306 int __ref __add_pages(int nid, unsigned long pfn, unsigned long nr_pages, 307 - struct mhp_restrictions *restrictions) 307 + struct mhp_params *params) 308 308 { 309 309 const unsigned long end_pfn = pfn + nr_pages; 310 310 unsigned long cur_nr_pages; 311 311 int err; 312 - struct vmem_altmap *altmap = restrictions->altmap; 312 + struct vmem_altmap *altmap = params->altmap; 313 + 314 + if (WARN_ON_ONCE(!params->pgprot.pgprot)) 315 + return -EINVAL; 313 316 314 317 err = check_hotplug_memory_addressable(pfn, nr_pages); 315 318 if (err) ··· 1005 1002 */ 1006 1003 int __ref add_memory_resource(int nid, struct resource *res) 1007 1004 { 1008 - struct mhp_restrictions restrictions = {}; 1005 + struct mhp_params params = { .pgprot = PAGE_KERNEL }; 1009 1006 u64 start, size; 1010 1007 bool new_node = false; 1011 1008 int ret; ··· 1033 1030 new_node = ret; 1034 1031 1035 1032 /* call arch's memory hotadd */ 1036 - ret = arch_add_memory(nid, start, size, &restrictions); 1033 + ret = arch_add_memory(nid, start, size, &params); 1037 1034 if (ret < 0) 1038 1035 goto error; 1039 1036
+10 -7
mm/memremap.c
··· 184 184 { 185 185 struct resource *res = &pgmap->res; 186 186 struct dev_pagemap *conflict_pgmap; 187 - struct mhp_restrictions restrictions = { 187 + struct mhp_params params = { 188 188 /* 189 189 * We do not want any optional features only our own memmap 190 190 */ 191 191 .altmap = pgmap_altmap(pgmap), 192 + .pgprot = PAGE_KERNEL, 192 193 }; 193 - pgprot_t pgprot = PAGE_KERNEL; 194 194 int error, is_ram; 195 195 bool need_devmap_managed = true; 196 196 ··· 217 217 } 218 218 break; 219 219 case MEMORY_DEVICE_DEVDAX: 220 + need_devmap_managed = false; 221 + break; 220 222 case MEMORY_DEVICE_PCI_P2PDMA: 223 + params.pgprot = pgprot_noncached(params.pgprot); 221 224 need_devmap_managed = false; 222 225 break; 223 226 default: ··· 285 282 if (nid < 0) 286 283 nid = numa_mem_id(); 287 284 288 - error = track_pfn_remap(NULL, &pgprot, PHYS_PFN(res->start), 0, 289 - resource_size(res)); 285 + error = track_pfn_remap(NULL, &params.pgprot, PHYS_PFN(res->start), 286 + 0, resource_size(res)); 290 287 if (error) 291 288 goto err_pfn_remap; 292 289 ··· 305 302 */ 306 303 if (pgmap->type == MEMORY_DEVICE_PRIVATE) { 307 304 error = add_pages(nid, PHYS_PFN(res->start), 308 - PHYS_PFN(resource_size(res)), &restrictions); 305 + PHYS_PFN(resource_size(res)), &params); 309 306 } else { 310 307 error = kasan_add_zero_shadow(__va(res->start), resource_size(res)); 311 308 if (error) { ··· 314 311 } 315 312 316 313 error = arch_add_memory(nid, res->start, resource_size(res), 317 - &restrictions); 314 + &params); 318 315 } 319 316 320 317 if (!error) { ··· 322 319 323 320 zone = &NODE_DATA(nid)->node_zones[ZONE_DEVICE]; 324 321 move_pfn_range_to_zone(zone, PHYS_PFN(res->start), 325 - PHYS_PFN(resource_size(res)), restrictions.altmap); 322 + PHYS_PFN(resource_size(res)), params.altmap); 326 323 } 327 324 328 325 mem_hotplug_done();
+3 -1
mm/mmap.c
··· 1224 1224 return a->vm_end == b->vm_start && 1225 1225 mpol_equal(vma_policy(a), vma_policy(b)) && 1226 1226 a->vm_file == b->vm_file && 1227 - !((a->vm_flags ^ b->vm_flags) & ~(VM_READ|VM_WRITE|VM_EXEC|VM_SOFTDIRTY)) && 1227 + !((a->vm_flags ^ b->vm_flags) & ~(VM_ACCESS_FLAGS | VM_SOFTDIRTY)) && 1228 1228 b->vm_pgoff == a->vm_pgoff + ((b->vm_start - a->vm_start) >> PAGE_SHIFT); 1229 1229 } 1230 1230 ··· 2123 2123 info.low_limit = mm->mmap_base; 2124 2124 info.high_limit = mmap_end; 2125 2125 info.align_mask = 0; 2126 + info.align_offset = 0; 2126 2127 return vm_unmapped_area(&info); 2127 2128 } 2128 2129 #endif ··· 2165 2164 info.low_limit = max(PAGE_SIZE, mmap_min_addr); 2166 2165 info.high_limit = arch_get_mmap_base(addr, mm->mmap_base); 2167 2166 info.align_mask = 0; 2167 + info.align_offset = 0; 2168 2168 addr = vm_unmapped_area(&info); 2169 2169 2170 2170 /*
+2 -2
mm/mprotect.c
··· 419 419 */ 420 420 if (arch_has_pfn_modify_check() && 421 421 (vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) && 422 - (newflags & (VM_READ|VM_WRITE|VM_EXEC)) == 0) { 422 + (newflags & VM_ACCESS_FLAGS) == 0) { 423 423 pgprot_t new_pgprot = vm_get_page_prot(newflags); 424 424 425 425 error = walk_page_range(current->mm, start, end, ··· 598 598 newflags |= (vma->vm_flags & ~mask_off_old_flags); 599 599 600 600 /* newflags >> 4 shift VM_MAY% in place of VM_% */ 601 - if ((newflags & ~(newflags >> 4)) & (VM_READ | VM_WRITE | VM_EXEC)) { 601 + if ((newflags & ~(newflags >> 4)) & VM_ACCESS_FLAGS) { 602 602 error = -EACCES; 603 603 goto out; 604 604 }
+3 -2
mm/page_alloc.c
··· 103 103 struct zone *zone; 104 104 struct work_struct work; 105 105 }; 106 - DEFINE_MUTEX(pcpu_drain_mutex); 107 - DEFINE_PER_CPU(struct pcpu_drain, pcpu_drain); 106 + static DEFINE_MUTEX(pcpu_drain_mutex); 107 + static DEFINE_PER_CPU(struct pcpu_drain, pcpu_drain); 108 108 109 109 #ifdef CONFIG_GCC_PLUGIN_LATENT_ENTROPY 110 110 volatile unsigned long latent_entropy __latent_entropy; ··· 3224 3224 * __putback_isolated_page - Return a now-isolated page back where we got it 3225 3225 * @page: Page that was isolated 3226 3226 * @order: Order of the isolated page 3227 + * @mt: The page's pageblock's migratetype 3227 3228 * 3228 3229 * This function is meant to return a page pulled from the free lists via 3229 3230 * __isolate_free_page back to the free lists they were pulled from.
+1 -1
mm/slab_common.c
··· 731 731 /* 732 732 * We need to grab blocking locks. Bounce to ->work. The 733 733 * work item shares the space with the RCU head and can't be 734 - * initialized eariler. 734 + * initialized earlier. 735 735 */ 736 736 INIT_WORK(&s->memcg_params.work, kmemcg_workfn); 737 737 queue_work(memcg_kmem_cache_wq, &s->memcg_params.work);
+1 -1
tools/laptop/freefall/freefall.c
··· 4 4 * Copyright 2008 Eric Piel 5 5 * Copyright 2009 Pavel Machek <pavel@ucw.cz> 6 6 * Copyright 2012 Sonal Santan 7 - * Copyright 2014 Pali Rohár <pali.rohar@gmail.com> 7 + * Copyright 2014 Pali Rohár <pali@kernel.org> 8 8 */ 9 9 10 10 #include <stdio.h>
+39 -4
tools/testing/selftests/kmod/kmod.sh
··· 61 61 ALL_TESTS="$ALL_TESTS 0007:5:1" 62 62 ALL_TESTS="$ALL_TESTS 0008:150:1" 63 63 ALL_TESTS="$ALL_TESTS 0009:150:1" 64 + ALL_TESTS="$ALL_TESTS 0010:1:1" 65 + ALL_TESTS="$ALL_TESTS 0011:1:1" 64 66 65 67 # Kselftest framework requirement - SKIP code is 4. 66 68 ksft_skip=4 ··· 151 149 152 150 test_finish() 153 151 { 152 + echo "$MODPROBE" > /proc/sys/kernel/modprobe 154 153 echo "Test completed" 155 154 } 156 155 ··· 446 443 config_expect_result ${FUNCNAME[0]} SUCCESS 447 444 } 448 445 446 + kmod_test_0010() 447 + { 448 + kmod_defaults_driver 449 + config_num_threads 1 450 + echo "/KMOD_TEST_NONEXISTENT" > /proc/sys/kernel/modprobe 451 + config_trigger ${FUNCNAME[0]} 452 + config_expect_result ${FUNCNAME[0]} -ENOENT 453 + echo "$MODPROBE" > /proc/sys/kernel/modprobe 454 + } 455 + 456 + kmod_test_0011() 457 + { 458 + kmod_defaults_driver 459 + config_num_threads 1 460 + # This causes the kernel to not even try executing modprobe. The error 461 + # code is still -ENOENT like when modprobe doesn't exist, so we can't 462 + # easily test for the exact difference. But this still is a useful test 463 + # since there was a bug where request_module() returned 0 in this case. 464 + echo > /proc/sys/kernel/modprobe 465 + config_trigger ${FUNCNAME[0]} 466 + config_expect_result ${FUNCNAME[0]} -ENOENT 467 + echo "$MODPROBE" > /proc/sys/kernel/modprobe 468 + } 469 + 449 470 list_tests() 450 471 { 451 472 echo "Test ID list:" ··· 487 460 echo "0007 x $(get_test_count 0007) - multithreaded tests with default setup test request_module() and get_fs_type()" 488 461 echo "0008 x $(get_test_count 0008) - multithreaded - push kmod_concurrent over max_modprobes for request_module()" 489 462 echo "0009 x $(get_test_count 0009) - multithreaded - push kmod_concurrent over max_modprobes for get_fs_type()" 463 + echo "0010 x $(get_test_count 0010) - test nonexistent modprobe path" 464 + echo "0011 x $(get_test_count 0011) - test completely disabling module autoloading" 490 465 } 491 466 492 467 usage() ··· 534 505 fi 535 506 } 536 507 537 - function get_test_count() 508 + function get_test_data() 538 509 { 539 510 test_num $1 540 - TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}') 511 + local field_num=$(echo $1 | sed 's/^0*//') 512 + echo $ALL_TESTS | awk '{print $'$field_num'}' 513 + } 514 + 515 + function get_test_count() 516 + { 517 + TEST_DATA=$(get_test_data $1) 541 518 LAST_TWO=${TEST_DATA#*:*} 542 519 echo ${LAST_TWO%:*} 543 520 } 544 521 545 522 function get_test_enabled() 546 523 { 547 - test_num $1 548 - TEST_DATA=$(echo $ALL_TESTS | awk '{print $'$1'}') 524 + TEST_DATA=$(get_test_data $1) 549 525 echo ${TEST_DATA#*:*:} 550 526 } 551 527 ··· 645 611 allow_user_defaults 646 612 load_req_mod 647 613 614 + MODPROBE=$(</proc/sys/kernel/modprobe) 648 615 trap "test_finish" EXIT 649 616 650 617 parse_args $@