[PATCH] use probe_kernel_address in Dwarf2 unwinder

From: Jan Beulich
Date: Wed Nov 29 2006 - 06:13:38 EST


Use probe_kernel_address() instead of __get_user() in Dwarf2 unwinder.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- linux-2.6.19-rc6/kernel/unwind.c 2006-11-29 10:04:11.000000000 +0100
+++ 2.6.19-rc6-unwind-probe_kernel_address/kernel/unwind.c 2006-11-29 10:22:16.000000000 +0100
@@ -14,8 +14,8 @@
#include <linux/bootmem.h>
#include <linux/sort.h>
#include <linux/stop_machine.h>
+#include <linux/uaccess.h>
#include <asm/sections.h>
-#include <asm/uaccess.h>
#include <asm/unaligned.h>

extern char __start_unwind[], __end_unwind[];
@@ -550,7 +550,7 @@ static unsigned long read_pointer(const
return 0;
}
if ((ptrType & DW_EH_PE_indirect)
- && __get_user(value, (unsigned long *)value))
+ && probe_kernel_address((unsigned long *)value, value))
return 0;
*pLoc = ptr.p8;

@@ -981,18 +981,18 @@ int unwind(struct unwind_frame_info *fra
& (sizeof(unsigned long) - 1))) {
unsigned long link;

- if (!__get_user(link,
- (unsigned long *)(UNW_FP(frame)
- + FRAME_LINK_OFFSET))
+ if (!probe_kernel_address((unsigned long *)(UNW_FP(frame)
+ + FRAME_LINK_OFFSET),
+ link)
# if FRAME_RETADDR_OFFSET < 0
&& link > bottom && link < UNW_FP(frame)
# else
&& link > UNW_FP(frame) && link < bottom
# endif
&& !(link & (sizeof(link) - 1))
- && !__get_user(UNW_PC(frame),
- (unsigned long *)(UNW_FP(frame)
- + FRAME_RETADDR_OFFSET))) {
+ && !probe_kernel_address((unsigned long *)(UNW_FP(frame)
+ + FRAME_RETADDR_OFFSET))
+ UNW_PC(frame)) {
UNW_SP(frame) = UNW_FP(frame) + FRAME_RETADDR_OFFSET
# if FRAME_RETADDR_OFFSET < 0
-
@@ -1103,7 +1103,7 @@ int unwind(struct unwind_frame_info *fra
return -EIO;
switch(reg_info[i].width) {
#define CASE(n) case sizeof(u##n): \
- __get_user(FRAME_REG(i, u##n), (u##n *)addr); \
+ probe_kernel_address((u##n *)addr, FRAME_REG(i, u##n)); \
break
CASES;
#undef CASE


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/