diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2016-04-29 09:25:31 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-05-01 04:32:23 -0400 |
commit | 73a1441a9b2ae05c15eb7cc90d4de379b44249bf (patch) | |
tree | f3e91025eaa84ccd36bf71bd9f5fd2e19e2c9a6a /arch/powerpc/mm/hash_utils_64.c | |
parent | c7d54842deb1fa357cff75b988275a1c9f259140 (diff) |
powerpc/mm/subpage: Clear RWX bit to indicate no access
Subpage protection used to depend on the _PAGE_USER bit to implement no
access mode. This patch switches that to use _PAGE_RWX. We clear Read,
Write and Execute access from the pte instead of clearing _PAGE_USER
now. This was done so that we can switch to _PAGE_PRIVILEGED in a later
patch.
subpage_protection() returns pte bits that need to be cleared. Instead
of updating the interface to handle no-access in a separate way, it
appears simpler to clear RWX acecss to indicate no access.
We still don't insert hash ptes for no access implied by !_PAGE_RWX.
Hence we should not get PROT_FAULT with change.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/mm/hash_utils_64.c')
-rw-r--r-- | arch/powerpc/mm/hash_utils_64.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index ed190e42bbc5..36e00371ba5a 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c | |||
@@ -921,7 +921,7 @@ void demote_segment_4k(struct mm_struct *mm, unsigned long addr) | |||
921 | * Userspace sets the subpage permissions using the subpage_prot system call. | 921 | * Userspace sets the subpage permissions using the subpage_prot system call. |
922 | * | 922 | * |
923 | * Result is 0: full permissions, _PAGE_RW: read-only, | 923 | * Result is 0: full permissions, _PAGE_RW: read-only, |
924 | * _PAGE_USER or _PAGE_USER|_PAGE_RW: no access. | 924 | * _PAGE_RWX: no access. |
925 | */ | 925 | */ |
926 | static int subpage_protection(struct mm_struct *mm, unsigned long ea) | 926 | static int subpage_protection(struct mm_struct *mm, unsigned long ea) |
927 | { | 927 | { |
@@ -947,8 +947,13 @@ static int subpage_protection(struct mm_struct *mm, unsigned long ea) | |||
947 | /* extract 2-bit bitfield for this 4k subpage */ | 947 | /* extract 2-bit bitfield for this 4k subpage */ |
948 | spp >>= 30 - 2 * ((ea >> 12) & 0xf); | 948 | spp >>= 30 - 2 * ((ea >> 12) & 0xf); |
949 | 949 | ||
950 | /* turn 0,1,2,3 into combination of _PAGE_USER and _PAGE_RW */ | 950 | /* |
951 | spp = ((spp & 2) ? _PAGE_USER : 0) | ((spp & 1) ? _PAGE_RW : 0); | 951 | * 0 -> full premission |
952 | * 1 -> Read only | ||
953 | * 2 -> no access. | ||
954 | * We return the flag that need to be cleared. | ||
955 | */ | ||
956 | spp = ((spp & 2) ? _PAGE_RWX : 0) | ((spp & 1) ? _PAGE_WRITE : 0); | ||
952 | return spp; | 957 | return spp; |
953 | } | 958 | } |
954 | 959 | ||