[PATCH] mm: Remove mm argument from mm_get_unmapped_area()

2024-05-06 Thread Rick Edgecombe
xes: 529ce23a764f ("mm: switch mm->get_unmapped_area() to a flag") Suggested-by: Dan Williams Signed-off-by: Rick Edgecombe Link: https://lore.kernel.org/lkml/6603bed6662a_4a98a29...@dwillia2-mobl3.amr.corp.intel.com.notmuch/ --- Based on linux-next. --- arch/sparc/kernel/sys_sparc_64.c | 9

[PATCH v4 02/14] mm: Switch mm->get_unmapped_area() to a flag

2024-03-25 Thread Rick Edgecombe
y actual size reductions in the compiled layout of mm_struct. But depending on compiler or arch alignment requirements, the change could shrink the size of mm_struct. Signed-off-by: Rick Edgecombe Acked-by: Dave Hansen Acked-by: Liam R. Howlett Reviewed-by: Kirill A. Shutemov Cc: linux-s...@v

[RFC 1/3] list: Support getting most recent element in list_lru

2021-04-05 Thread Rick Edgecombe
aware list_lru's since it is not needed by the intended caller. Signed-off-by: Rick Edgecombe --- include/linux/list_lru.h | 13 + mm/list_lru.c| 28 2 files changed, 41 insertions(+) diff --git a/include/linux/list_lru.h b/include/

[RFC 3/3] x86/module: Use VM_GROUP_PAGES flag

2021-04-05 Thread Rick Edgecombe
Callers of module_alloc() will set permissions on the allocation. Use the VM_GROUP_PAGES to reduce direct map breakage. Signed-off-by: Rick Edgecombe --- arch/x86/kernel/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel

[RFC 0/3] Group pages on the direct map for permissioned vmallocs

2021-04-05 Thread Rick Edgecombe
!CONFIG_BPF_JIT_ALWAYS_ON. The new APIs and invasive changes in the callers can happen after vmalloc huge pages bring more benefits. Although, I can post shootdown reduction changes with previous comments integrated if anyone disagrees. Based on v5.11. Thanks, Rick Rick Edgecombe (3): list: Support

[RFC 2/3] vmalloc: Support grouped page allocations

2021-04-05 Thread Rick Edgecombe
c GFP flag that matches the intended user of this vm_flag (module_alloc()). In the case of the vm and GFP flags mismatching, fail the page allocation. In the case of a huge page size page not being available, fallback to the normal page allocator logic and use non-grouped pages. Signed-off-by:

[PATCH v2] mm/vmalloc: Separate put pages and flush VM flags

2021-01-22 Thread Rick Edgecombe
hings so flags are less likely to be missed in the future. Fixes: b944afc9d64d ("mm: add a VM_MAP_PUT_PAGES flag for vmap") Suggested-by: Matthew Wilcox Signed-off-by: Rick Edgecombe --- [v2] Changed comment format like suggested by Matthew and listed him as Suggested-by. Dropped Revie

[PATCH] mm/vmalloc: Separate put pages and flush VM flags

2021-01-20 Thread Rick Edgecombe
mment and remove whitespace for VM_KASAN such that the flags lower down are less likely to be missed in the future. Fixes: b944afc9d64d ("mm: add a VM_MAP_PUT_PAGES flag for vmap") Signed-off-by: Rick Edgecombe --- include/linux/vmalloc.h | 6 ++ 1 file changed, 2 insertions(+), 4 del

[PATCH] kvm: x86/mmu: Use cpuid to determine max gfn

2020-12-03 Thread Rick Edgecombe
essed via TDP. So zap based on a maximum gfn calculated with MAXPHYADDR retrieved from CPUID. This is already stored in shadow_phys_bits, so use it instead of x86_phys_bits. Fixes: faaf05b00aec ("kvm: x86/mmu: Support zapping SPTEs in the TDP MMU") Signed-off-by: Rick Edgecombe --- a

[PATCH RFC 01/10] vmalloc: Add basic perm alloc implementation

2020-11-20 Thread Rick Edgecombe
;s chosen place for executable code. Signed-off-by: Rick Edgecombe --- arch/Kconfig| 3 + include/linux/vmalloc.h | 82 mm/nommu.c | 66 mm/vmalloc.c| 135 4 files changed,

[PATCH RFC 07/10] x86/unwind: Unwind orc at module writable address

2020-11-20 Thread Rick Edgecombe
Since modules can have a separate writable address during loading, do the orc unwind at the writable address. Signed-off-by: Rick Edgecombe --- arch/x86/kernel/unwind_orc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel

[PATCH RFC 04/10] module: Support separate writable allocation

2020-11-20 Thread Rick Edgecombe
ff-by: Rick Edgecombe --- include/linux/module.h | 22 ++ kernel/module.c| 14 +- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/include/linux/module.h b/include/linux/module.h index 9964f909d879..32dd22b2a38a 100644 --- a/include/linux/module.h

[PATCH RFC 05/10] x86/modules: Use real perm_allocations

2020-11-20 Thread Rick Edgecombe
relocations at the writable address of the perm_allocation to support a future implementation that has the writable address in a different allocation. Signed-off-by: Rick Edgecombe --- arch/x86/kernel/module.c | 84 +--- 1 file changed, 71 insertions(+), 13

[PATCH RFC 08/10] jump_label: Handle module writable address

2020-11-20 Thread Rick Edgecombe
Since modules can have a separate writable address during loading, do the nop application at the writable address. As long as info is on hand about if the operations is happening during a module load, don't do a full text_poke() when writing data to a writable address. Signed-off-by:

[PATCH RFC 06/10] x86/alternatives: Handle perm_allocs for modules

2020-11-20 Thread Rick Edgecombe
Modules being loaded using perm_allocs may have a separate writable address. Handle this case in alternatives for operations called during module loading. Signed-off-by: Rick Edgecombe --- arch/x86/kernel/alternative.c | 25 - 1 file changed, 16 insertions(+), 9

[PATCH RFC 09/10] ftrace: Use module writable address

2020-11-20 Thread Rick Edgecombe
Use the module writable address to accommodate arch's that have a separate writable address for perm_alloc. Signed-off-by: Rick Edgecombe --- kernel/trace/ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c

[PATCH RFC 02/10] bpf: Use perm_alloc() for BPF JIT filters

2020-11-20 Thread Rick Edgecombe
directed to a separate writable staging area. Signed-off-by: Rick Edgecombe --- arch/arm/net/bpf_jit_32.c | 3 +- arch/arm64/net/bpf_jit_comp.c | 5 ++-- arch/mips/net/bpf_jit.c | 2 +- arch/mips/net/ebpf_jit.c | 3 +- arch/powerpc/net/bpf_jit_comp.c | 2 +- arch

[PATCH RFC 10/10] vmalloc: Add perm_alloc x86 implementation

2020-11-20 Thread Rick Edgecombe
other caches. Signed-off-by: Rick Edgecombe --- arch/x86/Kconfig | 1 + arch/x86/include/asm/set_memory.h | 2 + arch/x86/mm/Makefile | 1 + arch/x86/mm/pat/set_memory.c | 13 + arch/x86/mm/vmalloc.c | 438 ++ 5

[PATCH RFC 03/10] module: Use perm_alloc() for modules

2020-11-20 Thread Rick Edgecombe
orted. So this should not have any functional change yet. It is just a change to how the different regions of the module allocations are tracked in module.c such that future patches can actually make the regions separate allocations. Signed-off-by: Rick Edgecombe --- include/linux/module.h

[PATCH RFC 00/10] New permission vmalloc interface

2020-11-20 Thread Rick Edgecombe
ail.gmail.com/ [1] https://lore.kernel.org/lkml/20201009201410.3209180-1-ira.we...@intel.com/ [2] https://lore.kernel.org/lkml/20200924132904.1391-1-r...@kernel.org/ This RFC has been acked by Dave Hansen. Rick Edgecombe (10): vmalloc: Add basic perm alloc implementation bpf: Use perm_alloc() for BPF

[tip: x86/urgent] x86/mm/cpa: Flush direct map alias during cpa

2020-05-01 Thread tip-bot2 for Rick Edgecombe
The following commit has been merged into the x86/urgent branch of tip: Commit-ID: ab5130186d7476dcee0d4e787d19a521ca552ce9 Gitweb: https://git.kernel.org/tip/ab5130186d7476dcee0d4e787d19a521ca552ce9 Author:Rick Edgecombe AuthorDate:Wed, 22 Apr 2020 20:13:55 -07:00

[RFC PATCH 01/13] kvm: Enable MTRR to work with GFNs with perm bits

2019-10-03 Thread Rick Edgecombe
inherrit the MTRR type with this implementation. There shouldn't be any legacy use of KVM XO, but hypothetically it could interfere with the uncacheable MTRR type. Signed-off-by: Rick Edgecombe --- arch/x86/kvm/mtrr.c | 8 1 file changed, 8 insertions(+) diff --git a/arch/x86/kvm/m

[RFC PATCH 00/13] XOM for KVM guest userspace

2019-10-03 Thread Rick Edgecombe
ling the kernel. The hope is that there will not be a large impact, but more testing is needed. Status == Regression testing is still needed including the nested virtualization case and impact of XO in the other memslot address spaces. This is based on 5.3. [1] https://lwn.net/Articles/301888/ Rick Edgeco

[RFC PATCH 05/13] kvm: Add #PF injection for KVM XO

2019-10-03 Thread Rick Edgecombe
cases. Instead of changing that everywhere a conditional is added in paging_tmpl.h to check for the KVM XO bit. This should probably be made to work with the logic in permission_fault instead of having a special case. Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/kvm_host.h | 2 ++ arch/x8

[RFC PATCH 06/13] kvm: Add KVM_CAP_EXECONLY_MEM

2019-10-03 Thread Rick Edgecombe
Add a KVM capability for the KVM_MEM_EXECONLY memslot type. This memslot type is supported if the HW supports execute-only TDP. Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/svm.c | 6 ++ arch/x86/kvm/vmx/vmx.c | 1 + arch/x86

[RFC PATCH 07/13] kvm: Add docs for KVM_CAP_EXECONLY_MEM

