[PATCH 05/65] powerpc/mm: Replace _PAGE_USER with _PAGE_PRIVILEGED
Ian Munsie
imunsie at au1.ibm.com
Mon Mar 28 02:41:45 AEDT 2016
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 <aneesh.kumar at linux.vnet.ibm.com>
Acked-by: Ian Munsie <imunsie at au1.ibm.com>
> 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;
More information about the Linuxppc-dev
mailing list