[V2] powerpc/mm: Invalidate subpage_prot() system call on radix platforms

Message ID 20171204054922.16075-1-khandual@linux.vnet.ibm.com
State Accepted
Commit 5b2b80714796073ec9e196c7aeec59b7489fe676
Headers show
Series
  • [V2] powerpc/mm: Invalidate subpage_prot() system call on radix platforms
Related show

Commit Message

Anshuman Khandual Dec. 4, 2017, 5:49 a.m.
Radix enabled platforms don't support subpage_prot() system calls. But
at present the system call goes through without an error and fails
later on while validating expected subpage accesses. Lets not allow
the system call on powerpc radix platforms to begin with to prevent
this confusion in user space.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
Changes in V2:

Now it returns -ENOENT error instead as per Michael Ellerman.

 arch/powerpc/mm/subpage-prot.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Michael Ellerman Jan. 22, 2018, 3:34 a.m. | #1
On Mon, 2017-12-04 at 05:49:22 UTC, Anshuman Khandual wrote:
> Radix enabled platforms don't support subpage_prot() system calls. But
> at present the system call goes through without an error and fails
> later on while validating expected subpage accesses. Lets not allow
> the system call on powerpc radix platforms to begin with to prevent
> this confusion in user space.
> 
> Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/5b2b80714796073ec9e196c7aeec59

cheers

Patch

diff --git a/arch/powerpc/mm/subpage-prot.c b/arch/powerpc/mm/subpage-prot.c
index 781532d..f14a07c 100644
--- a/arch/powerpc/mm/subpage-prot.c
+++ b/arch/powerpc/mm/subpage-prot.c
@@ -195,6 +195,9 @@  long sys_subpage_prot(unsigned long addr, unsigned long len, u32 __user *map)
 	unsigned long next, limit;
 	int err;
 
+	if (radix_enabled())
+		return -ENOENT;
+
 	/* Check parameters */
 	if ((addr & ~PAGE_MASK) || (len & ~PAGE_MASK) ||
 	    addr >= mm->task_size || len >= mm->task_size ||