2019-10-03 Thread Rick Edgecombe
Add documentation for the KVM_CAP_EXECONLY_MEM capability and KVM_MEM_EXECONLY memslot. Signed-off-by: Rick Edgecombe --- Documentation/virt/kvm/api.txt | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Documentation/virt/kvm/api.txt b/Documentation/virt/kvm

[RFC PATCH 08/13] x86/boot: Rename USE_EARLY_PGTABLE_L5

2019-10-03 Thread Rick Edgecombe
Rename USE_EARLY_PGTABLE_L5 to USE_EARLY_PGTABLE so that it can be used by other early boot detectable page table features. Signed-off-by: Rick Edgecombe --- arch/x86/boot/compressed/misc.h | 2 +- arch/x86/include/asm/pgtable_64_types.h | 4 ++-- arch/x86/kernel/cpu/common.c

[RFC PATCH 10/13] x86/mm: Add NR page bit for KVM XO

2019-10-03 Thread Rick Edgecombe
Add _PAGE_BIT_NR and _PAGE_NR, the values of which are determined dynamically at boot. This page type is only valid after checking for for the KVM XO CPUID bit. Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/pgtable_types.h | 11 +++ arch/x86/mm/init.c | 3

[RFC PATCH 03/13] kvm: Add XO memslot type

2019-10-03 Thread Rick Edgecombe
patch by Yu Zhang. Signed-off-by: Yu Zhang Signed-off-by: Rick Edgecombe --- arch/x86/kvm/mmu.c | 9 - include/uapi/linux/kvm.h | 1 + tools/include/uapi/linux/kvm.h | 1 + virt/kvm/kvm_main.c| 15 ++- 4 files changed, 24 insertions(+), 2

[RFC PATCH 02/13] kvm: Add support for X86_FEATURE_KVM_XO

2019-10-03 Thread Rick Edgecombe
Add X86_FEATURE_KVM_XO which reduces the physical address bits exposed by CPUID and uses the hosts highest physical address bit as an XO/NR permission bit in the guest page tables. Adjust reserved mask so KVM guest page tables walks are aware this bit is not reserved. Signed-off-by: Rick

[RFC PATCH 12/13] mmap: Add XO support for KVM XO

2019-10-03 Thread Rick Edgecombe
at boot time and so can't be known at compile time. Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/pgtable_types.h | 2 ++ arch/x86/kernel/head64.c | 3 +++ mm/mmap.c| 30 +++- 3 files changed, 30 insertions(+), 5 dele

[RFC PATCH 09/13] x86/cpufeature: Add detection of KVM XO

2019-10-03 Thread Rick Edgecombe
(KVM XO), and a pgtable_kvmxo_enabled() helper similar to pgtable_l5_enabled() so that pgtable_kvmxo_enabled() can be used in early code that includes arch/x86/include/asm/sparsemem.h. Lastly, in head64.c detect and this feature and perform necessary adjustments to physical_mask. Signed-off-by: Rick

[RFC PATCH 11/13] x86, ptdump: Add NR bit to page table dump

2019-10-03 Thread Rick Edgecombe
Add printing of the NR permission to the page table dump code. Signed-off-by: Rick Edgecombe --- arch/x86/mm/dump_pagetables.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index ab67822fd2f4..8932aa9e3a9e

[RFC PATCH 13/13] x86/Kconfig: Add Kconfig for KVM based XO

2019-10-03 Thread Rick Edgecombe
Add CONFIG_KVM_XO for supporting KVM based execute only memory. Signed-off-by: Rick Edgecombe --- arch/x86/Kconfig | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 222855cc0158..3a3af2a456e8 100644 --- a/arch/x86/Kconfig +++ b/arch/x86

[RFC PATCH 04/13] kvm, vmx: Add support for gva exit qualification

2019-10-03 Thread Rick Edgecombe
VMX supports providing the guest virtual address that caused and EPT violation. Add support for this so it can be used by the KVM XO feature. Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/kvm_host.h | 4 arch/x86/include/asm/vmx.h | 1 + arch/x86/kvm/vmx/vmx.c | 5

[tip:x86/urgent] mm/vmalloc: Avoid rare case of flushing TLB with weird arguments

2019-06-03 Thread tip-bot for Rick Edgecombe
Commit-ID: 31e67340cc65edfd9dac5ef26f81de8414ce5906 Gitweb: https://git.kernel.org/tip/31e67340cc65edfd9dac5ef26f81de8414ce5906 Author: Rick Edgecombe AuthorDate: Mon, 27 May 2019 14:10:58 -0700 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:47:25 +0200 mm/vmalloc: Avoid rare

[tip:x86/urgent] mm/vmalloc: Fix calculation of direct map addr range

2019-06-03 Thread tip-bot for Rick Edgecombe
Commit-ID: 8e41f8726dcf423621e2b6938d015b9796f6f676 Gitweb: https://git.kernel.org/tip/8e41f8726dcf423621e2b6938d015b9796f6f676 Author: Rick Edgecombe AuthorDate: Mon, 27 May 2019 14:10:57 -0700 Committer: Ingo Molnar CommitDate: Mon, 3 Jun 2019 11:47:25 +0200 mm/vmalloc: Fix

[PATCH] vmalloc: Don't use flush flag when no exec perm

