- 论坛徽章:
- 0
|
内核空间无法访问用户态地址。但是内核代码段中。include/asm-generic/uaccess.h#L79
78 #ifndef __copy_from_user
79 static inline __must_check long __copy_from_user(void *to,
80 const void __user * from, unsigned long n)
81 {
82 if (__builtin_constant_p(n)) {
83 switch(n) {
84 case 1:
85 *(u8 *)to = *(u8 __force *)from;
86 return 0;
87 case 2:
88 *(u16 *)to = *(u16 __force *)from;
89 return 0;
90 case 4:
91 *(u32 *)to = *(u32 __force *)from;
92 return 0;
93 #ifdef CONFIG_64BIT
94 case 8:
95 *(u64 *)to = *(u64 __force *)from;
96 return 0;
97 #endif
98 default:
99 break;
100 }
101 }
102
103 memcpy(to, (const void __force *)from, n);
104 return 0;
105 }
106 #endif
除了权限检查之外就是直接拷贝,网上看到了一些关于exception的说法,但是还是不能系统的理解。
|
|