Fix __copy_{to,from}_user_inatomic
PATCH 1/1 Fix __copy_{to,from}_user_inatomic
From: Franck Bui-Huu <[email protected]>
These functions are aliases to __copy_{to,from}_user resp but they are not allowed to sleep. Therefore might_sleep() must not be used by their implementions.
--- include/asm-mips/uaccess.h | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
include/asm-mips/uaccess.h +2 -4
@@ -407,7 +407,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);* @from: Source address, in kernel space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. * * Copy data from kernel space to user space. Caller must check * the specified block with access_ok() before calling this function.
@@ -421,7 +421,6 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);const void *__cu_from; \long __cu_len; \ \ -might_sleep (); \ __cu_to = (to); \ __cu_from = (from); \ __cu_len = (n); \
@@ -490,7 +489,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);* @from: Source address, in user space. * @n: Number of bytes to copy. * -* Context: User context only. This function may sleep. +* Context: User context only. * * Copy data from user space to kernel space. Caller must check * the specified block with access_ok() before calling this function.
@@ -507,7 +506,6 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n); const void __user *__cu_from; \long __cu_len; \ \ -might_sleep (); \ __cu_to = (to); \ __cu_from = (from); \ __cu_len = (n); \
Signature · 1 line
1.4.4.3.ge6d4
Quoted 3 lines · Franck Bui-Huu
These functions are aliases to __copy_{to,from}_user resp but they are not allowed to sleep. Therefore
might_sleep()must not be used by their implementions.
The _inatomic functions are know to buggy but this doesn't quite fix the whole issues with them. On error __copy_from_user_inatomic should not clear the non-copied part of the destination buffer. See 01408c4939479ec46c15aa7ef6e2406be50eeeca and 7c12d81134b130ccd4c286b434ca48c4cda71a2f for the rationale.
Ralf
Quoted 8 lines · Ralf Baechle
Quoted 3 lines · Franck Bui-Huu
These functions are aliases to __copy_{to,from}_user resp but they are not allowed to sleep. Therefore
might_sleep()must not be used by their implementions.The
_inatomicfunctions are know to buggy but this doesn't quite fix the whole issues with them.
ok so the patch's should have been: "Fix console warnings triggered by __copy_{to,from}_user_inatomic()"
Quoted 4 lines
On error
__copy_from_user_inatomicshould not clear the non-copied part of the destination buffer. See01408c4939479ec46c15aa7ef6e2406be50eeecaand7c12d81134b130ccd4c286b434ca48c4cda71a2ffor the rationale.
I'll try to take a look at it.
Thanks
Signature · 1 line
Franck
Quoted 3 lines · Franck Bui-Huu
These functions are aliases to __copy_{to,from}_user resp but they are not allowed to sleep. Therefore
might_sleep()must not be used by their implementions.
This changes CONFIG_PREEMPT_VOLUNTARY behavior. In this case might_sleep() is not just an annotation.
Well, so currently CONFIG_PREEMPT_VOLUNTARY seems broken. Maybe we need separete functions anyway.
---
Atsushi Nemoto
Quoted 12 lines · Atsushi Nemoto
Date: Sat, 17 Feb 2007 01:12:20 +0900 (JST)
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: [PATCH] Fix __copy_{to,from}_user_inatomic
From: Atsushi Nemoto <[email protected]>
Content-Type: Text/Plain; charset=us-asciiQuoted 3 lines · Franck Bui-Huu
These functions are aliases to __copy_{to,from}_user resp but they are not allowed to sleep. Therefore
might_sleep()must not be used by their implementions.
Quoted 5 lines
This changes
CONFIG_PREEMPT_VOLUNTARYbehavior. In this casemight_sleep()is not just an annotation.Well, so currently
CONFIG_PREEMPT_VOLUNTARYseems broken. Maybe we need separete functions anyway.
The issue needed to be tackled so while suboptimal I've added a chainsawed version of memcpy to provide __copy_from_user_inatomic. Not elegant but hopefully that will be cleaned soon. memcpy could use a general ovehaul anyway.
Ralf