foss-for-synopsys-dwc-arc-processors / toolchain

Repository containing releases of prebuilt GNU toolchains for DesignWare ARC Processors from Synopsys (available from "releases" link below).
http://www.synopsys.com/IP/ProcessorIP/ARCProcessors/Pages/default.aspx
GNU General Public License v3.0
92 stars 48 forks source link

[arc64] LMBench lat_rpc segfaulting #378

Closed vineetgarc closed 3 years ago

vineetgarc commented 3 years ago
# ./lat_rpc -S localhost
potentially unexpected fatal signal 11.
Path: /lmbench/bin/arc64/lat_rpc
CPU: 0 PID: 62 Comm: lat_rpc Not tainted 5.6.0-00224-g8e1b159f529e #39
Invalid Read @ 0x00000001 by insn @ 0x2011f110
  @off 0x6c110 in [/lib/libc-2.32.so]  VMA: 0x200b3000 to 0x201b8000
ECR: 0x00050100 EFA: 0x00000001 ERET: 0x2011f110
STAT32: 0x80081082 [IE U     ]   BTA: 0x2011b87c
 SP: 0x5fffefe8  FP: 0x00000000 BLK: 0x20103242
r00: 0x00000001 r01: 0x00000002 r02: 0x00000001
r03: 0x20101eb0 r04: 0x00000001 r05: 0x00000001
r06: 0x00000000 r07: 0x00000000 r08: 0x00000001
r09: 0x2019d8b0 r10: 0x20039fc4 r11: 0x5ffff0f0
r12: 0x2019d6d0 r13: 0x2019d748 r14: 0x5ffff588
r15: 0x00000000 r16: 0x00000000 r17: 0x5ffff708
r18: 0x20039fc0 r19: 0xffffffff r20: 0x201ba010
r21: 0x00000000 r22: 0x00000000 r23: 0x20039fc0
r24: 0x00000bd0 r25: 0x00000073
Segmentation fault

The issue seems like strlen is called with pointer 1

000000000006c0f4 <strlen>:
   6c0f4:   andl.f  0,r0,0x7
   6c0f8:   beq_s   36  ;6c11c <strlen+0x28>
   6c0fa:   movl_s  r1,r0
   6c0fc:   movl    r4,0x1
   6c100:   b_s 10  ;6c10a <strlen+0x16>
   6c102:   movl_s  r3,r1
   6c104:   andl.f  0,r1,0x7
   6c108:   beq_s   22  ;6c11e <strlen+0x2a>
   6c10a:   movl_s  r2,r1
   6c10c:   addl    r1,r1,r4
   6c110:   ldb_s   r3,[r2,0]               <------
   6c112:   tst_s   r3,r3
   6c114:   bne_s   -18 ;6c102 <strlen+0xe>
   6c116:   rsubl   r0,r0,r2
   6c11a:   j_s [blink]
...
vineetgarc commented 3 years ago

Sorry, yet another thing to be rediscovered (circa 2015). See Fix garbage pointer for lat_rpc -S localhost

Planning to upstream this too