Port-sparc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

SIGBUS delivers wrong si_addr



Hey folks,

after some recent discussion we discovered that the siginfo send for
SIGBUS is wrong on most archs (it sends the code address of the fault,
instead of the faulting data address). I fixed that for sparc64, but I
don't know enough about older MMUs to fix it for sparc as well.

The code in question is in sys/arch/sparc/sparc/trap.c around line 577:

                sig = SIGBUS;
                KSI_INIT_TRAP(&ksi);
                ksi.ksi_trap = type;
                ksi.ksi_code = BUS_ADRALN;
                ksi.ksi_addr = (void *)pc;
                break;

The (void*)pc needs to be replaced with the data address.

The only way I found so far would be to split the emulation function
fixalign() in two parts (first part to retrieve the address, second
one to fixup) and then use the relevant part here as well.

Is there some easier way?

The whole thing can be tested easily by doing:

 cd /usr/tests/lib/libc/gen
 atf-run t_siginfo | atf-report

or for debugging purposes, just do the former and save the output, the failing
part of the test case reports the expected address and the si_addr value.

Martin


Home | Main Index | Thread Index | Old Index