Bug 452575 - Valgrind crashes with segmentation fault and a lot invalid writes on Raspberry Pi 4B
Summary: Valgrind crashes with segmentation fault and a lot invalid writes on Raspberr...
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: 3.18.1
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-13 13:35 UTC by Willam Tang
Modified: 2024-01-21 10:10 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Willam Tang 2022-04-13 13:35:17 UTC
SUMMARY
Valgrind crashes with segmentation fault and a lot invalid writes.


STEPS TO REPRODUCE
1. Compile the following program with command "gcc -g main.c":
#include <stdio.h>

int main()
{
	puts("Hello World!");
	return 0;
}
2. valgrind ./a.out

OBSERVED RESULT
==25353== Memcheck, a memory error detector
==25353== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==25353== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==25353== Command: ./a.out
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x401B100: _dl_start (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fbc14 is on thread 1's stack
==25353==  120 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x401236C: _dl_setup_hash (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fbc28 is on thread 1's stack
==25353==  8 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x4019548: _dl_sysdep_start (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fbbac is on thread 1's stack
==25353==  104 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x4015858: __GI___tunables_init (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fbb4c is on thread 1's stack
==25353==  96 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x4012544: _dl_sort_maps_init (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fbbbc is on thread 1's stack
==25353==  16 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x401FC24: sbrk (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fbbb0 is on thread 1's stack
==25353==  16 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x401BBF0: dl_main (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fb99c is on thread 1's stack
==25353==  528 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x400C488: _dl_new_object (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fb96c is on thread 1's stack
==25353==  48 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x400BF50: __minimal_calloc (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fb970 is on thread 1's stack
==25353==  16 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x400BDF4: __minimal_malloc (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fb96c is on thread 1's stack
==25353==  24 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x400C3B8: _dl_add_to_namespace_list (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fb9a0 is on thread 1's stack
==25353==  16 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x4019CCC: _dl_discover_osversion (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fb7ac is on thread 1's stack
==25353==  496 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x400716C: _dl_init_paths (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fb97c is on thread 1's stack
==25353==  40 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x40181F8: _dl_important_hwcaps (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fb904 is on thread 1's stack
==25353==  112 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x4018CAC: _dl_hwcaps_split_masked (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fb918 is on thread 1's stack
==25353==  8 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x4018BA0: _dl_hwcaps_split (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fb900 is on thread 1's stack
==25353==  16 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x4018140: copy_hwcaps (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fb8cc is on thread 1's stack
==25353==  40 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x401B074: audit_list_add_dynamic_tag (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fb9b0 is on thread 1's stack
==25353==  8 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x40164D4: _dl_audit_activity_map (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fb970 is on thread 1's stack
==25353==  40 bytes below stack pointer
==25353== 
==25353== Invalid write of size 4
==25353==    at 0x401BACC: handle_preload_list (in /usr/lib/ld-linux-armhf.so.3)
==25353==  Address 0xbd8fa99c is not stack'd, malloc'd or (recently) free'd
==25353== 
==25353== 
==25353== Process terminating with default action of signal 11 (SIGSEGV)
==25353==  Access not within mapped region at address 0xBD8FA99C
==25353==    at 0x401BACC: handle_preload_list (in /usr/lib/ld-linux-armhf.so.3)
==25353==  If you believe this happened as a result of a stack
==25353==  overflow in your program's main thread (unlikely but
==25353==  possible), you can try to increase the size of the
==25353==  main thread stack using the --main-stacksize= flag.
==25353==  The main thread stack size used in this run was 8388608.
==25353== 
==25353== HEAP SUMMARY:
==25353==     in use at exit: 0 bytes in 0 blocks
==25353==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==25353== 
==25353== All heap blocks were freed -- no leaks are possible
==25353== 
==25353== For lists of detected and suppressed errors, rerun with: -s
==25353== ERROR SUMMARY: 33 errors from 20 contexts (suppressed: 0 from 0)
Segmentation fault

EXPECTED RESULT
Run the program without errors

SOFTWARE/OS VERSIONS
Hardware: Raspberry Pi 4B
OS: Arch Linux ARM (Linux alarmpi 5.15.33-1-rpi-ARCH #1 SMP Mon Apr 11 18:05:07 UTC 2022 armv7l GNU/Linux)

ADDITIONAL INFORMATION
I've also created a bug report on glibc bugzilla, link: https://sourceware.org/bugzilla/show_bug.cgi?id=29061
Comment 1 Paul Floyd 2024-01-21 10:10:05 UTC
I don't get any errors with Valgrind 3.19 on a Pi  5 with raspbian.

Your chances of someone working with your combination of HW and OS are, I'm afraid, close to zero.