arch/arm/kernel/entry-armv.S | 0 arch/arm/kernel/process.c | 0 arch/arm/lib/uaccess_with_memcpy.c | 7 +++++++ 3 files changed, 7 insertions(+) diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c index d72b90905132..110e3e272583 100644 --- a/arch/arm/lib/uaccess_with_memcpy.c +++ b/arch/arm/lib/uaccess_with_memcpy.c @@ -88,6 +88,7 @@ pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) static unsigned long noinline __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) { + unsigned long dacr; int atomic; if (unlikely(segment_eq(get_fs(), KERNEL_DS))) { @@ -98,6 +99,7 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) /* the mmap semaphore is taken only if not in an atomic context */ atomic = faulthandler_disabled(); + dacr = get_domain(); if (!atomic) down_read(¤t->mm->mmap_sem); while (n) { @@ -118,6 +120,7 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) if (tocopy > n) tocopy = n; + set_domain(dacr); memcpy((void *)to, from, tocopy); to += tocopy; from += tocopy; @@ -153,11 +156,14 @@ arm_copy_to_user(void __user *to, const void *from, unsigned long n) static unsigned long noinline __clear_user_memset(void __user *addr, unsigned long n) { + unsigned long dacr; + if (unlikely(segment_eq(get_fs(), KERNEL_DS))) { memset((void *)addr, 0, n); return 0; } + dacr = get_domain(); down_read(¤t->mm->mmap_sem); while (n) { pte_t *pte; @@ -175,6 +181,7 @@ __clear_user_memset(void __user *addr, unsigned long n) if (tocopy > n) tocopy = n; + set_domain(dacr); memset((void *)addr, 0, tocopy); addr += tocopy; n -= tocopy;