The current implementation doesn't handle posix_memalign(). Programs using posix_memalign() to allocate memory effectively silently fall back to the standard implementation. Whenever the program calls free() to release the memory, the efence implementation is called and barfs that the memory is unknown, leading to a core dump. Sadly, many programs use posix_memalign and thus cannot be debugged with efence.
Created attachment 201507 [details] Found this patch in the net and it works. Not sure about the author.
Can you provide the link (source) of the patch ?
I checked the attachment, patch is not complete (lines are missing), can you re-upload ?
Can you also provide a testcase, name a program that can not be debugged with efence ?
I found the patch at Redhat Bug 603075, see https://bugzilla.redhat.com/show_bug.cgi?id=603075 But according to the timestamp, the patch is much older. I found an older version at https://launchpad.net/ubuntu/+source/electric-fence/+changelog but I couldn't trace the referenced bug, but according to change log it seems that the patch was contributed by Petr Machata.
Created attachment 201907 [details] patch to add posix_memalign()
Ups - patch should be complete now.
E.g. nginx uses posix_memalign() for its memory pool. With the patch, I could solve bug #235296.
Created attachment 202250 [details] patch-v2 Rearranged for portlint happyness, pkg-plist fixes. testbuilds are fine. Waiting for maintainer approval.
Ups, sorry, wrong PR!
Comment on attachment 202250 [details] patch-v2 wrong PR for this patch.
Is there anything else I can do?
Committed, thanks!
A commit references this bug: Author: pi Date: Tue Feb 26 22:28:53 UTC 2019 New revision: 493985 URL: https://svnweb.freebsd.org/changeset/ports/493985 Log: devel/ElectricFence: add missing posix_memalign() The current implementation did not handle posix_memalign(). Programs using posix_memalign() to allocate memory effectively silently fall back to the standard implementation. Whenever the program calls free() to release the memory, the efence implementation is called and barfs that the memory is unknown, leading to a core dump. Sadly, many programs use posix_memalign and thus could not be debugged with efence. Example use case: See nginx, PR#235296 PR: 235297 Submitted by: topical@gmx.net Obtained from: https://bugzilla.redhat.com/show_bug.cgi?id=603075 https://launchpad.net/ubuntu/+source/electric-fence/+changelog Changes: head/devel/ElectricFence/files/patch-efence.c