diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2012-03-23 10:35:05 -0400 |
---|---|---|
committer | Jason Wessel <jason.wessel@windriver.com> | 2012-03-29 18:41:25 -0400 |
commit | 3751d3e85cf693e10e2c47c03c8caa65e171099b (patch) | |
tree | 65d123dac17103f6862831bcb4271b263805fd9f /drivers/misc | |
parent | 98b54aa1a2241b59372468bd1e9c2d207bdba54b (diff) |
x86,kgdb: Fix DEBUG_RODATA limitation using text_poke()
There has long been a limitation using software breakpoints with a
kernel compiled with CONFIG_DEBUG_RODATA going back to 2.6.26. For
this particular patch, it will apply cleanly and has been tested all
the way back to 2.6.36.
The kprobes code uses the text_poke() function which accommodates
writing a breakpoint into a read-only page. The x86 kgdb code can
solve the problem similarly by overriding the default breakpoint
set/remove routines and using text_poke() directly.
The x86 kgdb code will first attempt to use the traditional
probe_kernel_write(), and next try using a the text_poke() function.
The break point install method is tracked such that the correct break
point removal routine will get called later on.
Cc: x86@kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: stable@vger.kernel.org # >= 2.6.36
Inspried-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/kgdbts.c | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c index d087456ba089..3aa9a969b373 100644 --- a/drivers/misc/kgdbts.c +++ b/drivers/misc/kgdbts.c | |||
@@ -968,22 +968,6 @@ static void run_singlestep_break_test(void) | |||
968 | kgdbts_break_test(); | 968 | kgdbts_break_test(); |
969 | } | 969 | } |
970 | 970 | ||
971 | static void test_debug_rodata(void) | ||
972 | { | ||
973 | #ifdef CONFIG_DEBUG_RODATA | ||
974 | /* Until there is an api to write to read-only text segments, use | ||
975 | * HW breakpoints for the remainder of any tests, else print a | ||
976 | * failure message if hw breakpoints do not work. | ||
977 | */ | ||
978 | if (!(arch_kgdb_ops.flags & KGDB_HW_BREAKPOINT && hwbreaks_ok)) { | ||
979 | eprintk("kgdbts: HW breakpoints BROKEN, ending tests\n"); | ||
980 | return; | ||
981 | } | ||
982 | force_hwbrks = 1; | ||
983 | v1printk("kgdbts:Using HW breakpoints for SW breakpoint tests\n"); | ||
984 | #endif /* CONFIG_DEBUG_RODATA */ | ||
985 | } | ||
986 | |||
987 | static void kgdbts_run_tests(void) | 971 | static void kgdbts_run_tests(void) |
988 | { | 972 | { |
989 | char *ptr; | 973 | char *ptr; |
@@ -1016,7 +1000,6 @@ static void kgdbts_run_tests(void) | |||
1016 | v1printk("kgdbts:RUN access write breakpoint test\n"); | 1000 | v1printk("kgdbts:RUN access write breakpoint test\n"); |
1017 | run_hw_break_test(0); | 1001 | run_hw_break_test(0); |
1018 | } | 1002 | } |
1019 | test_debug_rodata(); | ||
1020 | 1003 | ||
1021 | /* required internal KGDB tests */ | 1004 | /* required internal KGDB tests */ |
1022 | v1printk("kgdbts:RUN plant and detach test\n"); | 1005 | v1printk("kgdbts:RUN plant and detach test\n"); |