Skip to content

Commit

Permalink
ARM: mm: use pteval_t to represent page protection values
Browse files Browse the repository at this point in the history
When updating the page protection map after calculating the user_pgprot
value, the base protection map is temporarily stored in an unsigned long
type, causing truncation of the protection bits when LPAE is enabled.
This effectively means that calls to mprotect() will corrupt the upper
page attributes, clearing the XN bit unconditionally.

This patch uses pteval_t to store the intermediate protection values,
preserving the upper bits for 64-bit descriptors.

Cc: stable@vger.kernel.org
Acked-by: Nicolas Pitre <nico@linaro.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
  • Loading branch information
Will Deacon committed Nov 9, 2012
1 parent 3d70f8c commit 864aa04
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/arm/mm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ static void __init build_mem_type_table(void)
#endif

for (i = 0; i < 16; i++) {
unsigned long v = pgprot_val(protection_map[i]);
pteval_t v = pgprot_val(protection_map[i]);
protection_map[i] = __pgprot(v | user_pgprot);
}

Expand Down

0 comments on commit 864aa04

Please sign in to comment.