Date: Thu, 14 Feb 2019 14:50:47 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r344122 - stable/12/sys/vm Message-ID: <201902141450.x1EEolfm003203@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Thu Feb 14 14:50:47 2019 New Revision: 344122 URL: https://svnweb.freebsd.org/changeset/base/344122 Log: MFC r343850: contigmalloc: handle M_EXEC. Modified: stable/12/sys/vm/vm_kern.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_kern.c ============================================================================== --- stable/12/sys/vm/vm_kern.c Thu Feb 14 14:44:53 2019 (r344121) +++ stable/12/sys/vm/vm_kern.c Thu Feb 14 14:50:47 2019 (r344122) @@ -184,6 +184,7 @@ kmem_alloc_attr_domain(int domain, vm_size_t size, int vm_offset_t addr, i, offset; vm_page_t m; int pflags, tries; + vm_prot_t prot; size = round_page(size); vmem = vm_dom[domain].vmd_kernel_arena; @@ -193,6 +194,7 @@ kmem_alloc_attr_domain(int domain, vm_size_t size, int pflags = malloc2vm_flags(flags) | VM_ALLOC_NOBUSY | VM_ALLOC_WIRED; pflags &= ~(VM_ALLOC_NOWAIT | VM_ALLOC_WAITOK | VM_ALLOC_WAITFAIL); pflags |= VM_ALLOC_NOWAIT; + prot = (flags & M_EXEC) != 0 ? VM_PROT_ALL : VM_PROT_RW; VM_OBJECT_WLOCK(object); for (i = 0; i < size; i += PAGE_SIZE) { tries = 0; @@ -220,8 +222,8 @@ retry: if ((flags & M_ZERO) && (m->flags & PG_ZERO) == 0) pmap_zero_page(m); m->valid = VM_PAGE_BITS_ALL; - pmap_enter(kernel_pmap, addr + i, m, VM_PROT_RW, - VM_PROT_RW | PMAP_ENTER_WIRED, 0); + pmap_enter(kernel_pmap, addr + i, m, prot, + prot | PMAP_ENTER_WIRED, 0); } VM_OBJECT_WUNLOCK(object); return (addr);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902141450.x1EEolfm003203>