forked from mirrors/linux
		
	arm64: use PAGE_KERNEL_ROX directly in alloc_insn_page
Use PAGE_KERNEL_ROX directly instead of allocating RWX and setting the page read-only just after the allocation. Link: http://lkml.kernel.org/r/20200618064307.32739-3-hch@lst.de Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: David Hildenbrand <david@redhat.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Dexuan Cui <decui@microsoft.com> Cc: Jessica Yu <jeyu@kernel.org> Cc: Vitaly Kuznetsov <vkuznets@redhat.com> Cc: Wei Liu <wei.liu@kernel.org> Cc: Will Deacon <will@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									800e26b813
								
							
						
					
					
						commit
						10d5e97c1b
					
				
					 1 changed files with 3 additions and 9 deletions
				
			
		| 
						 | 
					@ -120,15 +120,9 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void *alloc_insn_page(void)
 | 
					void *alloc_insn_page(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	void *page;
 | 
						return __vmalloc_node_range(PAGE_SIZE, 1, VMALLOC_START, VMALLOC_END,
 | 
				
			||||||
 | 
								GFP_KERNEL, PAGE_KERNEL_ROX, VM_FLUSH_RESET_PERMS,
 | 
				
			||||||
	page = vmalloc_exec(PAGE_SIZE);
 | 
								NUMA_NO_NODE, __func__);
 | 
				
			||||||
	if (page) {
 | 
					 | 
				
			||||||
		set_memory_ro((unsigned long)page, 1);
 | 
					 | 
				
			||||||
		set_vm_flush_reset_perms(page);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return page;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* arm kprobe: install breakpoint in text */
 | 
					/* arm kprobe: install breakpoint in text */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue