diff options
Diffstat (limited to 'arch/x86/lib/usercopy_32.c')
-rw-r--r-- | arch/x86/lib/usercopy_32.c | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c index 98f6d6b68f5a..f0312d746402 100644 --- a/arch/x86/lib/usercopy_32.c +++ b/arch/x86/lib/usercopy_32.c | |||
@@ -570,63 +570,6 @@ do { \ | |||
570 | unsigned long __copy_to_user_ll(void __user *to, const void *from, | 570 | unsigned long __copy_to_user_ll(void __user *to, const void *from, |
571 | unsigned long n) | 571 | unsigned long n) |
572 | { | 572 | { |
573 | #ifndef CONFIG_X86_WP_WORKS_OK | ||
574 | if (unlikely(boot_cpu_data.wp_works_ok == 0) && | ||
575 | ((unsigned long)to) < TASK_SIZE) { | ||
576 | /* | ||
577 | * When we are in an atomic section (see | ||
578 | * mm/filemap.c:file_read_actor), return the full | ||
579 | * length to take the slow path. | ||
580 | */ | ||
581 | if (in_atomic()) | ||
582 | return n; | ||
583 | |||
584 | /* | ||
585 | * CPU does not honor the WP bit when writing | ||
586 | * from supervisory mode, and due to preemption or SMP, | ||
587 | * the page tables can change at any time. | ||
588 | * Do it manually. Manfred <manfred@colorfullife.com> | ||
589 | */ | ||
590 | while (n) { | ||
591 | unsigned long offset = ((unsigned long)to)%PAGE_SIZE; | ||
592 | unsigned long len = PAGE_SIZE - offset; | ||
593 | int retval; | ||
594 | struct page *pg; | ||
595 | void *maddr; | ||
596 | |||
597 | if (len > n) | ||
598 | len = n; | ||
599 | |||
600 | survive: | ||
601 | down_read(¤t->mm->mmap_sem); | ||
602 | retval = get_user_pages(current, current->mm, | ||
603 | (unsigned long)to, 1, 1, 0, &pg, NULL); | ||
604 | |||
605 | if (retval == -ENOMEM && is_global_init(current)) { | ||
606 | up_read(¤t->mm->mmap_sem); | ||
607 | congestion_wait(BLK_RW_ASYNC, HZ/50); | ||
608 | goto survive; | ||
609 | } | ||
610 | |||
611 | if (retval != 1) { | ||
612 | up_read(¤t->mm->mmap_sem); | ||
613 | break; | ||
614 | } | ||
615 | |||
616 | maddr = kmap_atomic(pg); | ||
617 | memcpy(maddr + offset, from, len); | ||
618 | kunmap_atomic(maddr); | ||
619 | set_page_dirty_lock(pg); | ||
620 | put_page(pg); | ||
621 | up_read(¤t->mm->mmap_sem); | ||
622 | |||
623 | from += len; | ||
624 | to += len; | ||
625 | n -= len; | ||
626 | } | ||
627 | return n; | ||
628 | } | ||
629 | #endif | ||
630 | stac(); | 573 | stac(); |
631 | if (movsl_is_ok(to, from, n)) | 574 | if (movsl_is_ok(to, from, n)) |
632 | __copy_user(to, from, n); | 575 | __copy_user(to, from, n); |