Closed shahab-vahedi closed 3 years ago
@shahab-vahedi may we move this one in https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/issues for better tracking as that's what we already have in existing tools but not in a WIP branch?
So there are 2 problems here
That would fix the kernel crash and kill the offending user process.
@shahab-vahedi can u please upload the rootfs for this issue here.
I tried NFS mounting host from qemu, but thats being rejected due to invalid port numbers from ARC side (not sure of this is a qemu problem or something else).
Apr 23 09:06:50 rpc.mountd[1322]: refused mount request from xxx: illegal port 33880
long story short I can't objdump the target libs on target or host, and hence need access to them externally (as stated above)
@shahab-vahedi may we move this one in https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/issues for better tracking as that's what we already have in existing tools but not in a WIP branch?
My personal opinion is that if @shahab-vahedi thinks this is a gdb issue, let it stay under his "umbrella" until that is no longer the case, otherwise everything should be in the toolchain.
Sorry pressed close by mistake
@shahab-vahedi may we move this one in https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/issues for better tracking as that's what we already have in existing tools but not in a WIP branch?
My personal opinion is that if @shahab-vahedi thinks this is a gdb issue, let it stay under his "umbrella" until that is no longer the case, otherwise everything should be in the toolchain.
Thanks @cupertinomiranda . That was exactly my goal. When it is solved, I will move it.
Changing the code in linux-5.6/arch/arc/kernel/entry.S
:
80811e48: 208c 9dc6 cmp r8,439
80811e4c: 20ca 0f8d ffff ffda mov.hi r0,0xffffffda
80811e54: 0010 000d bhi 16 ;80811e64 <EV_Trap+0xc4>
to
80811e48: 208c 9dc6 cmp r8,439
80811e4c: 20ca 0f8a ffff ffda mov.ge r0,0xffffffda
80811e54: 0010 000a bge 16 ;80811e64 <EV_Trap+0xc4>
Solves the issue. Thank you @vineetgarc for all the support.
Just for completeness whats going on here is
There are 2 faccesat syscall in linux kernel.
glibc 2.33 is "5.10 kernel capable" meaning it has "fast paths" for 5.10 but falls back if the kernel lacks capabilities (this is generic glibc for all arches). so glibc faccessat() lib call first tries to invoke 439 (and if kernel returns -ENOSYS it would fall back to legacy 48).
ARC Linux (v5.6) being used for this exercise has max syscalls supported 0 to 438, so when it sees syscall 439 it needs to return -ENOSYS so glibc falls back to slow path syscall 48.
But due to off by one kernel bug, it proceeds to handle syscall 439 which causes a null pointer deref and hence the crash.
Patch posted to lkml, will be sent Linus way soon ! http://lists.infradead.org/pipermail/linux-snps-arc/2021-April/005008.html
@shahab-vahedi is this still an issue ?
Not from my side. You know when the patch will land. So you will be a good judge when to close this.
Fix merged in v5.13-rc2 3433adc8bd09fc9f29b8baddf33b4ecd1ecd2cdc
Runing gdb alone is fine.
But running it with a debugee crashes the simulator (both QEMU and nSIM):
nSIM flags
QEMU flags
environment
vmlinuxaa.zip vmlinuxab.zip vmlinuxac.zip
abrodkin_linux_patch.zip