1
0
Fork 0
alistair23-linux/include
Rick Edgecombe 868b104d73 mm/vmalloc: Add flag for freeing of special permsissions
Add a new flag VM_FLUSH_RESET_PERMS, for enabling vfree operations to
immediately clear executable TLB entries before freeing pages, and handle
resetting permissions on the directmap. This flag is useful for any kind
of memory with elevated permissions, or where there can be related
permissions changes on the directmap. Today this is RO+X and RO memory.

Although this enables directly vfreeing non-writeable memory now,
non-writable memory cannot be freed in an interrupt because the allocation
itself is used as a node on deferred free list. So when RO memory needs to
be freed in an interrupt the code doing the vfree needs to have its own
work queue, as was the case before the deferred vfree list was added to
vmalloc.

For architectures with set_direct_map_ implementations this whole operation
can be done with one TLB flush when centralized like this. For others with
directmap permissions, currently only arm64, a backup method using
set_memory functions is used to reset the directmap. When arm64 adds
set_direct_map_ functions, this backup can be removed.

When the TLB is flushed to both remove TLB entries for the vmalloc range
mapping and the direct map permissions, the lazy purge operation could be
done to try to save a TLB flush later. However today vm_unmap_aliases
could flush a TLB range that does not include the directmap. So a helper
is added with extra parameters that can allow both the vmalloc address and
the direct mapping to be flushed during this operation. The behavior of the
normal vm_unmap_aliases function is unchanged.

Suggested-by: Dave Hansen <dave.hansen@intel.com>
Suggested-by: Andy Lutomirski <luto@kernel.org>
Suggested-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: <akpm@linux-foundation.org>
Cc: <ard.biesheuvel@linaro.org>
Cc: <deneen.t.dock@intel.com>
Cc: <kernel-hardening@lists.openwall.com>
Cc: <kristen@linux.intel.com>
Cc: <linux_dti@icloud.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nadav Amit <nadav.amit@gmail.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190426001143.4983-17-namit@vmware.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2019-04-30 12:37:58 +02:00
..
acpi ACPI: use different default debug value than ACPICA 2019-03-25 10:45:59 +01:00
asm-generic mm/tlb: Provide default nmi_uaccess_okay() 2019-04-30 12:37:48 +02:00
clocksource clocksource/arm_arch_timer: Store physical timer IRQ number for KVM on VHE 2019-02-19 21:05:22 +00:00
crypto crypto: export arc4 defines 2019-02-15 13:21:55 +08:00
drm drm/ttm: fix re-init of global structures 2019-04-19 11:11:20 -05:00
dt-bindings dt-bindings: clock: sifive: add FU540-C000 PRCI clock constants 2019-04-09 20:36:40 -07:00
keys KEYS: trusted: fix -Wvarags warning 2019-04-08 15:58:54 -07:00
kvm ARM: some cleanups, direct physical timer assignment, cache sanitization 2019-03-15 15:00:28 -07:00
linux mm/vmalloc: Add flag for freeing of special permsissions 2019-04-30 12:37:58 +02:00
math-emu
media media: include: fix several typos 2019-03-01 09:45:52 -05:00
memory
misc auxdisplay: charlcd: Introduce charlcd_free() helper 2019-03-17 08:48:16 +01:00
net netfilter: ctnetlink: don't use conntrack/expect object addresses as id 2019-04-15 07:31:44 +02:00
pcmcia
ras
rdma RDMA: Handle ucontext allocations by IB/core 2019-02-22 14:11:37 -07:00
scsi scsi: kill command serial number 2019-02-27 09:19:24 -05:00
soc IOMMU Updates for Linux v5.1 2019-03-10 12:29:52 -07:00
sound ASoC: core: conditionally increase module refcount on component open 2019-04-08 14:15:44 +07:00
target scsi: target/iscsi: Rename a function and a function pointer 2019-02-04 21:34:49 -05:00
trace syscalls: Remove start and number from syscall_get_arguments() args 2019-04-05 09:26:43 -04:00
uapi 5.1 Third RC pull request 2019-04-28 10:00:45 -07:00
video media updates for v5.1-rc1 2019-03-09 14:45:54 -08:00
xen x86/xen: dont add memory above max allowed allocation 2019-02-18 06:52:51 +01:00