Bug 406260

Summary: valgrind memcheck receive SIGBUS on octeon II CPU
Product: [Developer tools] valgrind Reporter: Shouhua Yu <yushouhua>
Component: memcheckAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: normal CC: philippe.waroquiers
Priority: NOR    
Version First Reported In: 3.14.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Shouhua Yu 2019-04-05 16:19:45 UTC
SUMMARY
valgrind memcheck receive SIGBUS on octeon II CPU CN61xx。

STEPS TO REPRODUCE
1. build a valgrind for a cavium octeonII CPU 
./configure --enable-only64bit --target=mips64-octeon-linux-gnu --host=mips64-octeon-linux-gnu --prefix=/usr --program-prefix="" CFLAGS="-march=octeon2 -Werror"
make 
gcc version is 4.7 glibc is 2.16 kernel version is 3.10 valgrind code is 3.14.0
2. try to start a program using valgrind without any param on a cavium board. get a log like this


OBSERVED RESULT

==7907== Memcheck, a memory error detector
==7907== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==7907== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
==7907== Command: /sbin/xgs.sda.sw
==7907== Parent PID: 7870
==7907== 
==7907== Invalid write of size 1
==7907==    at 0x41C7044: __pthread_initialize_minimal (in /lib/libpthread-2.16.so)
==7907==    by 0x41C5A58: ??? (in /lib/libpthread-2.16.so)
==7907==  Address 0xffffffffffff8d12 is not stack'd, malloc'd or (recently) free'd
==7907== 
==7907== 
==7907== Process terminating with default action of signal 10 (SIGBUS): dumping core
==7907==    at 0x41C7044: __pthread_initialize_minimal (in /lib/libpthread-2.16.so)
==7907==    by 0x41C5A58: ??? (in /lib/libpthread-2.16.so)
==7907== Invalid read of size 4
==7907==    at 0x4019518: ??? (in /lib/ld-2.16.so)
==7907==    by 0x40192E8: ??? (in /lib/ld-2.16.so)
==7907==  Address 0xffffffffffff8900 is not stack'd, malloc'd or (recently) free'd
==7907== 
==7907== 
==7907== Process terminating with default action of signal 10 (SIGBUS)
==7907==    at 0x4019518: ??? (in /lib/ld-2.16.so)
==7907==    by 0x40192E8: ??? (in /lib/ld-2.16.so)
==7907== 
==7907== HEAP SUMMARY:
==7907==     in use at exit: 0 bytes in 0 blocks
==7907==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==7907== 
==7907== All heap blocks were freed -- no leaks are possible
==7907== 
==7907== For counts of detected and suppressed errors, rerun with: -v
==7907== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 3 from 3)

EXPECTED RESULT


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 

ADDITIONAL INFORMATION
Comment 1 Philippe Waroquiers 2019-04-06 17:14:41 UTC
(In reply to Shouhua Yu from comment #0)

> gcc version is 4.7 glibc is 2.16 kernel version is 3.10 valgrind code is
> 3.14.0
The below message tells that valgrind version is 3.12.0.
It would be good to try with the latest release (3.14.0) or
even the GIT version.

> ==7907== Memcheck, a memory error detector
> ==7907== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
> ==7907== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
Comment 2 Shouhua Yu 2019-04-08 04:08:41 UTC
Sorry, I have not give the right log。  I tried both 3.12 and 3.14, and the log of 3.14 is as following:


[2019-04-02 09:30:32.166]/tmp/usr # ls
[2019-04-02 09:30:32.180]bin      include  lib      share
[2019-04-02 09:31:46.148]/tmp/usr # export VALGRIND_LIB=/tmp/usr/lib/valgrind                                                            
[2019-04-02 09:32:04.612]/tmp/usr # /tmp/usr/bin/valgrind ls -l                                                                          
[2019-04-02 09:32:04.713]==16424== Memcheck, a memory error detector
[2019-04-02 09:32:04.725]==16424== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
[2019-04-02 09:32:04.725]==16424== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
[2019-04-02 09:32:04.725]==16424== Command: ls -l
[2019-04-02 09:32:04.725]==16424== 
[2019-04-02 09:32:09.511]==16424== Invalid write of size 1
[2019-04-02 09:32:09.511]==16424==    at 0x437E044: __pthread_initialize_minimal (nptl-init.c:309)
[2019-04-02 09:32:09.522]==16424==    by 0x437CA58: ??? (in /lib/libpthread-2.16.so)
[2019-04-02 09:32:09.533]==16424==  Address 0xffffffffffff8d12 is not stack'd, malloc'd or (recently) free'd
[2019-04-02 09:32:09.533]==16424== 
[2019-04-02 09:32:09.533]==16424== 
[2019-04-02 09:32:09.545]==16424== Process terminating with default action of signal 10 (SIGBUS): dumping core
[2019-04-02 09:32:09.545]==16424==    at 0x437E044: __pthread_initialize_minimal (nptl-init.c:309)
[2019-04-02 09:32:09.556]==16424==    by 0x437CA58: ??? (in /lib/libpthread-2.16.so)
[2019-04-02 09:32:09.556]==16424== Invalid read of size 4
[2019-04-02 09:32:09.567]==16424==    at 0x4019518: __dl_runtime_resolve (dl-trampoline.c:178)
[2019-04-02 09:32:09.567]==16424==    by 0x40192E8: _dl_runtime_resolve (in /lib/ld-2.16.so)
[2019-04-02 09:32:09.579]==16424==  Address 0xffffffffffff8900 is not stack'd, malloc'd or (recently) free'd
[2019-04-02 09:32:09.579]==16424== 
[2019-04-02 09:32:09.579]==16424== 
[2019-04-02 09:32:09.590]==16424== Process terminating with default action of signal 10 (SIGBUS)
[2019-04-02 09:32:09.591]==16424==    at 0x4019518: __dl_runtime_resolve (dl-trampoline.c:178)
[2019-04-02 09:32:09.602]==16424==    by 0x40192E8: _dl_runtime_resolve (in /lib/ld-2.16.so)
[2019-04-02 09:32:09.602]==16424== 
[2019-04-02 09:32:09.602]==16424== HEAP SUMMARY:
[2019-04-02 09:32:09.613]==16424==     in use at exit: 0 bytes in 0 blocks
[2019-04-02 09:32:09.613]==16424==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
[2019-04-02 09:32:09.613]==16424== 
[2019-04-02 09:32:09.625]==16424== All heap blocks were freed -- no leaks are possible
[2019-04-02 09:32:09.625]==16424== 
[2019-04-02 09:32:09.635]==16424== For counts of detected and suppressed errors, rerun with: -v
[2019-04-02 09:32:09.635]==16424== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
[2019-04-02 09:32:09.635]Bus error