Summary: | devel/valgrind Segmentation fault | ||||||
---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | Martin Filla <freebsd> | ||||
Component: | Individual Port(s) | Assignee: | Niclas Zeising <zeising> | ||||
Status: | Closed Overcome By Events | ||||||
Severity: | Affects Only Me | CC: | code, jdc, lwhsu, paulf, w.schwarzenfeld | ||||
Priority: | --- | ||||||
Version: | Latest | ||||||
Hardware: | amd64 | ||||||
OS: | Any | ||||||
Attachments: |
|
Description
Martin Filla
2017-07-23 13:29:18 UTC
From gdb There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "amd64-marcel-freebsd"... (gdb) run Starting program: /usr/local/bin/valgrind Program terminated with signal SIGSEGV, Segmentation fault. Then i compiled with WITH_DEBUG=yes but result is same Valgrind need root permits :-) Valgrind does not need root! Hi , do you need some logs or any information about this problem ? It looks like this just happened to me on FreeBSD 11, with a custom kernel config and the installer-provided hardening options enabled. I enabled unprivileged debugging (sysctl security.bsd.unprivileged_proc_debug=1) and rebuilt my kernel to include FreeBSD 10 compatibility (options COMPAT_FREEBSD10), then valgrind started working better. A reconstructed session looks like this: % sudo sysctl security.bsd.unprivileged_proc_debug security.bsd.unprivileged_proc_debug: 0 % valgrind ./sample zsh: segmentation fault valgrind ./sample % sudo sysctl security.bsd.unprivileged_proc_debug=1 security.bsd.unprivileged_proc_debug: 0 -> 1 % valgrind ./sample ==5611== Memcheck, a memory error detector ==5611== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==5611== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info ==5611== Command: ./sample ==5611== zsh: invalid system call valgrind ./sample % truss valgrind ./sample (Lots of output elided.) pread(0x3,0x4028f0d70,0x2000,0x63e000) = 8192 (0x2000) close(3) = 0 (0x0) compat10.pipe() ERR#78 'Function not implemented' SIGNAL 12 (SIGSYS) process killed, signal = 12 (Kernel rebuild, install, and reboot elided.) % valgrind ./sample ==67066== Memcheck, a memory error detector ==67066== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==67066== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info ==67066== Command: ./sample ==67066== (Output elided.) ==67066== ==67066== HEAP SUMMARY: ==67066== in use at exit: 0 bytes in 0 blocks ==67066== total heap usage: 0 allocs, 0 frees, 0 bytes allocated ==67066== ==67066== All heap blocks were freed -- no leaks are possible ==67066== ==67066== For counts of detected and suppressed errors, rerun with: -v ==67066== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Created attachment 185695 [details]
Mention additional requirements in pkg-message
In case it helps, I've included a patch to pkg-message that mentions what I found.
I tested % sudo sysctl security.bsd.unprivileged_proc_debug=1, yes this change is a functional change. (In reply to Brad Sliger from comment #5) > It looks like this just happened to me on FreeBSD 11, with a custom kernel > config and the installer-provided hardening options enabled. I enabled > unprivileged debugging (sysctl security.bsd.unprivileged_proc_debug=1) and > rebuilt my kernel to include FreeBSD 10 compatibility (options > COMPAT_FREEBSD10), then valgrind started working better. A reconstructed > session looks like this: > > % sudo sysctl security.bsd.unprivileged_proc_debug > security.bsd.unprivileged_proc_debug: 0 > % valgrind ./sample > zsh: segmentation fault valgrind ./sample > % sudo sysctl security.bsd.unprivileged_proc_debug=1 > security.bsd.unprivileged_proc_debug: 0 -> 1 > % valgrind ./sample > ==5611== Memcheck, a memory error detector valgrind really shouldn't be crashing here. We should show a message about the issue. Thanks for the investigation, I'll write up a patch to fix the crash and show a message. I ran into this today on stable/11 (r330260). I tried three separate times, including a final time via "sudo valgrind ...". security.bsd.unprivileged_proc_debug was 1 (default), but my custom kernel intentionally omits "options COMPAT_FREEBSD10". The crashes I got were not SIGSEGV (11) but SIGSYS (12) as demonstrated in c#5 (it's easy to overlook that line). Kernel logged these as such: pid 33167 (memcheck-amd64-free), uid 1000: exited on signal 12 (core dumped) pid 33245 (memcheck-amd64-free), uid 0: exited on signal 12 (core dumped) pid 33244 (sudo), uid 0: exited on signal 12 Just noting all this here as a form of "this is still a problem 7 months later". (In reply to Jeremy Chadwick from comment #9) > I ran into this today on stable/11 (r330260). I tried three separate times, > including a final time via "sudo valgrind ...". > > security.bsd.unprivileged_proc_debug was 1 (default), but my custom kernel > intentionally omits "options COMPAT_FREEBSD10". > > The crashes I got were not SIGSEGV (11) but SIGSYS (12) as demonstrated in > c#5 (it's easy to overlook that line). Kernel logged these as such: > > pid 33167 (memcheck-amd64-free), uid 1000: exited on signal 12 (core dumped) > pid 33245 (memcheck-amd64-free), uid 0: exited on signal 12 (core dumped) > pid 33244 (sudo), uid 0: exited on signal 12 > > Just noting all this here as a form of "this is still a problem 7 months > later". Thanks for the reminder. I don't consider this high priority since COMPAT_FREEBSD10 is all-but-required in general IMO. But I do consider this a bug worth fixing. Possible duplicate of Bug #209886. Assign to new maintainer. Hello, and result this bug ? ping (In reply to Martin FIlla from comment #14) Can you try the code in my github repo (https://github.com/paulfloyd/freebsd_valgrind)? I'll add a check for the security.bsd.unprivileged_proc_debug soon. This is now fixed in my github repo(https://github.com/paulfloyd/freebsd_valgrind) With the sysctl set root@euler:/usr/include # sysctl security.bsd.unprivileged_proc_debug=1 security.bsd.unprivileged_proc_debug: 0 -> 1 paulf> ./vg-in-place --tool=none ./leakcpp.clang++ ==2894== Nulgrind, the minimal Valgrind tool ==2894== Copyright (C) 2002-2017, and GNU GPL'd, by Nicholas Nethercote. ==2894== Using Valgrind-3.16.0.GIT and LibVEX; rerun with -h for copyright info ==2894== Command: ./leakcpp.clang++ ==2894== ==2894== euler:/usr/home/paulf/scratch/valgrind With the sysctl cleared paulf> ./vg-in-place --tool=none ./leakcpp.clang++ --6443:0: main Valgrind: FATAL: --6443:0: main security.bsd.unprivileged_proc_debug sysctl is 0. --6443:0: main Set this sysctl with --6443:0: main 'sysctl security.bsd.unprivileged_proc_debug=1'. --6443:0: main Cannot continue. euler:/usr/home/paulf/scratch/valgrind This has to be very early in the tool execution, before the address space manager starts. This should now be fixed in devel/valgrind-devel and this item can be closed. ^Triage: Unless a specific change (usually commit) can be identified that resolved the issue, OBE is more appropriate. |