From mboxrd@z Thu Jan 1 00:00:00 1970 From: valdis.kletnieks@vt.edu (valdis.kletnieks at vt.edu) Date: Fri, 06 Jul 2018 14:42:25 -0400 Subject: How to change page permission from inside the kernel? In-Reply-To: References: Message-ID: <107393.1530902545@turing-police.cc.vt.edu> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Fri, 06 Jul 2018 20:06:29 +0200, Ahmed Soliman said: > I have a memory page allocated with mmap() from user space, This > address is passed to some kernel module (kvm_intel to be specific) and > i want to know how can I change the page permission from inside there > My goal is to achieve something like this > mprotect(mem, PAGE_SIZE, PROT_READ) > except for mprotect can't be called from the kernel, and I couldn't > find the right way to do it. You better have a *really* good reason for wanting to do that from inside the kernel, when userspace is perfectly able to do it for itself. So there's two questions here: 1) Why does the page's protection need to be changed? 2) And why from inside the kernel? -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 486 bytes Desc: not available URL: