NetBSD-Bugs archive

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

re: port-i386/56280: Many asan tests are failing on i386

this is odd.  the test tries to write beyond the length
of an array, but it gets a segv while trying to load
stuff from the shadow i guess:

Dump of assembler code for function foo:
   0x08048a08 <+0>:       push   %ebp
   0x08048a09 <+1>:       mov    %esp,%ebp
   0x08048a0b <+3>:       push   %ebx
   0x08048a0c <+4>:       sub    $0x4,%esp
   0x08048a0f <+7>:       mov    0x8(%ebp),%eax
   0x08048a12 <+10>:      shl    $0x2,%eax
   0x08048a15 <+13>:      add    $0x8049180,%eax
   0x08048a1a <+18>:      mov    %eax,%edx
   0x08048a1c <+20>:      shr    $0x3,%edx
   0x08048a1f <+23>:      add    $0x20000000,%edx
=> 0x08048a25 <+29>:      movzbl (%edx),%edx

so the segv occurs before asan is able to detect the
the write and complain normally.

this occurs on amd64 with cc -m32 too.  the minimal
version of the test is:

#include <stdio.h>
int arr[5] = {-1};
void foo(int index) { arr[index] = 0; }
int main(int argc, char **argv) {foo(argc + 5); printf("CHECK\n"); return 0;}

and compile with -fsanitize=address on i386, or with
-m32 on amd64.


Home | Main Index | Thread Index | Old Index