Bug 235297 - devel/ElectricFence: posix_memalign() missing
Summary: devel/ElectricFence: posix_memalign() missing
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-29 14:12 UTC by topical
Modified: 2019-02-10 21:44 UTC (History)
1 user (show)

See Also:


Attachments
Found this patch in the net and it works. Not sure about the author. (1.01 KB, patch)
2019-01-29 14:14 UTC, topical
no flags Details | Diff
patch to add posix_memalign() (1.19 KB, patch)
2019-02-10 21:40 UTC, topical
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description topical 2019-01-29 14:12:43 UTC
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.
Comment 1 topical 2019-01-29 14:14:39 UTC
Created attachment 201507 [details]
Found this patch in the net and it works. Not sure about the author.
Comment 2 Kurt Jaeger freebsd_committer 2019-02-10 12:37:32 UTC
Can you provide the link (source) of the patch ?
Comment 3 Kurt Jaeger freebsd_committer 2019-02-10 12:39:55 UTC
I checked the attachment, patch is not complete (lines are missing), can you re-upload ?
Comment 4 Kurt Jaeger freebsd_committer 2019-02-10 12:43:19 UTC
Can you also provide a testcase, name a program that can not be debugged
with efence ?
Comment 5 topical 2019-02-10 21:38:19 UTC
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.
Comment 6 topical 2019-02-10 21:40:08 UTC
Created attachment 201907 [details]
patch to add posix_memalign()
Comment 7 topical 2019-02-10 21:40:52 UTC
Ups - patch should be complete now.
Comment 8 topical 2019-02-10 21:44:27 UTC
E.g. nginx uses posix_memalign() for its memory pool. With the patch, I could solve bug #235296.