[valgrind] [Bug 403212] trylock test hangs on FreeBSD

2019-01-14 Thread Mark Johnston
https://bugs.kde.org/show_bug.cgi?id=403212

Mark Johnston  changed:

   What|Removed |Added

 CC||ema...@freebsd.org

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 403212] New: trylock test hangs on FreeBSD

2019-01-14 Thread Mark Johnston
https://bugs.kde.org/show_bug.cgi?id=403212

Bug ID: 403212
   Summary: trylock test hangs on FreeBSD
   Product: valgrind
   Version: 3.13.0
  Platform: Other
OS: FreeBSD
Status: REPORTED
  Severity: normal
  Priority: NOR
 Component: drd
  Assignee: bvanass...@acm.org
  Reporter: ma...@freebsd.org
  Target Milestone: ---

SUMMARY
The test code in drd/tests/trylock.c attempts to write-lock a POSIX rwlock
twice.  The code expects the second attempt to return an error, but POSIX
doesn't require that behaviour, and FreeBSD's implementation deadlocks instead.

Seems to me that for the purpose of the test the second wrlock could become a
trywrlock; I verified that in this case, drd on FreeBSD detects the attempted
recursion and spits out the error message expected by the test.  I can submit a
patch if there are no objections to this approach.

STEPS TO REPRODUCE
1. run drd/tests/trylock on FreeBSD

OBSERVED RESULT
trylock hangs and requires a ctrl-C.

EXPECTED RESULT
The test program should complete.

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 402985] commit 64aa729bfae7 ("Accept read-only PT_LOAD segments and .rodata.") breaks debuginfo tracking on FreeBSD

2019-01-07 Thread Mark Johnston
https://bugs.kde.org/show_bug.cgi?id=402985

Mark Johnston  changed:

   What|Removed |Added

 CC||ema...@freebsd.org

-- 
You are receiving this mail because:
You are watching all bug changes.

[valgrind] [Bug 402985] New: commit 64aa729bfae7 ("Accept read-only PT_LOAD segments and .rodata.") breaks debuginfo tracking on FreeBSD

2019-01-07 Thread Mark Johnston
https://bugs.kde.org/show_bug.cgi?id=402985

Bug ID: 402985
   Summary: commit 64aa729bfae7 ("Accept read-only PT_LOAD
segments and .rodata.") breaks debuginfo tracking on
FreeBSD
   Product: valgrind
   Version: 3.13.0
  Platform: Other
OS: FreeBSD
Status: REPORTED
  Severity: normal
  Priority: NOR
 Component: general
  Assignee: jsew...@acm.org
  Reporter: ma...@freebsd.org
  Target Milestone: ---

SUMMARY
A number of us have been working on getting valgrind 3.13 working well on
FreeBSD.  Commit 64aa729bfae7 changed some logic which is interacting badly
with FreeBSD's dynamic linker.  Our linker, when loading a shared library,
mmap()s the first page of the file to read its ELF header; the header is
unmapped once the task of loading the object is finished.  The problem is that
the header is mapped at a non-fixed address which may be reused during a
subsequent load of a different file.  When the reuse occurs and the new file is
activated, valgrind believes that the new file overlaps with the old one and
erroneously discards symbols for the old file.

STEPS TO REPRODUCE
1. Check out commit 1c7e497629539f73c5bc364b3e13dea8358fd76c from
github.com/freebsdfoundation/valgrind and build valgrind on FreeBSD-CURRENT.
2. Run memcheck on any application which uses malloc().

OBSERVED RESULT
memcheck reports zero heap usage because the bug described above breaks
redirection of malloc().

ADDITIONAL INFORMATION
I attempted my own fix:
https://github.com/FreeBSDFoundation/valgrind/commit/2c57a7b44a52d5e944dcc5686d6733bf2b917f32

The idea is to track whether a given segment was mapped with MAP_FIXED, and
ignore mappings of ELF objections if the mapping is read-only and not fixed. 
It seems to work, but since we currently have quite a few failing regression
tests on FreeBSD it's hard to determine whether it introduces new problems.

-- 
You are receiving this mail because:
You are watching all bug changes.