aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>2015-05-11 11:52:08 -0400
committerIngo Molnar <mingo@kernel.org>2015-05-19 02:39:14 -0400
commitb3c395ef5556a6c60f4426cc060f5b7bdcf82d5b (patch)
tree55e89d5396f6a42444f91973ed65884530ad45e9
parent9ec23531fd48031d1b6ca5366f5f967d17a8bc28 (diff)
mm/uaccess, mm/fault: Clarify that uaccess may only sleep if pagefaults are enabled
In general, non-atomic variants of user access functions must not sleep if pagefaults are disabled. Let's update all relevant comments in uaccess code. This also reflects the might_sleep() checks in might_fault(). Reviewed-and-tested-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: David.Laight@ACULAB.COM Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: airlied@linux.ie Cc: akpm@linux-foundation.org Cc: benh@kernel.crashing.org Cc: bigeasy@linutronix.de Cc: borntraeger@de.ibm.com Cc: daniel.vetter@intel.com Cc: heiko.carstens@de.ibm.com Cc: herbert@gondor.apana.org.au Cc: hocko@suse.cz Cc: hughd@google.com Cc: mst@redhat.com Cc: paulus@samba.org Cc: ralf@linux-mips.org Cc: schwidefsky@de.ibm.com Cc: yang.shi@windriver.com Link: http://lkml.kernel.org/r/1431359540-32227-4-git-send-email-dahi@linux.vnet.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/avr32/include/asm/uaccess.h12
-rw-r--r--arch/hexagon/include/asm/uaccess.h3
-rw-r--r--arch/m32r/include/asm/uaccess.h30
-rw-r--r--arch/microblaze/include/asm/uaccess.h6
-rw-r--r--arch/mips/include/asm/uaccess.h45
-rw-r--r--arch/s390/include/asm/uaccess.h15
-rw-r--r--arch/score/include/asm/uaccess.h15
-rw-r--r--arch/tile/include/asm/uaccess.h18
-rw-r--r--arch/x86/include/asm/uaccess.h15
-rw-r--r--arch/x86/include/asm/uaccess_32.h6
-rw-r--r--arch/x86/lib/usercopy_32.c6
-rw-r--r--lib/strnlen_user.c6
12 files changed, 118 insertions, 59 deletions
diff --git a/arch/avr32/include/asm/uaccess.h b/arch/avr32/include/asm/uaccess.h
index a46f7cf3e1ea..68cf638faf48 100644
--- a/arch/avr32/include/asm/uaccess.h
+++ b/arch/avr32/include/asm/uaccess.h
@@ -97,7 +97,8 @@ static inline __kernel_size_t __copy_from_user(void *to,
97 * @x: Value to copy to user space. 97 * @x: Value to copy to user space.
98 * @ptr: Destination address, in user space. 98 * @ptr: Destination address, in user space.
99 * 99 *
100 * Context: User context only. This function may sleep. 100 * Context: User context only. This function may sleep if pagefaults are
101 * enabled.
101 * 102 *
102 * This macro copies a single simple value from kernel space to user 103 * This macro copies a single simple value from kernel space to user
103 * space. It supports simple types like char and int, but not larger 104 * space. It supports simple types like char and int, but not larger
@@ -116,7 +117,8 @@ static inline __kernel_size_t __copy_from_user(void *to,
116 * @x: Variable to store result. 117 * @x: Variable to store result.
117 * @ptr: Source address, in user space. 118 * @ptr: Source address, in user space.
118 * 119 *
119 * Context: User context only. This function may sleep. 120 * Context: User context only. This function may sleep if pagefaults are
121 * enabled.
120 * 122 *
121 * This macro copies a single simple variable from user space to kernel 123 * This macro copies a single simple variable from user space to kernel
122 * space. It supports simple types like char and int, but not larger 124 * space. It supports simple types like char and int, but not larger
@@ -136,7 +138,8 @@ static inline __kernel_size_t __copy_from_user(void *to,
136 * @x: Value to copy to user space. 138 * @x: Value to copy to user space.
137 * @ptr: Destination address, in user space. 139 * @ptr: Destination address, in user space.
138 * 140 *
139 * Context: User context only. This function may sleep. 141 * Context: User context only. This function may sleep if pagefaults are
142 * enabled.
140 * 143 *
141 * This macro copies a single simple value from kernel space to user 144 * This macro copies a single simple value from kernel space to user
142 * space. It supports simple types like char and int, but not larger 145 * space. It supports simple types like char and int, but not larger
@@ -158,7 +161,8 @@ static inline __kernel_size_t __copy_from_user(void *to,
158 * @x: Variable to store result. 161 * @x: Variable to store result.
159 * @ptr: Source address, in user space. 162 * @ptr: Source address, in user space.
160 * 163 *
161 * Context: User context only. This function may sleep. 164 * Context: User context only. This function may sleep if pagefaults are
165 * enabled.
162 * 166 *
163 * This macro copies a single simple variable from user space to kernel 167 * This macro copies a single simple variable from user space to kernel
164 * space. It supports simple types like char and int, but not larger 168 * space. It supports simple types like char and int, but not larger
diff --git a/arch/hexagon/include/asm/uaccess.h b/arch/hexagon/include/asm/uaccess.h
index e4127e4d6a5b..f000a382bc7f 100644
--- a/arch/hexagon/include/asm/uaccess.h
+++ b/arch/hexagon/include/asm/uaccess.h
@@ -36,7 +36,8 @@
36 * @addr: User space pointer to start of block to check 36 * @addr: User space pointer to start of block to check
37 * @size: Size of block to check 37 * @size: Size of block to check
38 * 38 *
39 * Context: User context only. This function may sleep. 39 * Context: User context only. This function may sleep if pagefaults are
40 * enabled.
40 * 41 *
41 * Checks if a pointer to a block of memory in user space is valid. 42 * Checks if a pointer to a block of memory in user space is valid.
42 * 43 *
diff --git a/arch/m32r/include/asm/uaccess.h b/arch/m32r/include/asm/uaccess.h
index 71adff209405..cac7014daef3 100644
--- a/arch/m32r/include/asm/uaccess.h
+++ b/arch/m32r/include/asm/uaccess.h
@@ -91,7 +91,8 @@ static inline void set_fs(mm_segment_t s)
91 * @addr: User space pointer to start of block to check 91 * @addr: User space pointer to start of block to check
92 * @size: Size of block to check 92 * @size: Size of block to check
93 * 93 *
94 * Context: User context only. This function may sleep. 94 * Context: User context only. This function may sleep if pagefaults are
95 * enabled.
95 * 96 *
96 * Checks if a pointer to a block of memory in user space is valid. 97 * Checks if a pointer to a block of memory in user space is valid.
97 * 98 *
@@ -155,7 +156,8 @@ extern int fixup_exception(struct pt_regs *regs);
155 * @x: Variable to store result. 156 * @x: Variable to store result.
156 * @ptr: Source address, in user space. 157 * @ptr: Source address, in user space.
157 * 158 *
158 * Context: User context only. This function may sleep. 159 * Context: User context only. This function may sleep if pagefaults are
160 * enabled.
159 * 161 *
160 * This macro copies a single simple variable from user space to kernel 162 * This macro copies a single simple variable from user space to kernel
161 * space. It supports simple types like char and int, but not larger 163 * space. It supports simple types like char and int, but not larger
@@ -175,7 +177,8 @@ extern int fixup_exception(struct pt_regs *regs);
175 * @x: Value to copy to user space. 177 * @x: Value to copy to user space.
176 * @ptr: Destination address, in user space. 178 * @ptr: Destination address, in user space.
177 * 179 *
178 * Context: User context only. This function may sleep. 180 * Context: User context only. This function may sleep if pagefaults are
181 * enabled.
179 * 182 *
180 * This macro copies a single simple value from kernel space to user 183 * This macro copies a single simple value from kernel space to user
181 * space. It supports simple types like char and int, but not larger 184 * space. It supports simple types like char and int, but not larger
@@ -194,7 +197,8 @@ extern int fixup_exception(struct pt_regs *regs);
194 * @x: Variable to store result. 197 * @x: Variable to store result.
195 * @ptr: Source address, in user space. 198 * @ptr: Source address, in user space.
196 * 199 *
197 * Context: User context only. This function may sleep. 200 * Context: User context only. This function may sleep if pagefaults are
201 * enabled.
198 * 202 *
199 * This macro copies a single simple variable from user space to kernel 203 * This macro copies a single simple variable from user space to kernel
200 * space. It supports simple types like char and int, but not larger 204 * space. It supports simple types like char and int, but not larger
@@ -274,7 +278,8 @@ do { \
274 * @x: Value to copy to user space. 278 * @x: Value to copy to user space.
275 * @ptr: Destination address, in user space. 279 * @ptr: Destination address, in user space.
276 * 280 *
277 * Context: User context only. This function may sleep. 281 * Context: User context only. This function may sleep if pagefaults are
282 * enabled.
278 * 283 *
279 * This macro copies a single simple value from kernel space to user 284 * This macro copies a single simple value from kernel space to user
280 * space. It supports simple types like char and int, but not larger 285 * space. It supports simple types like char and int, but not larger
@@ -568,7 +573,8 @@ unsigned long __generic_copy_from_user(void *, const void __user *, unsigned lon
568 * @from: Source address, in kernel space. 573 * @from: Source address, in kernel space.
569 * @n: Number of bytes to copy. 574 * @n: Number of bytes to copy.
570 * 575 *
571 * Context: User context only. This function may sleep. 576 * Context: User context only. This function may sleep if pagefaults are
577 * enabled.
572 * 578 *
573 * Copy data from kernel space to user space. Caller must check 579 * Copy data from kernel space to user space. Caller must check
574 * the specified block with access_ok() before calling this function. 580 * the specified block with access_ok() before calling this function.
@@ -588,7 +594,8 @@ unsigned long __generic_copy_from_user(void *, const void __user *, unsigned lon
588 * @from: Source address, in kernel space. 594 * @from: Source address, in kernel space.
589 * @n: Number of bytes to copy. 595 * @n: Number of bytes to copy.
590 * 596 *
591 * Context: User context only. This function may sleep. 597 * Context: User context only. This function may sleep if pagefaults are
598 * enabled.
592 * 599 *
593 * Copy data from kernel space to user space. 600 * Copy data from kernel space to user space.
594 * 601 *
@@ -606,7 +613,8 @@ unsigned long __generic_copy_from_user(void *, const void __user *, unsigned lon
606 * @from: Source address, in user space. 613 * @from: Source address, in user space.
607 * @n: Number of bytes to copy. 614 * @n: Number of bytes to copy.
608 * 615 *
609 * Context: User context only. This function may sleep. 616 * Context: User context only. This function may sleep if pagefaults are
617 * enabled.
610 * 618 *
611 * Copy data from user space to kernel space. Caller must check 619 * Copy data from user space to kernel space. Caller must check
612 * the specified block with access_ok() before calling this function. 620 * the specified block with access_ok() before calling this function.
@@ -626,7 +634,8 @@ unsigned long __generic_copy_from_user(void *, const void __user *, unsigned lon
626 * @from: Source address, in user space. 634 * @from: Source address, in user space.
627 * @n: Number of bytes to copy. 635 * @n: Number of bytes to copy.
628 * 636 *
629 * Context: User context only. This function may sleep. 637 * Context: User context only. This function may sleep if pagefaults are
638 * enabled.
630 * 639 *
631 * Copy data from user space to kernel space. 640 * Copy data from user space to kernel space.
632 * 641 *
@@ -677,7 +686,8 @@ unsigned long clear_user(void __user *mem, unsigned long len);
677 * strlen_user: - Get the size of a string in user space. 686 * strlen_user: - Get the size of a string in user space.
678 * @str: The string to measure. 687 * @str: The string to measure.
679 * 688 *
680 * Context: User context only. This function may sleep. 689 * Context: User context only. This function may sleep if pagefaults are
690 * enabled.
681 * 691 *
682 * Get the size of a NUL-terminated string in user space. 692 * Get the size of a NUL-terminated string in user space.
683 * 693 *
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h
index 62942fd12672..331b0d35f89c 100644
--- a/arch/microblaze/include/asm/uaccess.h
+++ b/arch/microblaze/include/asm/uaccess.h
@@ -178,7 +178,8 @@ extern long __user_bad(void);
178 * @x: Variable to store result. 178 * @x: Variable to store result.
179 * @ptr: Source address, in user space. 179 * @ptr: Source address, in user space.
180 * 180 *
181 * Context: User context only. This function may sleep. 181 * Context: User context only. This function may sleep if pagefaults are
182 * enabled.
182 * 183 *
183 * This macro copies a single simple variable from user space to kernel 184 * This macro copies a single simple variable from user space to kernel
184 * space. It supports simple types like char and int, but not larger 185 * space. It supports simple types like char and int, but not larger
@@ -290,7 +291,8 @@ extern long __user_bad(void);
290 * @x: Value to copy to user space. 291 * @x: Value to copy to user space.
291 * @ptr: Destination address, in user space. 292 * @ptr: Destination address, in user space.
292 * 293 *
293 * Context: User context only. This function may sleep. 294 * Context: User context only. This function may sleep if pagefaults are
295 * enabled.
294 * 296 *
295 * This macro copies a single simple value from kernel space to user 297 * This macro copies a single simple value from kernel space to user
296 * space. It supports simple types like char and int, but not larger 298 * space. It supports simple types like char and int, but not larger
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h
index bf8b32450ef6..9722357d2854 100644
--- a/arch/mips/include/asm/uaccess.h
+++ b/arch/mips/include/asm/uaccess.h
@@ -103,7 +103,8 @@ extern u64 __ua_limit;
103 * @addr: User space pointer to start of block to check 103 * @addr: User space pointer to start of block to check
104 * @size: Size of block to check 104 * @size: Size of block to check
105 * 105 *
106 * Context: User context only. This function may sleep. 106 * Context: User context only. This function may sleep if pagefaults are
107 * enabled.
107 * 108 *
108 * Checks if a pointer to a block of memory in user space is valid. 109 * Checks if a pointer to a block of memory in user space is valid.
109 * 110 *
@@ -138,7 +139,8 @@ extern u64 __ua_limit;
138 * @x: Value to copy to user space. 139 * @x: Value to copy to user space.
139 * @ptr: Destination address, in user space. 140 * @ptr: Destination address, in user space.
140 * 141 *
141 * Context: User context only. This function may sleep. 142 * Context: User context only. This function may sleep if pagefaults are
143 * enabled.
142 * 144 *
143 * This macro copies a single simple value from kernel space to user 145 * This macro copies a single simple value from kernel space to user
144 * space. It supports simple types like char and int, but not larger 146 * space. It supports simple types like char and int, but not larger
@@ -157,7 +159,8 @@ extern u64 __ua_limit;
157 * @x: Variable to store result. 159 * @x: Variable to store result.
158 * @ptr: Source address, in user space. 160 * @ptr: Source address, in user space.
159 * 161 *
160 * Context: User context only. This function may sleep. 162 * Context: User context only. This function may sleep if pagefaults are
163 * enabled.
161 * 164 *
162 * This macro copies a single simple variable from user space to kernel 165 * This macro copies a single simple variable from user space to kernel
163 * space. It supports simple types like char and int, but not larger 166 * space. It supports simple types like char and int, but not larger
@@ -177,7 +180,8 @@ extern u64 __ua_limit;
177 * @x: Value to copy to user space. 180 * @x: Value to copy to user space.
178 * @ptr: Destination address, in user space. 181 * @ptr: Destination address, in user space.
179 * 182 *
180 * Context: User context only. This function may sleep. 183 * Context: User context only. This function may sleep if pagefaults are
184 * enabled.
181 * 185 *
182 * This macro copies a single simple value from kernel space to user 186 * This macro copies a single simple value from kernel space to user
183 * space. It supports simple types like char and int, but not larger 187 * space. It supports simple types like char and int, but not larger
@@ -199,7 +203,8 @@ extern u64 __ua_limit;
199 * @x: Variable to store result. 203 * @x: Variable to store result.
200 * @ptr: Source address, in user space. 204 * @ptr: Source address, in user space.
201 * 205 *
202 * Context: User context only. This function may sleep. 206 * Context: User context only. This function may sleep if pagefaults are
207 * enabled.
203 * 208 *
204 * This macro copies a single simple variable from user space to kernel 209 * This macro copies a single simple variable from user space to kernel
205 * space. It supports simple types like char and int, but not larger 210 * space. It supports simple types like char and int, but not larger
@@ -498,7 +503,8 @@ extern void __put_user_unknown(void);
498 * @x: Value to copy to user space. 503 * @x: Value to copy to user space.
499 * @ptr: Destination address, in user space. 504 * @ptr: Destination address, in user space.
500 * 505 *
501 * Context: User context only. This function may sleep. 506 * Context: User context only. This function may sleep if pagefaults are
507 * enabled.
502 * 508 *
503 * This macro copies a single simple value from kernel space to user 509 * This macro copies a single simple value from kernel space to user
504 * space. It supports simple types like char and int, but not larger 510 * space. It supports simple types like char and int, but not larger
@@ -517,7 +523,8 @@ extern void __put_user_unknown(void);
517 * @x: Variable to store result. 523 * @x: Variable to store result.
518 * @ptr: Source address, in user space. 524 * @ptr: Source address, in user space.
519 * 525 *
520 * Context: User context only. This function may sleep. 526 * Context: User context only. This function may sleep if pagefaults are
527 * enabled.
521 * 528 *
522 * This macro copies a single simple variable from user space to kernel 529 * This macro copies a single simple variable from user space to kernel
523 * space. It supports simple types like char and int, but not larger 530 * space. It supports simple types like char and int, but not larger
@@ -537,7 +544,8 @@ extern void __put_user_unknown(void);
537 * @x: Value to copy to user space. 544 * @x: Value to copy to user space.
538 * @ptr: Destination address, in user space. 545 * @ptr: Destination address, in user space.
539 * 546 *
540 * Context: User context only. This function may sleep. 547 * Context: User context only. This function may sleep if pagefaults are
548 * enabled.
541 * 549 *
542 * This macro copies a single simple value from kernel space to user 550 * This macro copies a single simple value from kernel space to user
543 * space. It supports simple types like char and int, but not larger 551 * space. It supports simple types like char and int, but not larger
@@ -559,7 +567,8 @@ extern void __put_user_unknown(void);
559 * @x: Variable to store result. 567 * @x: Variable to store result.
560 * @ptr: Source address, in user space. 568 * @ptr: Source address, in user space.
561 * 569 *
562 * Context: User context only. This function may sleep. 570 * Context: User context only. This function may sleep if pagefaults are
571 * enabled.
563 * 572 *
564 * This macro copies a single simple variable from user space to kernel 573 * This macro copies a single simple variable from user space to kernel
565 * space. It supports simple types like char and int, but not larger 574 * space. It supports simple types like char and int, but not larger
@@ -815,7 +824,8 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
815 * @from: Source address, in kernel space. 824 * @from: Source address, in kernel space.
816 * @n: Number of bytes to copy. 825 * @n: Number of bytes to copy.
817 * 826 *
818 * Context: User context only. This function may sleep. 827 * Context: User context only. This function may sleep if pagefaults are
828 * enabled.
819 * 829 *
820 * Copy data from kernel space to user space. Caller must check 830 * Copy data from kernel space to user space. Caller must check
821 * the specified block with access_ok() before calling this function. 831 * the specified block with access_ok() before calling this function.
@@ -888,7 +898,8 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
888 * @from: Source address, in kernel space. 898 * @from: Source address, in kernel space.
889 * @n: Number of bytes to copy. 899 * @n: Number of bytes to copy.
890 * 900 *
891 * Context: User context only. This function may sleep. 901 * Context: User context only. This function may sleep if pagefaults are
902 * enabled.
892 * 903 *
893 * Copy data from kernel space to user space. 904 * Copy data from kernel space to user space.
894 * 905 *
@@ -1075,7 +1086,8 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n);
1075 * @from: Source address, in user space. 1086 * @from: Source address, in user space.
1076 * @n: Number of bytes to copy. 1087 * @n: Number of bytes to copy.
1077 * 1088 *
1078 * Context: User context only. This function may sleep. 1089 * Context: User context only. This function may sleep if pagefaults are
1090 * enabled.
1079 * 1091 *
1080 * Copy data from user space to kernel space. Caller must check 1092 * Copy data from user space to kernel space. Caller must check
1081 * the specified block with access_ok() before calling this function. 1093 * the specified block with access_ok() before calling this function.
@@ -1107,7 +1119,8 @@ extern size_t __copy_in_user_eva(void *__to, const void *__from, size_t __n);
1107 * @from: Source address, in user space. 1119 * @from: Source address, in user space.
1108 * @n: Number of bytes to copy. 1120 * @n: Number of bytes to copy.
1109 * 1121 *
1110 * Context: User context only. This function may sleep. 1122 * Context: User context only. This function may sleep if pagefaults are
1123 * enabled.
1111 * 1124 *
1112 * Copy data from user space to kernel space. 1125 * Copy data from user space to kernel space.
1113 * 1126 *
@@ -1329,7 +1342,8 @@ strncpy_from_user(char *__to, const char __user *__from, long __len)
1329 * strlen_user: - Get the size of a string in user space. 1342 * strlen_user: - Get the size of a string in user space.
1330 * @str: The string to measure. 1343 * @str: The string to measure.
1331 * 1344 *
1332 * Context: User context only. This function may sleep. 1345 * Context: User context only. This function may sleep if pagefaults are
1346 * enabled.
1333 * 1347 *
1334 * Get the size of a NUL-terminated string in user space. 1348 * Get the size of a NUL-terminated string in user space.
1335 * 1349 *
@@ -1398,7 +1412,8 @@ static inline long __strnlen_user(const char __user *s, long n)
1398 * strnlen_user: - Get the size of a string in user space. 1412 * strnlen_user: - Get the size of a string in user space.
1399 * @str: The string to measure. 1413 * @str: The string to measure.
1400 * 1414 *
1401 * Context: User context only. This function may sleep. 1415 * Context: User context only. This function may sleep if pagefaults are
1416 * enabled.
1402 * 1417 *
1403 * Get the size of a NUL-terminated string in user space. 1418 * Get the size of a NUL-terminated string in user space.
1404 * 1419 *
diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uaccess.h
index d64a7a62164f..9dd4cc47ddc7 100644
--- a/arch/s390/include/asm/uaccess.h
+++ b/arch/s390/include/asm/uaccess.h
@@ -98,7 +98,8 @@ static inline unsigned long extable_fixup(const struct exception_table_entry *x)
98 * @from: Source address, in user space. 98 * @from: Source address, in user space.
99 * @n: Number of bytes to copy. 99 * @n: Number of bytes to copy.
100 * 100 *
101 * Context: User context only. This function may sleep. 101 * Context: User context only. This function may sleep if pagefaults are
102 * enabled.
102 * 103 *
103 * Copy data from user space to kernel space. Caller must check 104 * Copy data from user space to kernel space. Caller must check
104 * the specified block with access_ok() before calling this function. 105 * the specified block with access_ok() before calling this function.
@@ -118,7 +119,8 @@ unsigned long __must_check __copy_from_user(void *to, const void __user *from,
118 * @from: Source address, in kernel space. 119 * @from: Source address, in kernel space.
119 * @n: Number of bytes to copy. 120 * @n: Number of bytes to copy.
120 * 121 *
121 * Context: User context only. This function may sleep. 122 * Context: User context only. This function may sleep if pagefaults are
123 * enabled.
122 * 124 *
123 * Copy data from kernel space to user space. Caller must check 125 * Copy data from kernel space to user space. Caller must check
124 * the specified block with access_ok() before calling this function. 126 * the specified block with access_ok() before calling this function.
@@ -264,7 +266,8 @@ int __get_user_bad(void) __attribute__((noreturn));
264 * @from: Source address, in kernel space. 266 * @from: Source address, in kernel space.
265 * @n: Number of bytes to copy. 267 * @n: Number of bytes to copy.
266 * 268 *
267 * Context: User context only. This function may sleep. 269 * Context: User context only. This function may sleep if pagefaults are
270 * enabled.
268 * 271 *
269 * Copy data from kernel space to user space. 272 * Copy data from kernel space to user space.
270 * 273 *
@@ -290,7 +293,8 @@ __compiletime_warning("copy_from_user() buffer size is not provably correct")
290 * @from: Source address, in user space. 293 * @from: Source address, in user space.
291 * @n: Number of bytes to copy. 294 * @n: Number of bytes to copy.
292 * 295 *
293 * Context: User context only. This function may sleep. 296 * Context: User context only. This function may sleep if pagefaults are
297 * enabled.
294 * 298 *
295 * Copy data from user space to kernel space. 299 * Copy data from user space to kernel space.
296 * 300 *
@@ -348,7 +352,8 @@ static inline unsigned long strnlen_user(const char __user *src, unsigned long n
348 * strlen_user: - Get the size of a string in user space. 352 * strlen_user: - Get the size of a string in user space.
349 * @str: The string to measure. 353 * @str: The string to measure.
350 * 354 *
351 * Context: User context only. This function may sleep. 355 * Context: User context only. This function may sleep if pagefaults are
356 * enabled.
352 * 357 *
353 * Get the size of a NUL-terminated string in user space. 358 * Get the size of a NUL-terminated string in user space.
354 * 359 *
diff --git a/arch/score/include/asm/uaccess.h b/arch/score/include/asm/uaccess.h
index ab66ddde777b..20a3591225cc 100644
--- a/arch/score/include/asm/uaccess.h
+++ b/arch/score/include/asm/uaccess.h
@@ -36,7 +36,8 @@
36 * @addr: User space pointer to start of block to check 36 * @addr: User space pointer to start of block to check
37 * @size: Size of block to check 37 * @size: Size of block to check
38 * 38 *
39 * Context: User context only. This function may sleep. 39 * Context: User context only. This function may sleep if pagefaults are
40 * enabled.
40 * 41 *
41 * Checks if a pointer to a block of memory in user space is valid. 42 * Checks if a pointer to a block of memory in user space is valid.
42 * 43 *
@@ -61,7 +62,8 @@
61 * @x: Value to copy to user space. 62 * @x: Value to copy to user space.
62 * @ptr: Destination address, in user space. 63 * @ptr: Destination address, in user space.
63 * 64 *
64 * Context: User context only. This function may sleep. 65 * Context: User context only. This function may sleep if pagefaults are
66 * enabled.
65 * 67 *
66 * This macro copies a single simple value from kernel space to user 68 * This macro copies a single simple value from kernel space to user
67 * space. It supports simple types like char and int, but not larger 69 * space. It supports simple types like char and int, but not larger
@@ -79,7 +81,8 @@
79 * @x: Variable to store result. 81 * @x: Variable to store result.
80 * @ptr: Source address, in user space. 82 * @ptr: Source address, in user space.
81 * 83 *
82 * Context: User context only. This function may sleep. 84 * Context: User context only. This function may sleep if pagefaults are
85 * enabled.
83 * 86 *
84 * This macro copies a single simple variable from user space to kernel 87 * This macro copies a single simple variable from user space to kernel
85 * space. It supports simple types like char and int, but not larger 88 * space. It supports simple types like char and int, but not larger
@@ -98,7 +101,8 @@
98 * @x: Value to copy to user space. 101 * @x: Value to copy to user space.
99 * @ptr: Destination address, in user space. 102 * @ptr: Destination address, in user space.
100 * 103 *
101 * Context: User context only. This function may sleep. 104 * Context: User context only. This function may sleep if pagefaults are
105 * enabled.
102 * 106 *
103 * This macro copies a single simple value from kernel space to user 107 * This macro copies a single simple value from kernel space to user
104 * space. It supports simple types like char and int, but not larger 108 * space. It supports simple types like char and int, but not larger
@@ -119,7 +123,8 @@
119 * @x: Variable to store result. 123 * @x: Variable to store result.
120 * @ptr: Source address, in user space. 124 * @ptr: Source address, in user space.
121 * 125 *
122 * Context: User context only. This function may sleep. 126 * Context: User context only. This function may sleep if pagefaults are
127 * enabled.
123 * 128 *
124 * This macro copies a single simple variable from user space to kernel 129 * This macro copies a single simple variable from user space to kernel
125 * space. It supports simple types like char and int, but not larger 130 * space. It supports simple types like char and int, but not larger
diff --git a/arch/tile/include/asm/uaccess.h b/arch/tile/include/asm/uaccess.h
index f41cb53cf645..a33276bf5ca1 100644
--- a/arch/tile/include/asm/uaccess.h
+++ b/arch/tile/include/asm/uaccess.h
@@ -78,7 +78,8 @@ int __range_ok(unsigned long addr, unsigned long size);
78 * @addr: User space pointer to start of block to check 78 * @addr: User space pointer to start of block to check
79 * @size: Size of block to check 79 * @size: Size of block to check
80 * 80 *
81 * Context: User context only. This function may sleep. 81 * Context: User context only. This function may sleep if pagefaults are
82 * enabled.
82 * 83 *
83 * Checks if a pointer to a block of memory in user space is valid. 84 * Checks if a pointer to a block of memory in user space is valid.
84 * 85 *
@@ -192,7 +193,8 @@ extern int __get_user_bad(void)
192 * @x: Variable to store result. 193 * @x: Variable to store result.
193 * @ptr: Source address, in user space. 194 * @ptr: Source address, in user space.
194 * 195 *
195 * Context: User context only. This function may sleep. 196 * Context: User context only. This function may sleep if pagefaults are
197 * enabled.
196 * 198 *
197 * This macro copies a single simple variable from user space to kernel 199 * This macro copies a single simple variable from user space to kernel
198 * space. It supports simple types like char and int, but not larger 200 * space. It supports simple types like char and int, but not larger
@@ -274,7 +276,8 @@ extern int __put_user_bad(void)
274 * @x: Value to copy to user space. 276 * @x: Value to copy to user space.
275 * @ptr: Destination address, in user space. 277 * @ptr: Destination address, in user space.
276 * 278 *
277 * Context: User context only. This function may sleep. 279 * Context: User context only. This function may sleep if pagefaults are
280 * enabled.
278 * 281 *
279 * This macro copies a single simple value from kernel space to user 282 * This macro copies a single simple value from kernel space to user
280 * space. It supports simple types like char and int, but not larger 283 * space. It supports simple types like char and int, but not larger
@@ -330,7 +333,8 @@ extern int __put_user_bad(void)
330 * @from: Source address, in kernel space. 333 * @from: Source address, in kernel space.
331 * @n: Number of bytes to copy. 334 * @n: Number of bytes to copy.
332 * 335 *
333 * Context: User context only. This function may sleep. 336 * Context: User context only. This function may sleep if pagefaults are
337 * enabled.
334 * 338 *
335 * Copy data from kernel space to user space. Caller must check 339 * Copy data from kernel space to user space. Caller must check
336 * the specified block with access_ok() before calling this function. 340 * the specified block with access_ok() before calling this function.
@@ -366,7 +370,8 @@ copy_to_user(void __user *to, const void *from, unsigned long n)
366 * @from: Source address, in user space. 370 * @from: Source address, in user space.
367 * @n: Number of bytes to copy. 371 * @n: Number of bytes to copy.
368 * 372 *
369 * Context: User context only. This function may sleep. 373 * Context: User context only. This function may sleep if pagefaults are
374 * enabled.
370 * 375 *
371 * Copy data from user space to kernel space. Caller must check 376 * Copy data from user space to kernel space. Caller must check
372 * the specified block with access_ok() before calling this function. 377 * the specified block with access_ok() before calling this function.
@@ -437,7 +442,8 @@ static inline unsigned long __must_check copy_from_user(void *to,
437 * @from: Source address, in user space. 442 * @from: Source address, in user space.
438 * @n: Number of bytes to copy. 443 * @n: Number of bytes to copy.
439 * 444 *
440 * Context: User context only. This function may sleep. 445 * Context: User context only. This function may sleep if pagefaults are
446 * enabled.
441 * 447 *
442 * Copy data from user space to user space. Caller must check 448 * Copy data from user space to user space. Caller must check
443 * the specified blocks with access_ok() before calling this function. 449 * the specified blocks with access_ok() before calling this function.
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
index ace9dec050b1..a8df874f3e88 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -74,7 +74,8 @@ static inline bool __chk_range_not_ok(unsigned long addr, unsigned long size, un
74 * @addr: User space pointer to start of block to check 74 * @addr: User space pointer to start of block to check
75 * @size: Size of block to check 75 * @size: Size of block to check
76 * 76 *
77 * Context: User context only. This function may sleep. 77 * Context: User context only. This function may sleep if pagefaults are
78 * enabled.
78 * 79 *
79 * Checks if a pointer to a block of memory in user space is valid. 80 * Checks if a pointer to a block of memory in user space is valid.
80 * 81 *
@@ -145,7 +146,8 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
145 * @x: Variable to store result. 146 * @x: Variable to store result.
146 * @ptr: Source address, in user space. 147 * @ptr: Source address, in user space.
147 * 148 *
148 * Context: User context only. This function may sleep. 149 * Context: User context only. This function may sleep if pagefaults are
150 * enabled.
149 * 151 *
150 * This macro copies a single simple variable from user space to kernel 152 * This macro copies a single simple variable from user space to kernel
151 * space. It supports simple types like char and int, but not larger 153 * space. It supports simple types like char and int, but not larger
@@ -240,7 +242,8 @@ extern void __put_user_8(void);
240 * @x: Value to copy to user space. 242 * @x: Value to copy to user space.
241 * @ptr: Destination address, in user space. 243 * @ptr: Destination address, in user space.
242 * 244 *
243 * Context: User context only. This function may sleep. 245 * Context: User context only. This function may sleep if pagefaults are
246 * enabled.
244 * 247 *
245 * This macro copies a single simple value from kernel space to user 248 * This macro copies a single simple value from kernel space to user
246 * space. It supports simple types like char and int, but not larger 249 * space. It supports simple types like char and int, but not larger
@@ -455,7 +458,8 @@ struct __large_struct { unsigned long buf[100]; };
455 * @x: Variable to store result. 458 * @x: Variable to store result.
456 * @ptr: Source address, in user space. 459 * @ptr: Source address, in user space.
457 * 460 *
458 * Context: User context only. This function may sleep. 461 * Context: User context only. This function may sleep if pagefaults are
462 * enabled.
459 * 463 *
460 * This macro copies a single simple variable from user space to kernel 464 * This macro copies a single simple variable from user space to kernel
461 * space. It supports simple types like char and int, but not larger 465 * space. It supports simple types like char and int, but not larger
@@ -479,7 +483,8 @@ struct __large_struct { unsigned long buf[100]; };
479 * @x: Value to copy to user space. 483 * @x: Value to copy to user space.
480 * @ptr: Destination address, in user space. 484 * @ptr: Destination address, in user space.
481 * 485 *
482 * Context: User context only. This function may sleep. 486 * Context: User context only. This function may sleep if pagefaults are
487 * enabled.
483 * 488 *
484 * This macro copies a single simple value from kernel space to user 489 * This macro copies a single simple value from kernel space to user
485 * space. It supports simple types like char and int, but not larger 490 * space. It supports simple types like char and int, but not larger
diff --git a/arch/x86/include/asm/uaccess_32.h b/arch/x86/include/asm/uaccess_32.h
index 3c03a5de64d3..7c8ad3451988 100644
--- a/arch/x86/include/asm/uaccess_32.h
+++ b/arch/x86/include/asm/uaccess_32.h
@@ -70,7 +70,8 @@ __copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
70 * @from: Source address, in kernel space. 70 * @from: Source address, in kernel space.
71 * @n: Number of bytes to copy. 71 * @n: Number of bytes to copy.
72 * 72 *
73 * Context: User context only. This function may sleep. 73 * Context: User context only. This function may sleep if pagefaults are
74 * enabled.
74 * 75 *
75 * Copy data from kernel space to user space. Caller must check 76 * Copy data from kernel space to user space. Caller must check
76 * the specified block with access_ok() before calling this function. 77 * the specified block with access_ok() before calling this function.
@@ -117,7 +118,8 @@ __copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
117 * @from: Source address, in user space. 118 * @from: Source address, in user space.
118 * @n: Number of bytes to copy. 119 * @n: Number of bytes to copy.
119 * 120 *
120 * Context: User context only. This function may sleep. 121 * Context: User context only. This function may sleep if pagefaults are
122 * enabled.
121 * 123 *
122 * Copy data from user space to kernel space. Caller must check 124 * Copy data from user space to kernel space. Caller must check
123 * the specified block with access_ok() before calling this function. 125 * the specified block with access_ok() before calling this function.
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c
index e2f5e21c03b3..91d93b95bd86 100644
--- a/arch/x86/lib/usercopy_32.c
+++ b/arch/x86/lib/usercopy_32.c
@@ -647,7 +647,8 @@ EXPORT_SYMBOL(__copy_from_user_ll_nocache_nozero);
647 * @from: Source address, in kernel space. 647 * @from: Source address, in kernel space.
648 * @n: Number of bytes to copy. 648 * @n: Number of bytes to copy.
649 * 649 *
650 * Context: User context only. This function may sleep. 650 * Context: User context only. This function may sleep if pagefaults are
651 * enabled.
651 * 652 *
652 * Copy data from kernel space to user space. 653 * Copy data from kernel space to user space.
653 * 654 *
@@ -668,7 +669,8 @@ EXPORT_SYMBOL(_copy_to_user);
668 * @from: Source address, in user space. 669 * @from: Source address, in user space.
669 * @n: Number of bytes to copy. 670 * @n: Number of bytes to copy.
670 * 671 *
671 * Context: User context only. This function may sleep. 672 * Context: User context only. This function may sleep if pagefaults are
673 * enabled.
672 * 674 *
673 * Copy data from user space to kernel space. 675 * Copy data from user space to kernel space.
674 * 676 *
diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c
index a28df5206d95..36c15a2889e4 100644
--- a/lib/strnlen_user.c
+++ b/lib/strnlen_user.c
@@ -84,7 +84,8 @@ static inline long do_strnlen_user(const char __user *src, unsigned long count,
84 * @str: The string to measure. 84 * @str: The string to measure.
85 * @count: Maximum count (including NUL character) 85 * @count: Maximum count (including NUL character)
86 * 86 *
87 * Context: User context only. This function may sleep. 87 * Context: User context only. This function may sleep if pagefaults are
88 * enabled.
88 * 89 *
89 * Get the size of a NUL-terminated string in user space. 90 * Get the size of a NUL-terminated string in user space.
90 * 91 *
@@ -113,7 +114,8 @@ EXPORT_SYMBOL(strnlen_user);
113 * strlen_user: - Get the size of a user string INCLUDING final NUL. 114 * strlen_user: - Get the size of a user string INCLUDING final NUL.
114 * @str: The string to measure. 115 * @str: The string to measure.
115 * 116 *
116 * Context: User context only. This function may sleep. 117 * Context: User context only. This function may sleep if pagefaults are
118 * enabled.
117 * 119 *
118 * Get the size of a NUL-terminated string in user space. 120 * Get the size of a NUL-terminated string in user space.
119 * 121 *