linux/arch/s390/lib
Heiko Carstens ea81531de2 s390/uaccess: fix page table walk
When translating user space addresses to kernel addresses the follow_table()
function had two bugs:

- PROT_NONE mappings could be read accessed via the kernel mapping. That is
  e.g. putting a filename into a user page, then protecting the page with
  PROT_NONE and afterwards issuing the "open" syscall with a pointer to
  the filename would incorrectly succeed.

- when walking the page tables it used the pgd/pud/pmd/pte primitives which
  with dynamic page tables give no indication which real level of page tables
  is being walked (region2, region3, segment or page table). So in case of an
  exception the translation exception code passed to __handle_fault() is not
  necessarily correct.
  This is not really an issue since __handle_fault() doesn't evaluate the code.
  Only in case of e.g. a SIGBUS this code gets passed to user space. If user
  space can do something sane with the value is a different question though.

To fix these issues don't use any Linux primitives. Only walk the page tables
like the hardware would do it, however we leave quite some checks away since
we know that we only have full size page tables and each index is within bounds.

In theory this should fix all issues...

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2013-04-02 08:53:08 +02:00
..
delay.c s390/time: rename tod clock access functions 2013-02-14 15:55:10 +01:00
div64.c s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
Makefile s390/string: provide asm lib functions for memcpy and memcmp 2012-09-26 15:44:50 +02:00
mem32.S s390/string: provide asm lib functions for memcpy and memcmp 2012-09-26 15:44:50 +02:00
mem64.S s390/string: provide asm lib functions for memcpy and memcmp 2012-09-26 15:44:50 +02:00
qrnnd.S [S390] fix s390 assembler code alignments 2011-07-24 10:48:21 +02:00
spinlock.c s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
string.c s390/string: provide asm lib functions for memcpy and memcmp 2012-09-26 15:44:50 +02:00
uaccess.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
uaccess_mvcos.c s390/uaccess: fix strncpy_from_user/strnlen_user zero maxlen case 2013-02-28 09:37:08 +01:00
uaccess_pt.c s390/uaccess: fix page table walk 2013-04-02 08:53:08 +02:00
uaccess_std.c s390/uaccess: fix strncpy_from_user string length check 2013-02-28 09:37:11 +01:00
ucmpdi2.c [S390] add __ucmpdi2() helper function 2009-07-07 16:37:53 +02:00
usercopy.c [S390] uaccess: implement strict user copy checks 2010-02-26 22:37:29 +01:00