2019-05-28 Thread Rick Edgecombe
Nadav Amit Cc: Ard Biesheuvel Signed-off-by: Rick Edgecombe --- Hi, This is what I came up with for working around the sparc issue. The other solution I had looked at was making a CONFIG_ARCH_NEEDS_VM_FLUSH and just opt out only sparc. Very open to suggestions. arch/x86/kernel/ftrace.c |

[PATCH v5 0/2] Fix issues with vmalloc flush flag

2019-05-27 Thread Rick Edgecombe
fixed in dropped patch v2->v3: - Split into two patches (Andy) v1->v2: - Update commit message with more detail - Fix flush end range on !CONFIG_ARCH_HAS_SET_DIRECT_MAP case Rick Edgecombe (2): vmalloc: Fix calculation of direct map addr range vmalloc: Avoid rare case of flush

[PATCH v5 1/2] vmalloc: Fix calculation of direct map addr range

2019-05-27 Thread Rick Edgecombe
. Fixes: 868b104d7379 ("mm/vmalloc: Add flag for freeing of special permsissions") Cc: Meelis Roos Cc: Peter Zijlstra Cc: "David S. Miller" Cc: Dave Hansen Cc: Borislav Petkov Cc: Andy Lutomirski Cc: Ingo Molnar Cc: Nadav Amit Signed-off-by: Rick Edgecombe --- mm/vmalloc.c | 11 ++

[PATCH v5 2/2] vmalloc: Avoid rare case of flushing tlb with weird arguments

2019-05-27 Thread Rick Edgecombe
a Cc: "David S. Miller" Cc: Dave Hansen Cc: Borislav Petkov Cc: Andy Lutomirski Cc: Ingo Molnar Cc: Nadav Amit Signed-off-by: Rick Edgecombe --- mm/vmalloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 3ede9c064477..7f1

[PATCH v4 0/2] Fix issues with vmalloc flush flag

2019-05-21 Thread Rick Edgecombe
Update commit message with more detail - Fix flush end range on !CONFIG_ARCH_HAS_SET_DIRECT_MAP case Rick Edgecombe (2): vmalloc: Fix calculation of direct map addr range vmalloc: Avoid rare case of flushing tlb with weird arguements mm/vmalloc.c | 9 ++--- 1 file changed, 6 insertions(+

[PATCH v4 2/2] vmalloc: Avoid rare case of flushing tlb with weird arguements

2019-05-21 Thread Rick Edgecombe
of special permsissions") Cc: Meelis Roos Cc: Peter Zijlstra Cc: "David S. Miller" Cc: Dave Hansen Cc: Borislav Petkov Cc: Andy Lutomirski Cc: Ingo Molnar Cc: Nadav Amit Signed-off-by: Rick Edgecombe --- mm/vmalloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff

[PATCH v4 1/2] vmalloc: Fix calculation of direct map addr range

2019-05-21 Thread Rick Edgecombe
quot;David S. Miller" Cc: Dave Hansen Cc: Borislav Petkov Cc: Andy Lutomirski Cc: Ingo Molnar Cc: Nadav Amit Signed-off-by: Rick Edgecombe --- mm/vmalloc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index c42872ed82ac..836888ae01f6

[PATCH v2 0/2] Fix issues with vmalloc flush flag

2019-05-20 Thread Rick Edgecombe
nd range on !CONFIG_ARCH_HAS_SET_DIRECT_MAP case Rick Edgecombe (2): vmalloc: Fix calculation of direct map addr range vmalloc: Remove work as from vfree path mm/vmalloc.c | 23 +-- 1 file changed, 13 insertions(+), 10 deletions(-) -- 2.20.1

[PATCH v2 2/2] vmalloc: Remove work as from vfree path

2019-05-20 Thread Rick Edgecombe
From: Rick Edgecombe Calling vm_unmap_alias() in vm_remove_mappings() could potentially be a lot of work to do on a free operation. Simply flushing the TLB instead of the whole vm_unmap_alias() operation makes the frees faster and pushes the heavy work to happen on allocation where it would be

[PATCH v2 1/2] vmalloc: Fix calculation of direct map addr range

2019-05-20 Thread Rick Edgecombe
From: Rick Edgecombe The calculation of the direct map address range to flush was wrong. This could cause problems on x86 if a RO direct map alias ever got loaded into the TLB. This shouldn't normally happen, but it could cause the permissions to remain RO on the direct map alias, and the

[PATCH v2] vmalloc: Fix issues with flush flag

2019-05-20 Thread Rick Edgecombe
Cc: Andy Lutomirski Cc: Ingo Molnar Cc: Nadav Amit Signed-off-by: Rick Edgecombe --- Changes since v1: - Update commit message with more detail - Fix flush end range on !CONFIG_ARCH_HAS_SET_DIRECT_MAP case mm/vmalloc.c | 23 +-- 1 file changed, 13 insertions(+), 10 dele

[tip:x86/mm] x86/kprobes: Use vmalloc special flag

2019-04-30 Thread tip-bot for Rick Edgecombe
Commit-ID: 241a1f22380646bc4d1dd18e5bc246877513da68 Gitweb: https://git.kernel.org/tip/241a1f22380646bc4d1dd18e5bc246877513da68 Author: Rick Edgecombe AuthorDate: Thu, 25 Apr 2019 17:11:40 -0700 Committer: Ingo Molnar CommitDate: Tue, 30 Apr 2019 12:38:01 +0200 x86/kprobes: Use

[tip:x86/mm] x86/ftrace: Use vmalloc special flag

2019-04-30 Thread tip-bot for Rick Edgecombe
Commit-ID: 7fdfe1e40b225b1d163f9afed2fa3f04442dbaad Gitweb: https://git.kernel.org/tip/7fdfe1e40b225b1d163f9afed2fa3f04442dbaad Author: Rick Edgecombe AuthorDate: Thu, 25 Apr 2019 17:11:39 -0700 Committer: Ingo Molnar CommitDate: Tue, 30 Apr 2019 12:38:00 +0200 x86/ftrace: Use vmalloc

[tip:x86/mm] bpf: Use vmalloc special flag

2019-04-30 Thread tip-bot for Rick Edgecombe
Commit-ID: d53d2f78ceadba081fc7785570798c3c8d50a718 Gitweb: https://git.kernel.org/tip/d53d2f78ceadba081fc7785570798c3c8d50a718 Author: Rick Edgecombe AuthorDate: Thu, 25 Apr 2019 17:11:38 -0700 Committer: Ingo Molnar CommitDate: Tue, 30 Apr 2019 12:37:59 +0200 bpf: Use vmalloc

[tip:x86/mm] modules: Use vmalloc special flag

2019-04-30 Thread tip-bot for Rick Edgecombe
Commit-ID: 1a7b7d9220819afe79d1ec5d759fe4349bd2453e Gitweb: https://git.kernel.org/tip/1a7b7d9220819afe79d1ec5d759fe4349bd2453e Author: Rick Edgecombe AuthorDate: Thu, 25 Apr 2019 17:11:37 -0700 Committer: Ingo Molnar CommitDate: Tue, 30 Apr 2019 12:37:58 +0200 modules: Use vmalloc

[tip:x86/mm] mm/hibernation: Make hibernation handle unmapped pages

2019-04-30 Thread tip-bot for Rick Edgecombe
Commit-ID: d63326928611600ad65baff54a70f53b02b3cdfe Gitweb: https://git.kernel.org/tip/d63326928611600ad65baff54a70f53b02b3cdfe Author: Rick Edgecombe AuthorDate: Thu, 25 Apr 2019 17:11:35 -0700 Committer: Ingo Molnar CommitDate: Tue, 30 Apr 2019 12:37:57 +0200 mm/hibernation: Make

[tip:x86/mm] mm/vmalloc: Add flag for freeing of special permsissions

2019-04-30 Thread tip-bot for Rick Edgecombe
Commit-ID: 868b104d7379e28013e9d48bdd2db25e0bdcf751 Gitweb: https://git.kernel.org/tip/868b104d7379e28013e9d48bdd2db25e0bdcf751 Author: Rick Edgecombe AuthorDate: Thu, 25 Apr 2019 17:11:36 -0700 Committer: Ingo Molnar CommitDate: Tue, 30 Apr 2019 12:37:58 +0200 mm/vmalloc: Add flag

[tip:x86/mm] x86/mm/cpa: Add set_direct_map_*() functions

2019-04-30 Thread tip-bot for Rick Edgecombe
Commit-ID: d253ca0c3865a8d9a8c01143cf20425e0be4d0ce Gitweb: https://git.kernel.org/tip/d253ca0c3865a8d9a8c01143cf20425e0be4d0ce Author: Rick Edgecombe AuthorDate: Thu, 25 Apr 2019 17:11:34 -0700 Committer: Ingo Molnar CommitDate: Tue, 30 Apr 2019 12:37:56 +0200 x86/mm/cpa: Add

[PATCH v4 00/23] Merge text_poke fixes and executable lockdowns

2019-04-22 Thread Rick Edgecombe
uaccess_okay() bpf: Fail bpf_probe_write_user() while mm is switched Rick Edgecombe (7): x86/mm/cpa: Add set_direct_map_ functions mm: Make hibernate handle unmapped pages vmalloc: Add flag for free of special permsissions modules: Use vmalloc special flag bpf: Use vmalloc special flag x

[PATCH v4 23/23] bpf: Fail bpf_probe_write_user() while mm is switched

2019-04-22 Thread Rick Edgecombe
-by: Jann Horn Suggested-by: Jann Horn Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- kernel/trace/bpf_trace.c | 8 1 file changed, 8 insertions(+) diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c index d64c00afceb5..94b0e37d90ef 100644 --- a/kernel/trace

[PATCH v4 08/23] x86/kgdb: Avoid redundant comparison of patched code

2019-04-22 Thread Rick Edgecombe
From: Nadav Amit text_poke() already ensures that the written value is the correct one and fails if that is not the case. There is no need for an additional comparison. Remove it. Acked-by: Peter Zijlstra (Intel) Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/kernel

[PATCH v4 20/23] x86/kprobes: Use vmalloc special flag

2019-04-22 Thread Rick Edgecombe
Use new flag VM_FLUSH_RESET_PERMS for handling freeing of special permissioned memory in vmalloc and remove places where memory was set NX and RW before freeing which is no longer needed. Cc: Masami Hiramatsu Signed-off-by: Rick Edgecombe --- arch/x86/kernel/kprobes/core.c | 7 +-- 1 file

[PATCH v4 01/23] Fix "x86/alternatives: Lockdep-enforce text_mutex in text_poke*()"

2019-04-22 Thread Rick Edgecombe
e text_mutex in text_poke*()") Suggested-by: Peter Zijlstra Acked-by: Jiri Kosina Acked-by: Peter Zijlstra (Intel) Reviewed-by: Masami Hiramatsu Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/text-patching.h | 1 + arch/x86/kernel/alter

[PATCH v4 11/23] x86/module: Avoid breaking W^X while loading modules

2019-04-22 Thread Rick Edgecombe
^X protection. Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Cc: Jessica Yu Suggested-by: Thomas Gleixner Suggested-by: Andy Lutomirski Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/kernel/alternative.c | 28 +--- arch

[PATCH v4 12/23] x86/jump-label: Remove support for custom poker

2019-04-22 Thread Rick Edgecombe
-by: Peter Zijlstra (Intel) Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/kernel/jump_label.c | 26 ++ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c index e7d8c636b228

[PATCH v4 05/23] fork: Provide a function for copying init_mm

2019-04-22 Thread Rick Edgecombe
Signed-off-by: Rick Edgecombe --- include/linux/sched/task.h | 1 + kernel/fork.c | 24 ++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h index 2e97a2227045..f1227f2c38a4 100644 --- a/include

[PATCH v4 03/23] x86/mm: Introduce temporary mm structs

2019-04-22 Thread Rick Edgecombe
Lutomirski Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/mmu_context.h | 33 ++ 1 file changed, 33 insertions(+) diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h index 19d18fae6ec6..d684b954f3c0

[PATCH v4 15/23] mm: Make hibernate handle unmapped pages

2019-04-22 Thread Rick Edgecombe
: Wrote 171996 kbytes in 0.21 seconds (819.02 MB/s) After: [4.504714] PM: Wrote 178932 kbytes in 0.22 seconds (813.32 MB/s) Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: "Rafael J. Wysocki" Cc: Pavel Machek Cc: Borislav Petkov Acked-by: Pavel Machek Signed-of

[PATCH v4 17/23] modules: Use vmalloc special flag

2019-04-22 Thread Rick Edgecombe
queue. Instead of call_rcu it now uses synchronize_rcu() in the work queue. Lastly, there is now a WARN_ON in module_memfree since it should not be called in an interrupt with special memory as is required for VM_FLUSH_RESET_PERMS. Cc: Jessica Yu Cc: Steven Rostedt Signed-off-by: Rick Edgecombe

[PATCH v4 02/23] x86/jump_label: Use text_poke_early() during early init

2019-04-22 Thread Rick Edgecombe
initialized after some static-keys are enabled/disabled. Cc: Andy Lutomirski Cc: Kees Cook Cc: Dave Hansen Cc: Masami Hiramatsu Acked-by: Peter Zijlstra (Intel) Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/kernel/jump_label.c | 7 ++- 1 file changed, 6 insertions

[PATCH v4 14/23] x86/mm/cpa: Add set_direct_map_ functions

2019-04-22 Thread Rick Edgecombe
i Cc: Peter Zijlstra Signed-off-by: Rick Edgecombe --- arch/Kconfig | 4 arch/x86/Kconfig | 1 + arch/x86/include/asm/set_memory.h | 3 +++ arch/x86/mm/pageattr.c| 14 +++--- include/linux/set_memory.h| 11 +++ 5

[PATCH v4 04/23] x86/mm: Save DRs when loading a temporary mm

2019-04-22 Thread Rick Edgecombe
: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/mmu_context.h | 23 +++ 1 file changed, 23 insertions(+) diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h index d684b954f3c0..81861862038a 100644 --- a/arch/x86/include

[PATCH v4 07/23] x86/alternative: Use temporary mm for text poking

2019-04-22 Thread Rick Edgecombe
) Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/fixmap.h | 2 - arch/x86/kernel/alternative.c | 108 +++--- arch/x86/xen/mmu_pv.c | 2 - 3 files changed, 86 insertions(+), 26 deletions(-) diff --git a/arch/x86/include/asm

