Re: spinlocks() are severely broken in 2.2.X and 2.4.X for modules

Andi Kleen (ak@suse.de)
Sat, 1 Jul 2000 14:32:15 +0200


On Sat, Jul 01, 2000 at 11:59:11AM +0200, Manfred Spraul wrote:
> Andi Kleen wrote:
> >
> > I had it happen to me in the past too for my sysctl rewrite. In this
> > case it happened in the main kernel for a .sysctl -> .data relocation.
> > It happened in the main vmlinux. It seems to require some complex
> > input to trigger (it is not as simple as intersegment relocation does not
> > work). In my case I had a few hundred relocations and one was wrong
> > and caused crashes.
> >
>
> Is it possible to detect the problem automatically until binutils is
> fixed? (objdump + script)

Here is a quick hack. The results are slightly off because of section
padding though. It only works on object files or modules (vmlinux doesn't
have any reloc records)

NAME SSIZE NUMSPIN NUMREF NUMREL
kernel/acct.o 0 0 0 0
kernel/capability.o 112 8 8 16
kernel/dma.o 0 0 0 0
kernel/exec_domain.o 14 1 1 2
kernel/exit.o 334 23.85714 22 44
kernel/fork.o 192 13.71428 15 30
kernel/info.o 0 0 0 0
kernel/itimer.o 0 0 0 0
kernel/kernel.o 2356 168.2857 162.5 325
^^^^^^^^^^^^^^^^^
this looks bogus
kernel/ksyms.o 0 0 0 0
kernel/module.o 70 5 5 10
kernel/panic.o 0 0 0 0
kernel/printk.o 228 16.28571 16 32
kernel/resource.o 0 0 0 0
kernel/sched.o 768 54.85714 53 106
kernel/signal.o 315 22.5 17 34
kernel/softirq.o 0 0 0 0
kernel/sysctl.o 34 2.428571 3 6
kernel/sys.o 220 15.71428 18 36
kernel/time.o 69 4.928571 4.5 9

-Andi

#!/usr/bin/perl

$SPINSIZE = 14;

while ($fn = $ARGV[0]) {
open(P,"objdump --section-headers $fn |") || die("no $fn: $!\n");

$size = 0;
while (<P>) {
if (/\d\s+.text\.lock\s+([a-f0-9]+)/) {
$size = hex($1);
last;
}
}
close P;

$numrel = 0;
open(P,"objdump --reloc --section=.text.lock $fn |") || die "no $fn: $!\n";
while (<P>) {
$numrel++ if (/^0/);
}

$numref = $numrel / 2;
$numspin = $size / $SPINSIZE;

write;

shift(@ARGV);
}

format STDOUT_TOP =
NAME SSIZE NUMSPIN NUMREF NUMREL
.

format STDOUT =
@<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<< @<<<<<<< @<<<<<<< @<<<<<<<
$fn $size $numspin $numref $numrel
.

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