hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/x86/lib/usercopy_64.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * User address space access functions.
34 *
....@@ -38,8 +39,8 @@
3839 "3: lea 0(%[size1],%[size8],8),%[size8]\n"
3940 " jmp 2b\n"
4041 ".previous\n"
41
- _ASM_EXTABLE(0b,3b)
42
- _ASM_EXTABLE(1b,2b)
42
+ _ASM_EXTABLE_UA(0b, 3b)
43
+ _ASM_EXTABLE_UA(1b, 2b)
4344 : [size8] "=&c"(size), [dst] "=&D" (__d0)
4445 : [size1] "r"(size & 7), "[size8]" (size / 8), "[dst]"(addr));
4546 clac();
....@@ -49,52 +50,11 @@
4950
5051 unsigned long clear_user(void __user *to, unsigned long n)
5152 {
52
- if (access_ok(VERIFY_WRITE, to, n))
53
+ if (access_ok(to, n))
5354 return __clear_user(to, n);
5455 return n;
5556 }
5657 EXPORT_SYMBOL(clear_user);
57
-
58
-/*
59
- * Try to copy last bytes and clear the rest if needed.
60
- * Since protection fault in copy_from/to_user is not a normal situation,
61
- * it is not necessary to optimize tail handling.
62
- */
63
-__visible unsigned long
64
-copy_user_handle_tail(char *to, char *from, unsigned len)
65
-{
66
- for (; len; --len, to++) {
67
- char c;
68
-
69
- if (__get_user_nocheck(c, from++, sizeof(char)))
70
- break;
71
- if (__put_user_nocheck(c, to, sizeof(char)))
72
- break;
73
- }
74
- clac();
75
- return len;
76
-}
77
-
78
-/*
79
- * Similar to copy_user_handle_tail, probe for the write fault point,
80
- * but reuse __memcpy_mcsafe in case a new read error is encountered.
81
- * clac() is handled in _copy_to_iter_mcsafe().
82
- */
83
-__visible unsigned long
84
-mcsafe_handle_tail(char *to, char *from, unsigned len)
85
-{
86
- for (; len; --len, to++, from++) {
87
- /*
88
- * Call the assembly routine back directly since
89
- * memcpy_mcsafe() may silently fallback to memcpy.
90
- */
91
- unsigned long rem = __memcpy_mcsafe(to, from, 1);
92
-
93
- if (rem)
94
- break;
95
- }
96
- return len;
97
-}
9858
9959 #ifdef CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE
10060 /**
....@@ -154,14 +114,14 @@
154114 return rc;
155115 }
156116
157
-void memcpy_flushcache(void *_dst, const void *_src, size_t size)
117
+void __memcpy_flushcache(void *_dst, const void *_src, size_t size)
158118 {
159119 unsigned long dest = (unsigned long) _dst;
160120 unsigned long source = (unsigned long) _src;
161121
162122 /* cache copy and flush to align dest */
163123 if (!IS_ALIGNED(dest, 8)) {
164
- unsigned len = min_t(unsigned, size, ALIGN(dest, 8) - dest);
124
+ size_t len = min_t(size_t, size, ALIGN(dest, 8) - dest);
165125
166126 memcpy((void *) dest, (void *) source, len);
167127 clean_cache_range((void *) dest, len);
....@@ -217,7 +177,7 @@
217177 clean_cache_range((void *) dest, size);
218178 }
219179 }
220
-EXPORT_SYMBOL_GPL(memcpy_flushcache);
180
+EXPORT_SYMBOL_GPL(__memcpy_flushcache);
221181
222182 void memcpy_page_flushcache(char *to, struct page *page, size_t offset,
223183 size_t len)