[PATCH 0/1] Fix for VM_FLUSH_RESET_PERMS on sparc

2019-05-17 Thread Rick Edgecombe
like sparc that already have normal kernel memory as executable. This patch fixes the usage of this flag on sparc to also fix it in case the root cause is also an issue on other architectures. Separately we can disable usage of VM_FLUSH_RESET_PERMS for these architectures if desired. Rick

[PATCH 1/1] vmalloc: Fix issues with flush flag

2019-05-17 Thread Rick Edgecombe
rmsissions") Reported-by: Meelis Roos 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 | 23 +-- 1 file chan

[RFC PATCH 0/4] Initial support for allocating BPF JITs in vmalloc for x86

2019-02-05 Thread Rick Edgecombe
g some text in vmalloc so that calls can be in relative jump range. For example, a BPF library program could maybe be re-mapped multiple times so that a copy is always near the caller and so we could use the faster calls. Rick Edgecombe (4): bpf, x64: Implement BPF call retpoline bpf,

[RFC PATCH 4/4] bpf, x64: Enable unprivlidged jit in vmalloc

2019-02-05 Thread Rick Edgecombe
insertion would fail, or BPF would fallback to the interpreter. In the case of using vmalloc, it is not charged against bpf_jit_limit. Cc: Daniel Borkmann Cc: Alexei Starovoitov Signed-off-by: Rick Edgecombe --- arch/x86/net/bpf_jit_comp.c | 32 1 file changed, 32

[RFC PATCH 2/4] bpf, x64: Increase distance for bpf calls

2019-02-05 Thread Rick Edgecombe
, however the allocation may be larger at the end when using retpoline due the thunk emitted at the end. Cc: Daniel Borkmann Cc: Alexei Starovoitov Signed-off-by: Rick Edgecombe --- arch/x86/net/bpf_jit_comp.c | 117 +--- 1 file changed, 94 insertions(+), 23

[RFC PATCH 3/4] bpf: Charge bpf jit limit in bpf_jit_alloc_exec

2019-02-05 Thread Rick Edgecombe
: Rick Edgecombe --- include/linux/filter.h | 3 +++ kernel/bpf/core.c | 20 +++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/include/linux/filter.h b/include/linux/filter.h index ad106d845b22..33c0ae5990e1 100644 --- a/include/linux/filter.h +++ b/include

[RFC PATCH 1/4] bpf, x64: Implement BPF call retpoline

2019-02-05 Thread Rick Edgecombe
Add x86 call retpoline sequence from the "Intel Retpoline: A Branch Target Injection Mitigation White Paper" for BPF JIT compiler. Unlike the paper it uses RBX instead of RAX since RAX is part of the BPF calling convetions. Cc: Daniel Borkmann Cc: Alexei Starovoitov Signed-of

[PATCH v2 4/4] x86/vmalloc: Add TLB efficient x86 arch_vunmap

2018-12-11 Thread Rick Edgecombe
better communicate their different (non-flushing) behavior from the rest of the set_pages_* functions. The method for doing this with only 1 TLB flush was suggested by Andy Lutomirski. Suggested-by: Andy Lutomirski Signed-off-by: Rick Edgecombe --- arch/x86/include/asm/set_memory.h | 2 + arch

[PATCH v2 0/4] Don’t leave executable TLB entries to freed pages

2018-12-11 Thread Rick Edgecombe
27;s next version of his patchset Changes since v1: - New efficient algorithm on x86 for tearing down executable RO memory and flag for this (Andy Lutomirski) - Have no W^X violating window on tear down (Nadav Amit) Rick Edgecombe (4): vmalloc: New flags for safe vfree on special perm

[PATCH v2 3/4] bpf: switch to new vmalloc vfree flags

2018-12-11 Thread Rick Edgecombe
This switches to use the new vmalloc flags to control freeing memory with special permissions. Signed-off-by: Rick Edgecombe --- include/linux/filter.h | 26 -- kernel/bpf/core.c | 1 - 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/include/linux

[PATCH v2 2/4] modules: Add new special vfree flags

2018-12-11 Thread Rick Edgecombe
Add new flags for handling freeing of special permissioned memory in vmalloc, and remove places where the handling was done in module.c. This will enable this flag for all architectures. Signed-off-by: Rick Edgecombe --- kernel/module.c | 43 --- 1 file

[PATCH v2 1/4] vmalloc: New flags for safe vfree on special perms

2018-12-11 Thread Rick Edgecombe
Suggested-by: Andy Lutomirski Suggested-by: Will Deacon Signed-off-by: Rick Edgecombe --- include/linux/vmalloc.h | 2 ++ mm/vmalloc.c| 73 + 2 files changed, 69 insertions(+), 6 deletions(-) diff --git a/include/linux/vmalloc.h b/include/linux

[PATCH 0/2] Don’t leave executable TLB entries to freed pages

2018-11-27 Thread Rick Edgecombe
freeing the pages. If this solution seems good I can plug the flag in for other architectures that define PAGE_KERNEL_EXEC. Rick Edgecombe (2): vmalloc: New flag for flush before releasing pages x86/modules: Make x86 allocs to flush when free arch/x86/kernel/module.c | 4 ++-- include/linux

[PATCH 1/2] vmalloc: New flag for flush before releasing pages

2018-11-27 Thread Rick Edgecombe
. Suggested-by: Dave Hansen Suggested-by: Andy Lutomirski Suggested-by: Will Deacon Signed-off-by: Rick Edgecombe --- include/linux/vmalloc.h | 1 + mm/vmalloc.c| 13 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/linux/vmalloc.h b/include

[PATCH 2/2] x86/modules: Make x86 allocs to flush when free

2018-11-27 Thread Rick Edgecombe
Change the module allocations to flush before freeing the pages. Signed-off-by: Rick Edgecombe --- arch/x86/kernel/module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c index b052e883dd8c..1694daf256b3 100644 --- a