[PATCH v4 09/23] x86/ftrace: Set trampoline pages as executable

2019-04-22 Thread Rick Edgecombe
(VMware) Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/kernel/ftrace.c | 8 1 file changed, 8 insertions(+) diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index ef49517f6bb2..53ba1aa3a01f 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel

[PATCH v4 13/23] x86/alternative: Remove the return value of text_poke_*()

2019-04-22 Thread Rick Edgecombe
From: Nadav Amit The return value of text_poke_early() and text_poke_bp() is useless. Remove it. Cc: Andy Lutomirski Cc: Kees Cook Cc: Dave Hansen Cc: Masami Hiramatsu Acked-by: Peter Zijlstra (Intel) Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/text

[PATCH v4 16/23] vmalloc: Add flag for free of special permsissions

2019-04-22 Thread Rick Edgecombe
behavior of the normal vm_unmap_aliases function is unchanged. Cc: Borislav Petkov Suggested-by: Dave Hansen Suggested-by: Andy Lutomirski Suggested-by: Will Deacon Signed-off-by: Rick Edgecombe --- include/linux/vmalloc.h | 15 ++ mm/vmalloc.c| 113

[PATCH v4 19/23] x86/ftrace: Use vmalloc special flag

2019-04-22 Thread Rick Edgecombe
Use new flag VM_FLUSH_RESET_PERMS for handling freeing of special permissioned memory in vmalloc and remove places where memory was set NX and RW before freeing which is no longer needed. Cc: Steven Rostedt Acked-by: Steven Rostedt (VMware) Signed-off-by: Rick Edgecombe --- arch/x86/kernel

[PATCH v4 18/23] bpf: Use vmalloc special flag

2019-04-22 Thread Rick Edgecombe
lexei Starovoitov Signed-off-by: Rick Edgecombe --- include/linux/filter.h | 17 +++-- kernel/bpf/core.c | 1 - 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/include/linux/filter.h b/include/linux/filter.h index 14ec3bdad9a9..7d3abde3f183 100644 --- a/include/

[PATCH v4 06/23] x86/alternative: Initialize temporary mm for patching

2019-04-22 Thread Rick Edgecombe
Zijlstra (Intel) Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Suggested-by: Andy Lutomirski Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/pgtable.h | 3 +++ arch/x86/include/asm/text-patching.h | 2 ++ arch/x86/kernel/alternative.c

[PATCH v4 21/23] x86/alternative: Comment about module removal races

2019-04-22 Thread Rick Edgecombe
From: Nadav Amit Add a comment to clarify that users of text_poke() must ensure that no races with module removal take place. Cc: Masami Hiramatsu Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/kernel/alternative.c | 5 + 1 file changed, 5 insertions(+) diff --git

[PATCH v4 22/23] tlb: provide default nmi_uaccess_okay()

2019-04-22 Thread Rick Edgecombe
(). Add a default implementation of nmi_uaccess_okay() for architectures that do not have such a function. Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/tlbflush.h | 2 ++ include/asm-generic/tlb.h | 9 + 2 files changed, 11 insertions(+) diff

[PATCH v4 10/23] x86/kprobes: Set instruction page as executable

2019-04-22 Thread Rick Edgecombe
: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/kernel/kprobes/core.c | 24 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index a034cb808e7e..1591852d3ac4 100644 --- a/arch/x86/kernel

[PATCH v3 02/20] x86/mm: Introduce temporary mm structs

2019-02-21 Thread Rick Edgecombe
Lutomirski Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/mmu_context.h | 33 ++ 1 file changed, 33 insertions(+) diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h index 19d18fae6ec6..d684b954f3c0

[PATCH v3 06/20] x86/alternative: Use temporary mm for text poking

2019-02-21 Thread Rick Edgecombe
) Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/fixmap.h | 2 - arch/x86/kernel/alternative.c | 108 +++--- arch/x86/xen/mmu_pv.c | 2 - 3 files changed, 86 insertions(+), 26 deletions(-) diff --git a/arch/x86/include/asm

[PATCH v3 07/20] x86/kgdb: Avoid redundant comparison of patched code

2019-02-21 Thread Rick Edgecombe
From: Nadav Amit text_poke() already ensures that the written value is the correct one and fails if that is not the case. There is no need for an additional comparison. Remove it. Acked-by: Peter Zijlstra (Intel) Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/kernel

[PATCH v3 04/20] fork: Provide a function for copying init_mm

2019-02-21 Thread Rick Edgecombe
Signed-off-by: Rick Edgecombe --- include/linux/sched/task.h | 1 + kernel/fork.c | 24 ++-- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h index 44c6f15800ff..c5a00a7b3beb 100644 --- a/include

[PATCH v3 05/20] x86/alternative: Initialize temporary mm for patching

2019-02-21 Thread Rick Edgecombe
Zijlstra (Intel) Reviewed-by: Masami Hiramatsu Tested-by: Masami Hiramatsu Suggested-by: Andy Lutomirski Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/pgtable.h | 3 +++ arch/x86/include/asm/text-patching.h | 2 ++ arch/x86/kernel/alternative.c

[PATCH v3 03/20] x86/mm: Save DRs when loading a temporary mm

2019-02-21 Thread Rick Edgecombe
From: Nadav Amit Prevent user watchpoints from mistakenly firing while the temporary mm is being used. As the addresses that of the temporary mm might overlap those of the user-process, this is necessary to prevent wrong signals or worse things from happening. Cc: Andy Lutomirski Signed-off-by:

[PATCH v3 17/20] bpf: Use vmalloc special flag

2019-02-21 Thread Rick Edgecombe
lexei Starovoitov Signed-off-by: Rick Edgecombe --- include/linux/filter.h | 17 +++-- kernel/bpf/core.c | 1 - 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/include/linux/filter.h b/include/linux/filter.h index b9f93e62db96..f7b6c8a2e591 100644 --- a/include/

[PATCH v3 14/20] mm: Make hibernate handle unmapped pages

2019-02-21 Thread Rick Edgecombe
: Wrote 171996 kbytes in 0.21 seconds (819.02 MB/s) After: [4.504714] PM: Wrote 178932 kbytes in 0.22 seconds (813.32 MB/s) Cc: Dave Hansen Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: "Rafael J. Wysocki" Cc: Pavel Machek Cc: Borislav Petkov Acked-by: Pavel Machek Signed-of

[PATCH v3 09/20] x86/kprobes: Set instruction page as executable

2019-02-21 Thread Rick Edgecombe
-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/kernel/kprobes/core.c | 24 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index 4ba75afba527..98c671e89889 100644 --- a/arch/x86

[PATCH v3 15/20] vmalloc: Add flag for free of special permsissions

2019-02-21 Thread Rick Edgecombe
behavior of the normal vm_unmap_aliases function is unchanged. Cc: Borislav Petkov Suggested-by: Dave Hansen Suggested-by: Andy Lutomirski Suggested-by: Will Deacon Signed-off-by: Rick Edgecombe --- include/linux/vmalloc.h | 13 + mm/vmalloc.c| 113

[PATCH v3 20/20] x86/alternative: Comment about module removal races

2019-02-21 Thread Rick Edgecombe
From: Nadav Amit Add a comment to clarify that users of text_poke() must ensure that no races with module removal take place. Cc: Masami Hiramatsu Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/kernel/alternative.c | 5 + 1 file changed, 5 insertions(+) diff --git

[PATCH v3 11/20] x86/jump-label: Remove support for custom poker

2019-02-21 Thread Rick Edgecombe
-by: Peter Zijlstra (Intel) Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/kernel/jump_label.c | 26 ++ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c index e7d8c636b228

[PATCH v3 10/20] x86/module: Avoid breaking W^X while loading modules

2019-02-21 Thread Rick Edgecombe
break the W^X protection. Cc: Kees Cook Cc: Peter Zijlstra Cc: Dave Hansen Cc: Masami Hiramatsu Cc: Jessica Yu Suggested-by: Thomas Gleixner Suggested-by: Andy Lutomirski Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/kernel/alternative.c | 28

[PATCH v3 13/20] x86/mm/cpa: Add set_direct_map_ functions

2019-02-21 Thread Rick Edgecombe
i Cc: Peter Zijlstra Signed-off-by: Rick Edgecombe --- arch/Kconfig | 4 arch/x86/Kconfig | 1 + arch/x86/include/asm/set_memory.h | 3 +++ arch/x86/mm/pageattr.c| 14 +++--- include/linux/set_memory.h| 10 ++ 5

[PATCH v3 08/20] x86/ftrace: Set trampoline pages as executable

2019-02-21 Thread Rick Edgecombe
(VMware) Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/kernel/ftrace.c | 8 1 file changed, 8 insertions(+) diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 8257a59704ae..13c8249b197f 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel

[PATCH v3 19/20] x86/kprobes: Use vmalloc special flag

2019-02-21 Thread Rick Edgecombe
Use new flag VM_FLUSH_RESET_PERMS for handling freeing of special permissioned memory in vmalloc and remove places where memory was set NX and RW before freeing which is no longer needed. Cc: Masami Hiramatsu Signed-off-by: Rick Edgecombe --- arch/x86/kernel/kprobes/core.c | 7 +-- 1 file

[PATCH v3 12/20] x86/alternative: Remove the return value of text_poke_*()

2019-02-21 Thread Rick Edgecombe
From: Nadav Amit The return value of text_poke_early() and text_poke_bp() is useless. Remove it. Cc: Andy Lutomirski Cc: Kees Cook Cc: Dave Hansen Cc: Masami Hiramatsu Acked-by: Peter Zijlstra (Intel) Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/text

[PATCH v3 18/20] x86/ftrace: Use vmalloc special flag

2019-02-21 Thread Rick Edgecombe
Use new flag VM_FLUSH_RESET_PERMS for handling freeing of special permissioned memory in vmalloc and remove places where memory was set NX and RW before freeing which is no longer needed. Cc: Steven Rostedt Acked-by: Steven Rostedt (VMware) Signed-off-by: Rick Edgecombe --- arch/x86/kernel

[PATCH v3 16/20] modules: Use vmalloc special flag

2019-02-21 Thread Rick Edgecombe
queue. Instead of call_rcu it now uses synchronize_rcu() in the work queue. Lastly, there is now a WARN_ON in module_memfree since it should not be called in an interrupt with special memory as is required for VM_FLUSH_RESET_PERMS. Cc: Jessica Yu Cc: Steven Rostedt Signed-off-by: Rick Edgecombe

[PATCH v3 01/20] x86/jump_label: Use text_poke_early() during early init

2019-02-21 Thread Rick Edgecombe
initialized after some static-keys are enabled/disabled. Cc: Andy Lutomirski Cc: Kees Cook Cc: Dave Hansen Cc: Masami Hiramatsu Acked-by: Peter Zijlstra (Intel) Signed-off-by: Nadav Amit Signed-off-by: Rick Edgecombe --- arch/x86/kernel/jump_label.c | 7 ++- 1 file changed, 6 insertions

[PATCH v3 00/20] Merge text_poke fixes and executable lockdowns

2019-02-21 Thread Rick Edgecombe
r custom poker x86/alternative: Remove the return value of text_poke_*() x86/alternative: Comment about module removal races Rick Edgecombe (7): x86/mm/cpa: Add set_direct_map_ functions mm: Make hibernate handle unmapped pages vmalloc: Add flag for free of special permsissions modules: Us

  1   2   3   >