Skip to content
Commit 147d8622 authored by Khalid Aziz's avatar Khalid Aziz Committed by David S. Miller
Browse files

sparc64: Use arch_validate_flags() to validate ADI flag



When userspace calls mprotect() to enable ADI on an address range,
do_mprotect_pkey() calls arch_validate_prot() to validate new
protection flags. arch_validate_prot() for sparc looks at the first
VMA associated with address range to verify if ADI can indeed be
enabled on this address range. This has two issues - (1) Address
range might cover multiple VMAs while arch_validate_prot() looks at
only the first VMA, (2) arch_validate_prot() peeks at VMA without
holding mmap lock which can result in race condition.

arch_validate_flags() from commit c462ac28 ("mm: Introduce
arch_validate_flags()") allows for VMA flags to be validated for all
VMAs that cover the address range given by user while holding mmap
lock. This patch updates sparc code to move the VMA check from
arch_validate_prot() to arch_validate_flags() to fix above two
issues.

Suggested-by: default avatarJann Horn <jannh@google.com>
Suggested-by: default avatarChristoph Hellwig <hch@infradead.org>
Suggested-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: default avatarKhalid Aziz <khalid.aziz@oracle.com>
Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 76962e03
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment