Re: [PATCH 05/65] powerpc/mm: Replace _PAGE_USER with _PAGE_PRIVILEGED

From
Ian Munsie <hidden>
Date
2016-03-27 15:43:07
Reply to
Aneesh Kumar K.V, 2016-03-27
Excerpts from Aneesh Kumar K.V's message of 2016-03-27 03:23:13 -0500:
_PAGE_PRIVILEGED means the page can be accessed only by kernel. This is done
to keep pte bits similar to PowerISA 3.0 radix PTE format. User
pages are now makred by clearing _PAGE_PRIVILEGED bit.

Previously we allowed kernel to have a privileged page
in the lower address range(USER_REGION). With this patch such access
is denied.
Copying in cxlflash folks - as the only in-kernel user of the cxl driver
can you do some testing and make sure that the driver still works with
this change?

Copying in Andrew Donnellan since he has a patch to fix the kernel test
that hasn't been merged yet that might be impacted by this.
We also prevent a kernel access to a non-privileged page in
higher address range (ie, REGION_ID != 0). Both the above access
scenario should never happen.

Signed-off-by: Aneesh Kumar K.V <redacted>
Acked-by: Ian Munsie <redacted>
quoted hunk ↗ jump to hunk
diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c
index a3d5e1e16c21..33bd0ee30edd 100644
--- a/drivers/misc/cxl/fault.c
+++ b/drivers/misc/cxl/fault.c
@@ -152,8 +152,10 @@ static void cxl_handle_page_fault(struct cxl_context *ctx,
     access = _PAGE_PRESENT | _PAGE_READ;
     if (dsisr & CXL_PSL_DSISR_An_S)
         access |= _PAGE_WRITE;
+
+    access |= _PAGE_PRIVILEGED;
     if ((!ctx->kernel) || ~(dar & (1ULL << 63)))
-        access |= _PAGE_USER;
+        access &= ~_PAGE_PRIVILEGED;
 
     if (dsisr & DSISR_NOHPTE)
         inv_flags |= HPTE_NOHPTE_UPDATE;
Thread (92 messages) 92 messages, 7 authors, last reply 2018-06-28
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help