s390/uaccess: fix kernel ds access for page table walk
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Mon, 25 Feb 2013 08:10:23 +0000 (09:10 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Thu, 28 Feb 2013 08:37:12 +0000 (09:37 +0100)
commit066c4373599211ab0e1425586b8df6f1e932d97e
treeb1ccc220714494e034092dbe583c0c46cbca3591
parent225cf8d69c768f4472d2fd9f54bba2b69a588193
s390/uaccess: fix kernel ds access for page table walk

When the kernel resides in home space and the mvcos instruction is not
available uaccesses for kernel ds happen via simple strnlen() or memcpy()
calls.
This however can break badly, since uaccesses in kernel space may fail as
well, especially if CONFIG_DEBUG_PAGEALLOC is turned on.

To fix this implement strnlen_kernel() and copy_in_kernel() functions
which can only be used by the page table uaccess functions. These two
functions detect invalid memory accesses and return the correct length
of processed data.. Both functions are more or less a copy of the std
variants without sacf calls.

Fixes ipl crashes on 31 bit machines as well on 64 bit machines without
mvcos. Caused by changing the default address space of the kernel being
home space.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/lib/uaccess_pt.c