ldconfig segfault on RZ/Five was Re: Preparing isar-cip-core for RZ/Five


Pavel Machek
 

Hi!

I tried, but installation fails - illegal instruction.
Yeah, ldconfig is needed for installation. But I get a segfaulting gcc
binary.
It crashes rather soon after startup, so I was able to trace complete
path.

But I do have slightly different results then you (I think; I'm far
from risc-v expert). I did a breakpoint:

Breakpoint 1, 0x00000000000385d4 in ?? ()
I believe it should not end at 0x00000000000385d4 at all. The
0x000000000001537e jal instruction should end up calling 0x3806a
AFAICT, but it calls 0x385d4 instead. It happens during
single-stepping, so it should not be anything subtle.

(gdb) disassemble $pc,+0x20
Dump of assembler code from 0x1537c to 0x1539c:
=> 0x000000000001537c: mv a0,a4
0x000000000001537e: jal ra,0x3806a
0x0000000000015382: auipc a5,0x8a
0x0000000000015386: addi a5,a5,1342 # 0x9f8c0
0x000000000001538a: ld a4,0(a5)
0x000000000001538c: beqz a4,0x153f0
0x000000000001538e: jal ra,0x38abe
0x0000000000015392: ld a0,0(s6)
0x0000000000015396: auipc s7,0x85
0x000000000001539a: ld s7,-406(s7) # 0x9a200
End of assembler dump.
(gdb)
(gdb) stepi
0x000000000001537e in ?? ()
(gdb)

Program received signal SIGILL, Illegal instruction.
0x00000000000385d4 in ?? ()
(gdb)

Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany


Pavel Machek
 

Hi!

Hmm, seems the issue persists:
:-(. Do you get gcc faulting, too?
I tried, but installation fails - illegal instruction.
Yeah, ldconfig is needed for installation. But I get a segfaulting gcc
binary.

root@demo:~# ldconfig

[ 297.146728] ldconfig[497]: unhandled signal 4 code 0x1 at 0x00000000000380c8 in ldconfig[10000+83000]
...
(gdb) disassemble $pc,+0x10
Dump of assembler code from 0x380c8 to 0x380d8:
=> 0x00000000000380c8: auipc a2,0x66
0x00000000000380cc: addi a2,a2,2000 # 0x9e898
0x00000000000380d0: sd a0,0(a2)
auipc is something rather simple. a2 = pc + 0x66 << something. Not
sure how it could fault. Plus we get "illegal instruction", suggesting
it is not some other fault.

Could some kind of self-modifying code be involved? I guess some kind
of debugging/watchpoint is not probable.
No idea - but why should ldconfig be self-modifying?
No idea.

But I do have slightly different results then you (I think; I'm far
from risc-v expert). I did a breakpoint:

Breakpoint 1, 0x00000000000385d4 in ?? ()
(gdb)

Dump of assembler code from 0x385d4 to 0x385f4:
=> 0x00000000000385d4: lb zero,81(t1)
0x00000000000385d8: andi a1,a1,25
0x00000000000385da: sd zero,24(sp)
0x00000000000385dc: sd zero,32(sp)

If I do the stepi, it will give the illegal instruction, because,
well, we are in the middle of the auipc instruction:

(gdb) disassemble $pc-0x10,+0x20
Dump of assembler code from 0x385c4 to 0x385e4:
0x00000000000385c4: .4byte 0x4881f753
0x00000000000385c8: li a6,0
0x00000000000385ca: li a5,0
0x00000000000385cc: addi a3,a1,920
0x00000000000385d0: mv a2,s8
0x00000000000385d2: auipc a0,0x3f
0x00000000000385d6: addi a0,a0,-1890 # 0x76e70
0x00000000000385da: sd zero,24(sp)
0x00000000000385dc: sd zero,32(sp)
0x00000000000385de: sb t3,20(sp)
0x00000000000385e2: sd s7,40(sp)
End of assembler dump.
(gdb)

Weird. But it explains sigill when executing auipc does not result in
segfault...

Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany