Bug 397393

Summary: valgrind: the 'impossible' happened: (Archlinux)
Product: [Developer tools] valgrind Reporter: David Rankin <drankinatty>
Component: memcheckAssignee: Julian Seward <jseward>
Status: RESOLVED DUPLICATE    
Severity: critical CC: tom
Priority: NOR    
Version: 3.13.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Source producing the executable triggering the error.

Description David Rankin 2018-08-12 03:38:19 UTC
Created attachment 114412 [details]
Source producing the executable triggering the error.

Running valgrind against a basic allocation and free of a simple char** with opendir/readdir valgrind rolled over and died with an 'impossible' error. (there are no compiler error/warnings `-Wall -Wextra -pedantic` and valgrind on opensuse successfully complete and reports no errors)

However on Archlinux under both 4.17.13 and 4.17.14 (I didn't have an earlier kernel to test), valgrind does the impossible

$ valgrind ./bin/opendir_readdir_dyn_char_basic
==1196== Memcheck, a memory error detector
==1196== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1196== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==1196== Command: ./bin/opendir_readdir_dyn_char_basic
==1196==

valgrind: the 'impossible' happened:
   Unsupported arch_prctl option

host stacktrace:
==1196==    at 0x580441BA: show_sched_status_wrk (m_libcassert.c:355)
==1196==    by 0x580442D4: report_and_quit (m_libcassert.c:426)
==1196==    by 0x58044517: panic (m_libcassert.c:502)
==1196==    by 0x58044517: vgPlain_core_panic_at (m_libcassert.c:507)
==1196==    by 0x5804454A: vgPlain_core_panic (m_libcassert.c:512)
==1196==    by 0x580DAE22: vgSysWrap_amd64_linux_sys_arch_prctl_before
(syswrap-amd64-linux.c:286)
==1196==    by 0x580A0C23: vgPlain_client_syscall (syswrap-main.c:1857)
==1196==    by 0x5809D48A: handle_syscall (scheduler.c:1126)
==1196==    by 0x5809EBB6: vgPlain_scheduler (scheduler.c:1443)
==1196==    by 0x580AED50: thread_wrapper (syswrap-linux.c:103)
==1196==    by 0x580AED50: run_a_thread_NORETURN (syswrap-linux.c:156)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable (lwpid 1196)
==1196==    at 0x401A1C5: ??? (in /usr/lib/ld-2.28.so)
==1196==    by 0x178BFBFE: ???


Note: see also the FAQ in the source distribution.
It contains workarounds to several common problems.
In particular, if Valgrind aborted or crashed after
identifying problems in your program, there's a good chance
that fixing those problems will prevent Valgrind aborting or
crashing, especially if it happened in m_mallocfree.c.

If that doesn't help, please report this bug to: www.valgrind.org

In the bug report, send all the above text, the valgrind
version, and what OS and version you are using.  Thanks.

Simple test code that read the directory entries from the directory given as the first argument ('.' by default if no argument is given) and simply outputs the stored names to stdout freeing the storage as it goes and freeing the pointers at the end is attached.

Compiler string used:

gcc -Wall -Wextra -pedantic -Wshadow -finline-functions -std=gnu11 -Ofast -o /tmp/bin/opendir_readdir_dyn_char_basic opendir_readdir_dyn_char_basic.c
Comment 1 Tom Hughes 2018-08-16 13:42:53 UTC

*** This bug has been marked as a duplicate of bug 397012 ***
Comment 2 Tom Hughes 2018-08-16 13:44:39 UTC

*** This bug has been marked as a duplicate of bug 396887 ***