提交 b4b8ac52 编写于 作者: J Jason Wessel 提交者: Ingo Molnar

kgdb: fix optional arch functions and probe_kernel_*

Fix two regressions dealing with the kgdb core.

1) kgdb_skipexception and kgdb_post_primary_code are optional
functions that are only required on archs that need special exception
fixups.

2) The kernel address space scope must be set on any probe_kernel_*
function or archs such as ARCH=arm will not allow access to the kernel
memory space.  As an example, it is required to allow the full kernel
address space is when you the kernel debugger to inspect a system
call.
Signed-off-by: NJason Wessel <jason.wessel@windriver.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 64e9ee30
...@@ -200,6 +200,17 @@ int __weak kgdb_arch_init(void) ...@@ -200,6 +200,17 @@ int __weak kgdb_arch_init(void)
return 0; return 0;
} }
int __weak kgdb_skipexception(int exception, struct pt_regs *regs)
{
return 0;
}
void __weak
kgdb_post_primary_code(struct pt_regs *regs, int e_vector, int err_code)
{
return;
}
/** /**
* kgdb_disable_hw_debug - Disable hardware debugging while we in kgdb. * kgdb_disable_hw_debug - Disable hardware debugging while we in kgdb.
* @regs: Current &struct pt_regs. * @regs: Current &struct pt_regs.
......
...@@ -17,11 +17,14 @@ ...@@ -17,11 +17,14 @@
long probe_kernel_read(void *dst, void *src, size_t size) long probe_kernel_read(void *dst, void *src, size_t size)
{ {
long ret; long ret;
mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS);
pagefault_disable(); pagefault_disable();
ret = __copy_from_user_inatomic(dst, ret = __copy_from_user_inatomic(dst,
(__force const void __user *)src, size); (__force const void __user *)src, size);
pagefault_enable(); pagefault_enable();
set_fs(old_fs);
return ret ? -EFAULT : 0; return ret ? -EFAULT : 0;
} }
...@@ -39,10 +42,13 @@ EXPORT_SYMBOL_GPL(probe_kernel_read); ...@@ -39,10 +42,13 @@ EXPORT_SYMBOL_GPL(probe_kernel_read);
long probe_kernel_write(void *dst, void *src, size_t size) long probe_kernel_write(void *dst, void *src, size_t size)
{ {
long ret; long ret;
mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS);
pagefault_disable(); pagefault_disable();
ret = __copy_to_user_inatomic((__force void __user *)dst, src, size); ret = __copy_to_user_inatomic((__force void __user *)dst, src, size);
pagefault_enable(); pagefault_enable();
set_fs(old_fs);
return ret ? -EFAULT : 0; return ret ? -EFAULT : 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册