From: Andrew Morton probe_kernel_address() purports to be generic, only it forgot to select KERNEL_DS, so it presently won't work right on all architectures. Signed-off-by: Andrew Morton --- include/linux/uaccess.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff -puN include/linux/uaccess.h~probe_kernel_address-needs-to-do-set_fs include/linux/uaccess.h --- a/include/linux/uaccess.h~probe_kernel_address-needs-to-do-set_fs +++ a/include/linux/uaccess.h @@ -30,14 +30,23 @@ static inline unsigned long __copy_from_ * do_page_fault() doesn't attempt to take mmap_sem. This makes * probe_kernel_address() suitable for use within regions where the caller * already holds mmap_sem, or other locks which nest inside mmap_sem. + * + * This must be a macro because __get_user() needs to know the types of the + * args. + * + * We don't include enough header files to be able to do the set_fs(). We + * require that the probe_kernel_address() caller will do that. */ #define probe_kernel_address(addr, retval) \ ({ \ long ret; \ + mm_segment_t old_fs = get_fs(); \ \ + set_fs(KERNEL_DS); \ inc_preempt_count(); \ ret = __get_user(retval, addr); \ dec_preempt_count(); \ + set_fs(old_fs); \ ret; \ }) _