Re: [PATCHv6 bpf-next 1/9] x86/shstk: Make return uprobe work with shadow stack

2024-05-30 Thread Edgecombe, Rick P
On Tue, 2024-05-21 at 12:48 +0200, Jiri Olsa wrote: > Currently the application with enabled shadow stack will crash > if it sets up return uprobe. The reason is the uretprobe kernel > code changes the user space task's stack, but does not update > shadow stack accordingly. > > Adding new

Re: [PATCHv5 bpf-next 6/8] x86/shstk: Add return uprobe support

2024-05-20 Thread Edgecombe, Rick P
On Mon, 2024-05-20 at 00:18 +0200, Jiri Olsa wrote: > anyway I think we can fix that in another way by using the optimized > trampoline, > but returning to the user space through iret when shadow stack is detected > (as I did in the first version, before you adjusted it to the sysret path). > >

Re: [PATCHv5 bpf-next 6/8] x86/shstk: Add return uprobe support

2024-05-15 Thread Edgecombe, Rick P
On Wed, 2024-05-15 at 17:26 +0200, Oleg Nesterov wrote: > > I think it will crash, there's explanation in the comment in > > tools/testing/selftests/x86/test_shadow_stack.c test > > OK, thanks... > > But test_shadow_stack.c doesn't do ARCH_PRCTL(ARCH_SHSTK_DISABLE) if > all the tests succeed ?

Re: [PATCHv5 bpf-next 6/8] x86/shstk: Add return uprobe support

2024-05-15 Thread Edgecombe, Rick P
On Wed, 2024-05-15 at 08:36 -0600, Jiri Olsa wrote: > > > > Let me ask a couple of really stupid questions. What if the shadow stack > > is "shorter" than the normal stack? I mean, The shadow stack could overflow if it is not big enough. However since the normal stack has return addresses and

Re: [PATCHv5 bpf-next 6/8] x86/shstk: Add return uprobe support

2024-05-15 Thread Edgecombe, Rick P
On Wed, 2024-05-15 at 13:35 +0200, Oleg Nesterov wrote: > Let me repeat I know nothing about shadow stacks, only tried to > read Documentation/arch/x86/shstk.rst few minutes ago ;) > > On 05/13, Jiri Olsa wrote: > > > > 1) current uretprobe which are not working at the moment and we change > >   

Re: [PATCHv5 bpf-next 6/8] x86/shstk: Add return uprobe support

2024-05-14 Thread Edgecombe, Rick P
On Mon, 2024-05-13 at 15:23 -0600, Jiri Olsa wrote: > so at the moment the patch 6 changes shadow stack for > > 1) current uretprobe which are not working at the moment and we change >    the top value of shadow stack with shstk_push_frame > 2) optimized uretprobe which needs to push new frame on

Re: [PATCHv5 bpf-next 6/8] x86/shstk: Add return uprobe support

2024-05-13 Thread Edgecombe, Rick P
On Mon, 2024-05-13 at 18:50 +0900, Masami Hiramatsu wrote: > > I guess it's doable, we'd need to keep both trampolines around, because > > shadow stack is enabled by app dynamically and use one based on the > > state of shadow stack when uretprobe is installed > > > > so you're worried the

Re: [PATCHv5 bpf-next 6/8] x86/shstk: Add return uprobe support

2024-05-09 Thread Edgecombe, Rick P
On Thu, 2024-05-09 at 10:30 +0200, Jiri Olsa wrote: > > Per the earlier discussion, this cannot be reached unless uretprobes are in > > use, > > which cannot happen without something with privileges taking an action. But > > are > > uretprobes ever used for monitoring applications where security

Re: [PATCHv5 bpf-next 6/8] x86/shstk: Add return uprobe support

2024-05-07 Thread Edgecombe, Rick P
On Tue, 2024-05-07 at 12:53 +0200, Jiri Olsa wrote: > diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c > index 81e6ee95784d..ae6c3458a675 100644 > --- a/arch/x86/kernel/uprobes.c > +++ b/arch/x86/kernel/uprobes.c > @@ -406,6 +406,11 @@ SYSCALL_DEFINE0(uretprobe) > *

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

2024-05-07 Thread Edgecombe, Rick P
On Mon, 2024-05-06 at 09:18 -0700, Christoph Hellwig wrote: > > On Mon, May 06, 2024 at 09:07:47AM -0700, Rick Edgecombe wrote: > > > > if (flags & MAP_FIXED) { > > > > /* Ok, don't mess with it. */ > > > > -   return mm_get_unmapped_area(current->mm, NULL, > >

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

2024-05-07 Thread Edgecombe, Rick P
On Mon, 2024-05-06 at 12:32 -0400, Liam R. Howlett wrote: > > I like this patch. Thanks for taking a look. > > I think the context of current->mm is implied. IOW, could we call it > get_unmapped_area() instead?  There are other functions today that use > current->mm that don't start with

Re: [PATCHv4 bpf-next 2/7] uprobe: Add uretprobe syscall to speed up return probe

2024-05-03 Thread Edgecombe, Rick P
On Fri, 2024-05-03 at 22:17 +0200, Jiri Olsa wrote: > when uretprobe is created, kernel overwrites the return address on user > stack to point to user space trampoline, so the setup is in kernel hands I mean for uprobes in general. I'm didn't have any specific ideas in mind, but in general when

Re: [PATCHv4 bpf-next 2/7] uprobe: Add uretprobe syscall to speed up return probe

2024-05-03 Thread Edgecombe, Rick P
+Some more shadow stack folks from other archs. We are discussing how uretprobes work with shadow stack. Context: https://lore.kernel.org/lkml/ZjU4ganRF1Cbiug6@krava/ On Fri, 2024-05-03 at 21:18 +0200, Jiri Olsa wrote: > > hack below seems to fix it for the current uprobe setup, > we need

Re: [PATCHv4 bpf-next 2/7] uprobe: Add uretprobe syscall to speed up return probe

2024-05-03 Thread Edgecombe, Rick P
On Fri, 2024-05-03 at 15:04 +0200, Jiri Olsa wrote: > On Fri, May 03, 2024 at 01:34:53PM +0200, Peter Zijlstra wrote: > > On Thu, May 02, 2024 at 02:23:08PM +0200, Jiri Olsa wrote: > > > Adding uretprobe syscall instead of trap to speed up return probe. > > > > > > At the moment the uretprobe

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

2024-03-27 Thread Edgecombe, Rick P
On Wed, 2024-03-27 at 15:15 +0200, Jarkko Sakkinen wrote: > I mean I believe the change itself makes sense, it is just not > fully documented in the commit message. Ah, I see. Yes, there could be more background on arch_pick_mmap_layout().

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

2024-03-27 Thread Edgecombe, Rick P
On Tue, 2024-03-26 at 23:38 -0700, Dan Williams wrote: > > +unsigned long > > +mm_get_unmapped_area(struct mm_struct *mm, struct file *file, > > +    unsigned long addr, unsigned long len, > > +    unsigned long pgoff, unsigned long flags) > > +{ > > Seems like a

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

2024-03-26 Thread Edgecombe, Rick P
On Tue, 2024-03-26 at 13:57 +0200, Jarkko Sakkinen wrote: > In which conditions which path is used during the initialization of mm > and why is this the case? It is an open claim in the current form. There is an arch_pick_mmap_layout() that arch's can have their own rules for. There is also a

Re: [PATCH v3 03/13] mm/execmem, arch: convert simple overrides of module_alloc to execmem

2023-10-05 Thread Edgecombe, Rick P
On Mon, 2023-09-18 at 10:29 +0300, Mike Rapoport wrote: > +/** > + * struct execmem_range - definition of a memory range suitable for > code and > + *   related data allocations > + * @start: address space start > + * @end:   address space end (inclusive) > + * @pgprot: 

Re: [PATCH v3 03/13] mm/execmem, arch: convert simple overrides of module_alloc to execmem

2023-10-05 Thread Edgecombe, Rick P
On Thu, 2023-10-05 at 08:26 +0300, Mike Rapoport wrote: > On Wed, Oct 04, 2023 at 03:39:26PM +0000, Edgecombe, Rick P wrote: > > On Tue, 2023-10-03 at 17:29 -0700, Rick Edgecombe wrote: > > > It seems a bit weird to copy all of this. Is it trying to be > > > fast

Re: [PATCH v3 03/13] mm/execmem, arch: convert simple overrides of module_alloc to execmem

2023-10-04 Thread Edgecombe, Rick P
On Tue, 2023-10-03 at 17:29 -0700, Rick Edgecombe wrote: > It seems a bit weird to copy all of this. Is it trying to be faster > or > something? > > Couldn't it just check r->start in execmem_text/data_alloc() path and > switch to EXECMEM_DEFAULT if needed then? The execmem_range_is_data() > part

Re: [PATCH v3 03/13] mm/execmem, arch: convert simple overrides of module_alloc to execmem

2023-10-03 Thread Edgecombe, Rick P
On Mon, 2023-09-18 at 10:29 +0300, Mike Rapoport wrote: > + > +static void execmem_init_missing(struct execmem_params *p) > +{ > +   struct execmem_range *default_range = > >ranges[EXECMEM_DEFAULT]; > + > +   for (int i = EXECMEM_DEFAULT + 1; i < EXECMEM_TYPE_MAX; i++) > { > + 

Re: [PATCH v3 04/13] mm/execmem, arch: convert remaining overrides of module_alloc to execmem

2023-10-03 Thread Edgecombe, Rick P
On Mon, 2023-09-18 at 10:29 +0300, Mike Rapoport wrote: > diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c > index 5f71a0cf4399..9d37375e2f05 100644 > --- a/arch/x86/kernel/module.c > +++ b/arch/x86/kernel/module.c > @@ -19,6 +19,7 @@ >  #include >  #include >  #include >

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

2021-04-05 Thread Edgecombe, Rick P
On Mon, 2021-04-05 at 22:32 +0100, Matthew Wilcox wrote: > On Mon, Apr 05, 2021 at 02:01:58PM -0700, Dave Hansen wrote: > > On 4/5/21 1:37 PM, Rick Edgecombe wrote: > > > +static void __dispose_pages(struct list_head *head) > > > +{ > > > +   struct list_head *cur, *next; > > > + > > > +   

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

2021-04-05 Thread Edgecombe, Rick P
On Mon, 2021-04-05 at 14:01 -0700, Dave Hansen wrote: > On 4/5/21 1:37 PM, Rick Edgecombe wrote: > > +static void __dispose_pages(struct list_head *head) > > +{ > > +   struct list_head *cur, *next; > > + > > +   list_for_each_safe(cur, next, head) { > > +   list_del(cur); > >

Re: [PATCH 07/12] KVM: x86: SEV: Treat C-bit as legal GPA bit regardless of vCPU mode

2021-02-04 Thread Edgecombe, Rick P
On Thu, 2021-02-04 at 11:34 +0100, Paolo Bonzini wrote: > On 04/02/21 03:19, Sean Christopherson wrote: > > Ah, took me a few minutes, but I see what you're saying.  LAM will > > introduce > > bits that are repurposed for CR3, but not generic GPAs.  And, the > > behavior is > > based on CPU

Re: [PATCH 07/12] KVM: x86: SEV: Treat C-bit as legal GPA bit regardless of vCPU mode

2021-02-03 Thread Edgecombe, Rick P
On Wed, 2021-02-03 at 16:01 -0800, Sean Christopherson wrote: >   > -   unsigned long cr3_lm_rsvd_bits; > +   u64 reserved_gpa_bits; LAM defines bits above the GFN in CR3:

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

2021-01-21 Thread Edgecombe, Rick P
On Thu, 2021-01-21 at 13:19 +, Matthew Wilcox wrote: > On Wed, Jan 20, 2021 at 05:41:18PM -0800, Rick Edgecombe wrote: > > When VM_MAP_PUT_PAGES was added, it was defined with the same value > > as > > VM_FLUSH_RESET_PERMS. This doesn't seem like it will cause any big > > functional problems

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

2020-12-07 Thread Edgecombe, Rick P
On Fri, 2020-12-04 at 15:24 -0800, Sean Christopherson wrote: > On Fri, Nov 20, 2020, Rick Edgecombe wrote: > > +struct perm_allocation { > > + struct page **pages; > > + virtual_perm cur_perm; > > + virtual_perm orig_perm; > > + struct vm_struct *area; > > + unsigned long offset; > > +

Re: [PATCH v8 11/12] mm/vmalloc: Hugepage vmalloc mappings

2020-12-04 Thread Edgecombe, Rick P
On Fri, 2020-12-04 at 18:12 +1000, Nicholas Piggin wrote: > Excerpts from Edgecombe, Rick P's message of December 1, 2020 6:21 > am: > > On Sun, 2020-11-29 at 01:25 +1000, Nicholas Piggin wrote: > > > Support huge page vmalloc mappings. Config option > > > HAVE_ARCH_HUGE_VMALLOC > > > enables

Re: [PATCH v8 11/12] mm/vmalloc: Hugepage vmalloc mappings

2020-11-30 Thread Edgecombe, Rick P
On Mon, 2020-11-30 at 12:21 -0800, Rick Edgecombe wrote: > another option could be to use the changes here: > https://lore.kernel.org/lkml/20201125092208.12544-4-r...@kernel.org/ > to reset the direct map for a large page range at a time for large > vmalloc pages. Oops, sorry. This wouldn't be

Re: [PATCH v8 11/12] mm/vmalloc: Hugepage vmalloc mappings

2020-11-30 Thread Edgecombe, Rick P
On Sun, 2020-11-29 at 01:25 +1000, Nicholas Piggin wrote: > Support huge page vmalloc mappings. Config option > HAVE_ARCH_HUGE_VMALLOC > enables support on architectures that define HAVE_ARCH_HUGE_VMAP and > supports PMD sized vmap mappings. > > vmalloc will attempt to allocate PMD-sized pages if

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

2020-11-24 Thread Edgecombe, Rick P
On Tue, 2020-11-24 at 10:16 +, Christoph Hellwig wrote: > On Mon, Nov 23, 2020 at 12:01:35AM +0000, Edgecombe, Rick P wrote: > > Another option could be putting the new metadata in vm_struct and > > just > > return that, like get_vm_area(). Then we don't need to in

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

2020-11-24 Thread Edgecombe, Rick P
On Tue, 2020-11-24 at 10:19 +, h...@infradead.org wrote: > But I thought that using those pgprot flags was still sort > overloading > > the meaning of pgprot. My understanding was that it is supposed to > > hold > > the actual bits set in the PTE. For example large pages or TLB > > hints > >

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

2020-11-23 Thread Edgecombe, Rick P
On Mon, 2020-11-23 at 09:00 +, Christoph Hellwig wrote: > First thanks for doing this, having a vmalloc variant that starts out > with proper permissions has been on my todo list for a while. > > > +#define PERM_R 1 > > +#define PERM_W 2 > > +#define PERM_X 4 > > +#define PERM_RWX

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

2020-11-22 Thread Edgecombe, Rick P
On Sat, 2020-11-21 at 20:10 -0800, Andy Lutomirski wrote: > On Fri, Nov 20, 2020 at 12:30 PM Rick Edgecombe > wrote: > > In order to allow for future arch specific optimizations for > > vmalloc > > permissions, first add an implementation of a new interface that > > will > > work cross arch by

Re: [PATCH 0/4] arch, mm: improve robustness of direct map manipulation

2020-10-29 Thread Edgecombe, Rick P
On Thu, 2020-10-29 at 10:12 +0200, Mike Rapoport wrote: > This series goal was primarily to separate dependincies and make it > clearer what DEBUG_PAGEALLOC and what SET_DIRECT_MAP are. As it > turned > out, there is also some lack of consistency between architectures > that > implement either of

Re: [PATCH 2/4] PM: hibernate: improve robustness of mapping pages in the direct map

2020-10-29 Thread Edgecombe, Rick P
On Thu, 2020-10-29 at 09:54 +0200, Mike Rapoport wrote: > __kernel_map_pages() on arm64 will also bail out if rodata_full is > false: > void __kernel_map_pages(struct page *page, int numpages, int enable) > { > if (!debug_pagealloc_enabled() && !rodata_full) > return; > >

Re: [PATCH 0/4] arch, mm: improve robustness of direct map manipulation

2020-10-28 Thread Edgecombe, Rick P
On Wed, 2020-10-28 at 13:09 +0200, Mike Rapoport wrote: > On Tue, Oct 27, 2020 at 09:46:35AM +0100, David Hildenbrand wrote: > > On 27.10.20 09:38, Mike Rapoport wrote: > > > On Mon, Oct 26, 2020 at 06:05:30PM +0000, Edgecombe, Rick P > > > wrote: > > > &g

Re: [PATCH 2/4] PM: hibernate: improve robustness of mapping pages in the direct map

2020-10-28 Thread Edgecombe, Rick P
On Sun, 2020-10-25 at 12:15 +0200, Mike Rapoport wrote: > + if (IS_ENABLED(CONFIG_ARCH_HAS_SET_DIRECT_MAP)) { > + unsigned long addr = (unsigned > long)page_address(page); > + int ret; > + > + if (enable) > + ret =

Re: [PATCH 0/4] arch, mm: improve robustness of direct map manipulation

2020-10-28 Thread Edgecombe, Rick P
On Wed, 2020-10-28 at 13:30 +0200, Mike Rapoport wrote: > On Wed, Oct 28, 2020 at 11:20:12AM +, Will Deacon wrote: > > On Tue, Oct 27, 2020 at 10:38:16AM +0200, Mike Rapoport wrote: > > > On Mon, Oct 26, 2020 at 06:05:30PM +0000, Edgecombe, Rick P > > > wrote: >

Re: [PATCH 2/4] PM: hibernate: improve robustness of mapping pages in the direct map

2020-10-27 Thread Edgecombe, Rick P
On Tue, 2020-10-27 at 10:49 +0200, Mike Rapoport wrote: > On Mon, Oct 26, 2020 at 06:57:32PM +0000, Edgecombe, Rick P wrote: > > On Mon, 2020-10-26 at 11:15 +0200, Mike Rapoport wrote: > > > On Mon, Oct 26, 2020 at 12:38:32AM +0000, Edgecombe, Rick P > > > wrote: >

Re: [PATCH 2/4] PM: hibernate: improve robustness of mapping pages in the direct map

2020-10-26 Thread Edgecombe, Rick P
On Mon, 2020-10-26 at 11:15 +0200, Mike Rapoport wrote: > The intention of this series is to disallow usage of > __kernel_map_pages() when DEBUG_PAGEALLOC=n. I'll update this patch > to > better handle possible errors, but I still want to keep WARN in the > caller. Sorry, I missed this snippet at

Re: [PATCH v7 3/7] set_memory: allow set_direct_map_*_noflush() for multiple pages

2020-10-26 Thread Edgecombe, Rick P
On Mon, 2020-10-26 at 10:37 +0200, Mike Rapoport wrote: > +++ b/arch/x86/mm/pat/set_memory.c > @@ -2184,14 +2184,14 @@ static int __set_pages_np(struct page *page, > int numpages) > return __change_page_attr_set_clr(, 0); > } > > -int set_direct_map_invalid_noflush(struct page *page) >

Re: [PATCH 2/4] PM: hibernate: improve robustness of mapping pages in the direct map

2020-10-26 Thread Edgecombe, Rick P
On Mon, 2020-10-26 at 11:15 +0200, Mike Rapoport wrote: > On Mon, Oct 26, 2020 at 12:38:32AM +0000, Edgecombe, Rick P wrote: > > On Sun, 2020-10-25 at 12:15 +0200, Mike Rapoport wrote: > > > From: Mike Rapoport > > > > > > When DEBUG_PAGEALLOC or ARCH_

Re: [PATCH 0/4] arch, mm: improve robustness of direct map manipulation

2020-10-26 Thread Edgecombe, Rick P
On Mon, 2020-10-26 at 11:05 +0200, Mike Rapoport wrote: > On Mon, Oct 26, 2020 at 01:13:52AM +0000, Edgecombe, Rick P wrote: > > On Sun, 2020-10-25 at 12:15 +0200, Mike Rapoport wrote: > > > Indeed, for architectures that define > > > CONFIG_ARCH_HAS_SET_DIRECT_MAP

Re: [PATCH 0/4] arch, mm: improve robustness of direct map manipulation

2020-10-25 Thread Edgecombe, Rick P
On Sun, 2020-10-25 at 12:15 +0200, Mike Rapoport wrote: > Indeed, for architectures that define CONFIG_ARCH_HAS_SET_DIRECT_MAP > it is > possible that __kernel_map_pages() would fail, but since this > function is > void, the failure will go unnoticed. Could you elaborate on how this could happen?

Re: [PATCH 4/4] arch, mm: make kernel_page_present() always available

2020-10-25 Thread Edgecombe, Rick P
On Sun, 2020-10-25 at 12:15 +0200, Mike Rapoport wrote: > index 7f248fc45317..16f878c26667 100644 > --- a/arch/x86/mm/pat/set_memory.c > +++ b/arch/x86/mm/pat/set_memory.c > @@ -2228,7 +2228,6 @@ void __kernel_map_pages(struct page *page, int > numpages, int enable) > } > #endif /*

Re: [PATCH 2/4] PM: hibernate: improve robustness of mapping pages in the direct map

2020-10-25 Thread Edgecombe, Rick P
On Sun, 2020-10-25 at 12:15 +0200, Mike Rapoport wrote: > From: Mike Rapoport > > When DEBUG_PAGEALLOC or ARCH_HAS_SET_DIRECT_MAP is enabled a page may > be > not present in the direct map and has to be explicitly mapped before > it > could be copied. > > On arm64 it is possible that a page

Re: [RFCv2 14/16] KVM: Handle protected memory in __kvm_map_gfn()/__kvm_unmap_gfn()

2020-10-22 Thread Edgecombe, Rick P
On Thu, 2020-10-22 at 15:06 +0300, Kirill A. Shutemov wrote: > > I think the page could have got unmapped since the gup via the > > hypercall on another CPU. It could be an avenue for the guest to > > crash > > the host. > > Hm.. I'm not sure I follow. Could you elaborate on what scenario you >

Re: [RFCv2 14/16] KVM: Handle protected memory in __kvm_map_gfn()/__kvm_unmap_gfn()

2020-10-21 Thread Edgecombe, Rick P
On Tue, 2020-10-20 at 09:18 +0300, Kirill A. Shutemov wrote: > We cannot access protected pages directly. Use ioremap() to > create a temporary mapping of the page. The mapping is destroyed > on __kvm_unmap_gfn(). > > The new interface gfn_to_pfn_memslot_protected() is used to detect if > the

Re: [RFCv2 15/16] KVM: Unmap protected pages from direct mapping

2020-10-21 Thread Edgecombe, Rick P
On Tue, 2020-10-20 at 09:18 +0300, Kirill A. Shutemov wrote: > If the protected memory feature enabled, unmap guest memory from > kernel's direct mappings. > > Migration and KSM is disabled for protected memory as it would > require a > special treatment. > So do we care about this scenario

Re: [RFCv2 09/16] KVM: mm: Introduce VM_KVM_PROTECTED

2020-10-21 Thread Edgecombe, Rick P
On Tue, 2020-10-20 at 09:18 +0300, Kirill A. Shutemov wrote: > include/linux/mm.h | 8 > mm/gup.c| 20 > mm/huge_memory.c| 20 > mm/memory.c | 3 +++ > mm/mmap.c | 3 +++ > virt/kvm/async_pf.c | 2 +- >

Re: [RFCv2 15/16] KVM: Unmap protected pages from direct mapping

2020-10-20 Thread Edgecombe, Rick P
On Tue, 2020-10-20 at 15:20 +0200, David Hildenbrand wrote: > On 20.10.20 14:18, David Hildenbrand wrote: > > On 20.10.20 08:18, Kirill A. Shutemov wrote: > > > If the protected memory feature enabled, unmap guest memory from > > > kernel's direct mappings. > > > > Gah, ugly. I guess this also

Re: [PATCH v2 07/20] kvm: x86/mmu: Support zapping SPTEs in the TDP MMU

2020-10-19 Thread Edgecombe, Rick P
On Wed, 2020-10-14 at 11:26 -0700, Ben Gardon wrote: > @@ -5827,6 +5831,7 @@ void kvm_zap_gfn_range(struct kvm *kvm, gfn_t > gfn_start, gfn_t gfn_end) > struct kvm_memslots *slots; > struct kvm_memory_slot *memslot; > int i; > + bool flush; > >

Re: [PATCH v6 3/6] mm: introduce memfd_secret system call to create "secret" memory areas

2020-09-30 Thread Edgecombe, Rick P
On Wed, 2020-09-30 at 13:35 +0300, Mike Rapoport wrote: > On Tue, Sep 29, 2020 at 08:06:03PM +0000, Edgecombe, Rick P wrote: > > On Tue, 2020-09-29 at 16:06 +0300, Mike Rapoport wrote: > > > On Tue, Sep 29, 2020 at 04:58:44AM +0000, Edgecombe, Rick P > > > wrote: >

Re: [PATCH v6 3/6] mm: introduce memfd_secret system call to create "secret" memory areas

2020-09-29 Thread Edgecombe, Rick P
On Tue, 2020-09-29 at 16:06 +0300, Mike Rapoport wrote: > On Tue, Sep 29, 2020 at 04:58:44AM +0000, Edgecombe, Rick P wrote: > > On Thu, 2020-09-24 at 16:29 +0300, Mike Rapoport wrote: > > > Introduce "memfd_secret" system call with the ability to create > >

Re: [PATCH v6 3/6] mm: introduce memfd_secret system call to create "secret" memory areas

2020-09-28 Thread Edgecombe, Rick P
On Thu, 2020-09-24 at 16:29 +0300, Mike Rapoport wrote: > Introduce "memfd_secret" system call with the ability to create > memory > areas visible only in the context of the owning process and not > mapped not > only to other processes but in the kernel page tables as well. > > The user will

Re: "mm/vmalloc: Add flag for freeing of special permsissions" broke udev on ia64

2020-08-11 Thread Edgecombe, Rick P
On Tue, 2020-08-11 at 23:54 +0200, John Paul Adrian Glaubitz wrote: > Hi Rick! > > I have been bisecting some regressions on ia64 and one problem I ran > into is that > udev is causing the kernel to crash after the following change from > 2019: > > commit 868b104d7379e28013e9d48bdd2db25e0bdcf751

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

2019-10-14 Thread Edgecombe, Rick P
On Mon, 2019-10-14 at 14:47 +0800, Yu Zhang wrote: > On Thu, Oct 03, 2019 at 02:23:48PM -0700, Rick Edgecombe wrote: > > Mask gfn by maxphyaddr in kvm_mtrr_get_guest_memory_type so that the > > guests view of gfn is used when high bits of the physical memory are > > used as extra permissions bits.

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

2019-10-07 Thread Edgecombe, Rick P
On Fri, 2019-10-04 at 18:33 -0700, Andy Lutomirski wrote: > On Fri, Oct 4, 2019 at 1:10 PM Edgecombe, Rick P > wrote: > > > > On Fri, 2019-10-04 at 07:56 -0700, Andy Lutomirski wrote: > > > On Thu, Oct 3, 2019 at 2:38 PM Rick Edgecombe > > > wrote: &g

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

2019-10-04 Thread Edgecombe, Rick P
On Fri, 2019-10-04 at 07:56 -0700, Andy Lutomirski wrote: > On Thu, Oct 3, 2019 at 2:38 PM Rick Edgecombe > wrote: > > > > This patchset enables the ability for KVM guests to create execute-only (XO) > > memory by utilizing EPT based XO permissions. XO memory is currently > > supported > > on

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

2019-10-04 Thread Edgecombe, Rick P
On Fri, 2019-10-04 at 09:34 +0200, Paolo Bonzini wrote: > On 03/10/19 23:23, Rick Edgecombe wrote: > > + > > + protection_map[4] = PAGE_EXECONLY; > > + protection_map[12] = PAGE_EXECONLY; > > Can you add #defines for the bits in protection_map? Also perhaps you > can replace the

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

2019-10-04 Thread Edgecombe, Rick P
On Fri, 2019-10-04 at 09:42 +0200, Paolo Bonzini wrote: > On 03/10/19 23:23, Rick Edgecombe wrote: > > + if (!vcpu->arch.gva_available) > > + return 0; > > Please return RET_PF_* constants, RET_PF_EMULATE here. Ok. > > + if (error_code & PFERR_WRITE_MASK) > > +

Re: [RFC PATCH 06/13] kvm: Add KVM_CAP_EXECONLY_MEM

2019-10-04 Thread Edgecombe, Rick P
On Fri, 2019-10-04 at 09:24 +0200, Paolo Bonzini wrote: > On 03/10/19 23:23, Rick Edgecombe wrote: > > 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 > > --- > >

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

2019-10-04 Thread Edgecombe, Rick P
On Fri, 2019-10-04 at 09:27 +0200, Paolo Bonzini wrote: > On 03/10/19 23:23, Rick Edgecombe wrote: > > Add XO memslot type to create execute-only guest physical memory based on > > the RO memslot. Like the RO memslot, disallow changing the memslot type > > to/from XO. > > > > In the EPT case

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

2019-10-04 Thread Edgecombe, Rick P
On Fri, 2019-10-04 at 09:22 +0200, Paolo Bonzini wrote: > On 03/10/19 23:23, Rick Edgecombe wrote: > > Since software would have previously received a #PF with the RSVD error code > > set, when the HW encountered any set bits in the region 51 to M, there was > > some > > internal discussion on

Re: [bisected] "mm/vmalloc: Add flag for freeing of special permsissions" corrupts memory on ia64

2019-07-04 Thread Edgecombe, Rick P
On Thu, 2019-07-04 at 12:53 +0300, Meelis Roos wrote: > I noticed that while 5.1 works on my HP Integrity RX2620, 5.2-rc6 > crashed on boot nondeterministically. > Bisecting it took many tries sice it does not happen on each boot and > when it happes, the symptoms are > different each time. But

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

2019-05-30 Thread Edgecombe, Rick P
On Thu, 2019-05-30 at 10:44 +0300, Meelis Roos wrote: > > > The addition of VM_FLUSH_RESET_PERMS for BPF JIT allocations was > > > bisected to prevent boot on an UltraSparc III machine. It was > > > found > > > that > > > sometime shortly after the TLB flush this flag does on vfree of > > > the >

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

2019-05-29 Thread Edgecombe, Rick P
On Tue, 2019-05-28 at 22:51 -0700, Rick Edgecombe wrote: > The addition of VM_FLUSH_RESET_PERMS for BPF JIT allocations was > bisected to prevent boot on an UltraSparc III machine. It was found > that > sometime shortly after the TLB flush this flag does on vfree of the > BPF > program, the

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

2019-05-28 Thread Edgecombe, Rick P
On Tue, 2019-05-28 at 17:23 -0700, David Miller wrote: > From: Rick Edgecombe > Date: Mon, 27 May 2019 14:10:56 -0700 > > > These two patches address issues with the recently added > > VM_FLUSH_RESET_PERMS vmalloc flag. > > > > Patch 1 addresses an issue that could cause a crash after other > >

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

2019-05-27 Thread Edgecombe, Rick P
On Mon, 2019-05-27 at 14:20 +0200, Peter Zijlstra wrote: > On Tue, May 21, 2019 at 01:51:36PM -0700, Rick Edgecombe wrote: > > 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.

Re: [PATCH v2] vmalloc: Fix issues with flush flag

2019-05-24 Thread Edgecombe, Rick P
On Wed, 2019-05-22 at 15:40 -0700, Rick Edgecombe wrote: > On Wed, 2019-05-22 at 12:26 -0700, Rick Edgecombe wrote: > > On Wed, 2019-05-22 at 10:40 -0700, David Miller wrote: > > > From: "Edgecombe, Rick P" > > > Date: Tue, 21 May 2019 01:59:54 + >

Re: [PATCH v2] vmalloc: Fix issues with flush flag

2019-05-22 Thread Edgecombe, Rick P
On Wed, 2019-05-22 at 12:26 -0700, Rick Edgecombe wrote: > On Wed, 2019-05-22 at 10:40 -0700, David Miller wrote: > > From: "Edgecombe, Rick P" > > Date: Tue, 21 May 2019 01:59:54 + > > > > > On Mon, 2019-05-20 at 18:43 -0700, David Miller

Re: [PATCH v2] vmalloc: Fix issues with flush flag

2019-05-22 Thread Edgecombe, Rick P
On Wed, 2019-05-22 at 10:40 -0700, David Miller wrote: > From: "Edgecombe, Rick P" > Date: Tue, 21 May 2019 01:59:54 + > > > On Mon, 2019-05-20 at 18:43 -0700, David Miller wrote: > > > From: "Edgecombe, Rick P" > > > Date: Tue, 21 Ma

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

2019-05-21 Thread Edgecombe, Rick P
On Tue, 2019-05-21 at 10:00 -0700, Andy Lutomirski wrote: > On Tue, May 21, 2019 at 9:51 AM Edgecombe, Rick P > wrote: > > On Tue, 2019-05-21 at 09:17 -0700, Andy Lutomirski wrote: > > > On Mon, May 20, 2019 at 4:39 PM Rick Edgecombe > > > wrote

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

2019-05-21 Thread Edgecombe, Rick P
On Tue, 2019-05-21 at 09:17 -0700, Andy Lutomirski wrote: > On Mon, May 20, 2019 at 4:39 PM Rick Edgecombe > wrote: > > 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 > >

Re: [PATCH v2] vmalloc: Fix issues with flush flag

2019-05-20 Thread Edgecombe, Rick P
On Mon, 2019-05-20 at 18:43 -0700, David Miller wrote: > From: "Edgecombe, Rick P" > Date: Tue, 21 May 2019 01:20:33 + > > > Should it handle executing an unmapped page gracefully? Because > > this > > change is causing that to happen much

Re: [PATCH v2] vmalloc: Fix issues with flush flag

2019-05-20 Thread Edgecombe, Rick P
On Mon, 2019-05-20 at 20:33 -0400, David Miller wrote: > From: "Edgecombe, Rick P" > Date: Tue, 21 May 2019 00:20:13 + > > > This behavior shouldn't happen until modules or BPF are being > > freed. > > Then that would rule out my theory. > > The

Re: [PATCH v2] vmalloc: Fix issues with flush flag

2019-05-20 Thread Edgecombe, Rick P
On Mon, 2019-05-20 at 15:48 -0700, David Miller wrote: > From: "Edgecombe, Rick P" > Date: Mon, 20 May 2019 22:17:49 + > > > Thanks for testing. So I guess that suggests it's the TLB flush > > causing > > the problem on sparc and not any lazy purge deadlo

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

2019-05-20 Thread Edgecombe, Rick P
On Mon, 2019-05-20 at 16:38 -0700, Rick Edgecombe wrote: > These two patches address issues with the recently added > VM_FLUSH_RESET_PERMS vmalloc flag. It is now split into two patches, > which > made sense to me, but can split it further if desired. > Oops, this was supposed to say PATCH v3.

Re: [PATCH v2] vmalloc: Fix issues with flush flag

2019-05-20 Thread Edgecombe, Rick P
On Tue, 2019-05-21 at 00:36 +0300, Meelis Roos wrote: > > Switch VM_FLUSH_RESET_PERMS to use a regular TLB flush intead of > > vm_unmap_aliases() and fix calculation of the direct map for the > > CONFIG_ARCH_HAS_SET_DIRECT_MAP case. > > > > Meelis Roos reported issues with the new

Re: [PATCH v2] vmalloc: Fix issues with flush flag

2019-05-20 Thread Edgecombe, Rick P
On Mon, 2019-05-20 at 14:25 -0700, Andy Lutomirski wrote: > > > > On May 20, 2019, at 1:07 PM, Rick Edgecombe < > > rick.p.edgeco...@intel.com> wrote: > > > > Switch VM_FLUSH_RESET_PERMS to use a regular TLB flush intead of > > vm_unmap_aliases() and fix calculation of the direct map for the >

Re: [PATCH] x86/entry/64: randomize kernel stack offset upon syscall

2019-04-26 Thread Edgecombe, Rick P
On Fri, 2019-04-26 at 12:33 +0100, Reshetova, Elena wrote: > 1) rdtsc or variations based on it (David proposed some CRC-based variants for > > example) Hi, Could we repeatedly measure the time for a short syscall on a quiet system and estimate the entropy we get from this? In some scenarios the

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

2019-04-25 Thread Edgecombe, Rick P
On Thu, 2019-04-25 at 22:38 +0200, Peter Zijlstra wrote: > On Mon, Apr 22, 2019 at 11:57:58AM -0700, Rick Edgecombe wrote: > > Add a new flag VM_FLUSH_RESET_PERMS, for enabling vfree operations to > > immediately clear executable TLB entries before freeing pages, and handle > > resetting

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

2019-04-25 Thread Edgecombe, Rick P
On Thu, 2019-04-25 at 14:28 -0400, Steven Rostedt wrote: > On Mon, 22 Apr 2019 11:58:01 -0700 > Rick Edgecombe wrote: > > > 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

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

2019-02-22 Thread Edgecombe, Rick P
On Fri, 2019-02-22 at 17:14 +0100, Borislav Petkov wrote: > On Thu, Feb 21, 2019 at 03:44:31PM -0800, Rick Edgecombe wrote: > > Changes v2 to v3: > > - Fix commit messages and comments [Boris] > > - Rename VM_HAS_SPECIAL_PERMS [Boris] > > - Remove unnecessary local variables [Boris] > > -

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

2019-02-21 Thread Edgecombe, Rick P
On Thu, 2019-02-21 at 19:22 -0500, Steven Rostedt wrote: > On Thu, 21 Feb 2019 15:44:49 -0800 > Rick Edgecombe wrote: > > > 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

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

2019-02-19 Thread Edgecombe, Rick P
On Tue, 2019-02-19 at 12:04 +0100, Borislav Petkov wrote: > On Mon, Jan 28, 2019 at 04:34:16PM -0800, Rick Edgecombe wrote: > > For architectures with CONFIG_ARCH_HAS_SET_ALIAS, pages can be unmapped > > briefly on the directmap, even when CONFIG_DEBUG_PAGEALLOC is not > > configured. So this

Re: [PATCH v2 15/20] vmalloc: New flags for safe vfree on special perms

2019-02-19 Thread Edgecombe, Rick P
Thanks Boris. Ard, Will: An arm question came up below. Any thoughts? On Tue, 2019-02-19 at 13:48 +0100, Borislav Petkov wrote: > On Mon, Jan 28, 2019 at 04:34:17PM -0800, Rick Edgecombe wrote: > > This adds a new flags VM_HAS_SPECIAL_PERMS, for enabling vfree operations > > s/This adds/add/ -

Re: [PATCH v2 13/20] Add set_alias_ function and x86 implementation

2019-02-11 Thread Edgecombe, Rick P
On Mon, 2019-02-11 at 14:59 -0800, Andy Lutomirski wrote: > On Mon, Feb 11, 2019 at 11:09 AM Borislav Petkov wrote: > > > > On Mon, Jan 28, 2019 at 04:34:15PM -0800, Rick Edgecombe wrote: > > > This adds two new functions set_alias_default_noflush and > > > > s/This adds/Add/ > > > > >

Re: [PATCH v2 13/20] Add set_alias_ function and x86 implementation

2019-02-11 Thread Edgecombe, Rick P
On Mon, 2019-02-11 at 20:09 +0100, Borislav Petkov wrote: > On Mon, Jan 28, 2019 at 04:34:15PM -0800, Rick Edgecombe wrote: > > This adds two new functions set_alias_default_noflush and > > s/This adds/Add/ > > > set_alias_nv_noflush for setting the alias mapping for the page to its > > Please

Re: [PATCH 16/17] Plug in new special vfree flag

2019-02-07 Thread Edgecombe, Rick P
On Thu, 2019-02-07 at 12:49 -0500, Steven Rostedt wrote: > On Thu, 7 Feb 2019 17:33:37 + > "Edgecombe, Rick P" wrote: > > > > > > --- > > > > arch/x86/kernel/ftrace.c | 6 +-- > > > > > > For the ftrace code. >

Re: [PATCH 16/17] Plug in new special vfree flag

2019-02-07 Thread Edgecombe, Rick P
On Wed, 2019-02-06 at 11:23 -0500, Steven Rostedt wrote: > On Wed, 16 Jan 2019 16:32:58 -0800 > Rick Edgecombe wrote: > > > Add new flag for handling freeing of special permissioned memory in vmalloc > > and remove places where memory was set RW before freeing which is no longer > > needed. > >

Re: [PATCH 14/17] mm: Make hibernate handle unmapped pages

2019-01-17 Thread Edgecombe, Rick P
On Fri, 2019-01-18 at 00:41 +0100, Pavel Machek wrote: > Hi! > > > > > For architectures with CONFIG_ARCH_HAS_SET_ALIAS, pages can be unmapped > > > > briefly on the directmap, even when CONFIG_DEBUG_PAGEALLOC is not > > > > configured. > > > > So this changes kernel_map_pages and

Re: [PATCH 14/17] mm: Make hibernate handle unmapped pages

2019-01-17 Thread Edgecombe, Rick P
On Thu, 2019-01-17 at 10:39 +0100, Pavel Machek wrote: > Hi! > > > For architectures with CONFIG_ARCH_HAS_SET_ALIAS, pages can be unmapped > > briefly on the directmap, even when CONFIG_DEBUG_PAGEALLOC is not > > configured. > > So this changes kernel_map_pages and kernel_page_present to be

Re: [PATCH v9 RESEND 0/4] KASLR feature to randomize each loadable module

2018-12-17 Thread Edgecombe, Rick P
On Mon, 2018-12-17 at 05:41 +0100, Jessica Yu wrote: > +++ Edgecombe, Rick P [12/12/18 23:05 +]: > > On Wed, 2018-11-28 at 01:40 +, Edgecombe, Rick P wrote: > > > On Tue, 2018-11-27 at 11:21 +0100, Daniel Borkmann wrote: > > > > On 11/27/2018 01:

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

2018-12-17 Thread Edgecombe, Rick P
On Sat, 2018-12-15 at 10:52 -0800, Andy Lutomirski wrote: > On Wed, Dec 12, 2018 at 2:01 PM Edgecombe, Rick P > wrote: > > > > On Wed, 2018-12-12 at 11:57 -0800, Andy Lutomirski wrote: > > > On Wed, Dec 12, 2018 at 11:50 AM Edgecombe, Rick P > > > wrote:

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

2018-12-13 Thread Edgecombe, Rick P
On Thu, 2018-12-13 at 19:27 +, Nadav Amit wrote: > > On Dec 13, 2018, at 11:02 AM, Edgecombe, Rick P > > wrote: > > > > On Wed, 2018-12-12 at 23:40 +, Nadav Amit wrote: > > > > On Dec 11, 2018, at 4:03 PM, Rick Edgecombe > > > > wrote: >

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

2018-12-13 Thread Edgecombe, Rick P
On Wed, 2018-12-12 at 23:40 +, Nadav Amit wrote: > > On Dec 11, 2018, at 4:03 PM, Rick Edgecombe > > wrote: > > > > 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

Re: [PATCH v9 RESEND 0/4] KASLR feature to randomize each loadable module

2018-12-12 Thread Edgecombe, Rick P
On Wed, 2018-11-28 at 01:40 +, Edgecombe, Rick P wrote: > On Tue, 2018-11-27 at 11:21 +0100, Daniel Borkmann wrote: > > On 11/27/2018 01:19 AM, Edgecombe, Rick P wrote: > > > On Mon, 2018-11-26 at 16:36 +0100, Jessica Yu wrote: > > > > +++ Rick E

  1   2   >