mirror of https://gitee.com/openkylin/linux.git
x86: some lock annotations for user copy paths, v3
- add annotation back to clear_user() - change probe_kernel_address() to _inatomic*() method Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
3ee1afa308
commit
1d18ef4895
|
@ -148,6 +148,7 @@ do { \
|
||||||
unsigned long
|
unsigned long
|
||||||
clear_user(void __user *to, unsigned long n)
|
clear_user(void __user *to, unsigned long n)
|
||||||
{
|
{
|
||||||
|
might_fault();
|
||||||
if (access_ok(VERIFY_WRITE, to, n))
|
if (access_ok(VERIFY_WRITE, to, n))
|
||||||
__do_clear_user(to, n);
|
__do_clear_user(to, n);
|
||||||
return n;
|
return n;
|
||||||
|
|
|
@ -267,7 +267,6 @@ extern void __put_user_8(void);
|
||||||
#define __put_user_size(x, ptr, size, retval, errret) \
|
#define __put_user_size(x, ptr, size, retval, errret) \
|
||||||
do { \
|
do { \
|
||||||
retval = 0; \
|
retval = 0; \
|
||||||
might_fault(); \
|
|
||||||
__chk_user_ptr(ptr); \
|
__chk_user_ptr(ptr); \
|
||||||
switch (size) { \
|
switch (size) { \
|
||||||
case 1: \
|
case 1: \
|
||||||
|
@ -320,7 +319,6 @@ do { \
|
||||||
#define __get_user_size(x, ptr, size, retval, errret) \
|
#define __get_user_size(x, ptr, size, retval, errret) \
|
||||||
do { \
|
do { \
|
||||||
retval = 0; \
|
retval = 0; \
|
||||||
might_fault(); \
|
|
||||||
__chk_user_ptr(ptr); \
|
__chk_user_ptr(ptr); \
|
||||||
switch (size) { \
|
switch (size) { \
|
||||||
case 1: \
|
case 1: \
|
||||||
|
|
|
@ -78,7 +78,7 @@ static inline unsigned long __copy_from_user_nocache(void *to,
|
||||||
\
|
\
|
||||||
set_fs(KERNEL_DS); \
|
set_fs(KERNEL_DS); \
|
||||||
pagefault_disable(); \
|
pagefault_disable(); \
|
||||||
ret = __get_user(retval, (__force typeof(retval) __user *)(addr)); \
|
ret = __copy_from_user_inatomic((__force typeof(retval) __user *)(addr), &(retval), sizeof(retval)); \
|
||||||
pagefault_enable(); \
|
pagefault_enable(); \
|
||||||
set_fs(old_fs); \
|
set_fs(old_fs); \
|
||||||
ret; \
|
ret; \
|
||||||
|
|
Loading…
Reference in New Issue