Skip to content

Commit 71a86ef

Browse files
heicarstMartin Schwidefsky
authored andcommitted
s390/uaccess: add missing page table walk range check
When translating a user space address, the address must be checked against the ASCE limit of the process. If the address is larger than the maximum address that is reachable with the ASCE, an ASCE type exception must be generated. The current code simply ignored the higher order bits. This resulted in an address wrap around in user space instead of an exception in user space. Cc: stable@vger.kernel.org # v3.9+ Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
1 parent dba6bb6 commit 71a86ef

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎arch/s390/lib/uaccess_pt.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,14 @@ static size_t copy_in_kernel(size_t count, void __user *to,
7878
* contains the (negative) exception code.
7979
*/
8080
#ifdef CONFIG_64BIT
81+
8182
static unsigned long follow_table(struct mm_struct *mm,
8283
unsigned long address, int write)
8384
{
8485
unsigned long *table = (unsigned long *)__pa(mm->pgd);
8586

87+
if (unlikely(address > mm->context.asce_limit - 1))
88+
return -0x38UL;
8689
switch (mm->context.asce_bits & _ASCE_TYPE_MASK) {
8790
case _ASCE_TYPE_REGION1:
8891
table = table + ((address >> 53) & 0x7ff);

0 commit comments

Comments
 (0)