Re: [PATCH] Check for breakpoint in text_poke to eliminate bug_on

From: Pekka Paalanen
Date: Sun Apr 20 2008 - 16:18:55 EST


On Sun, 20 Apr 2008 15:44:40 -0400
Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxx> wrote:

> Can you test this new version ? The check was buggy when it fell on a
> code boundary : the addr - 1 wan't always a valid address.
>

Sorry, still the same. Btw. I had to apply your patch by hand on top of
your previous patch, and it ended up as just

--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -520,11 +520,6 @@ void *__kprobes text_poke(void *addr, const void *opcode, size_t len)
struct page *pages[2];
int i;

- if (*((uint8_t *)addr - 1) != BREAKPOINT_INSTRUCTION) {
- BUG_ON(len > sizeof(long));
- BUG_ON((((long)addr + len - 1) & ~(sizeof(long) - 1))
- - ((long)addr & ~(sizeof(long) - 1)));
- }
if (!core_kernel_text((unsigned long)addr)) {

Now I took a log of echo 0, echo 1 cycle with 2.6.24-gentoo-r1-trace
kernel:
[ 203.448534] CPU 1 is now offline
[ 203.448975] SMP alternatives: switching to UP code
[ 217.888298] SMP alternatives: switching to SMP code
[ 217.889285] Booting processor 1/2 APIC 0x1
[ 217.901404] Initializing CPU#1
[ 217.982081] Calibrating delay using timer specific routine.. 3991.35 BogoMIPS (lpj=6650167)
[ 217.982088] CPU: L1 I cache: 32K, L1 D cache: 32K
[ 217.982089] CPU: L2 cache: 4096K
[ 217.982091] CPU: Physical Processor ID: 0
[ 217.982092] CPU: Processor Core ID: 1
[ 217.982593] Intel(R) Core(TM)2 Duo CPU T7300 @ 2.00GHz stepping 0a
[ 217.982644] Switched to high resolution mode on CPU 1

And the failing log from the latest try is:

[ 87.064970] CPU 1 is now offline
[ 87.065311] lockdep: fixing up alternatives.
[ 87.065694] SMP alternatives: switching to UP code
[ 97.192213] lockdep: fixing up alternatives.
[ 97.192532] SMP alternatives: switching to SMP code
[ 97.203495] Booting processor 1/1 ip 6000
and it hangs and reboots.

Does it make sense to bisect on sched-devel/latest?
I think I could try that after a sleep&work cycle.
Luckily this bug is easy to reproduce.


Thanks.

--
Pekka Paalanen
http://www.iki.fi/pq/
--
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/