|Summary:||devel/ElectricFence: posix_memalign() missing|
|Product:||Ports & Packages||Reporter:||topical <topical>|
|Component:||Individual Port(s)||Assignee:||Kurt Jaeger <pi>|
|Severity:||Affects Some People||CC:||pi|
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 2019-02-10 12:37:32 UTC
Can you provide the link (source) of the patch ?
Comment 3 Kurt Jaeger 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 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.
Comment 9 Kurt Jaeger 2019-02-22 06:18:08 UTC
Created attachment 202250 [details] patch-v2 Rearranged for portlint happyness, pkg-plist fixes. testbuilds are fine. Waiting for maintainer approval.
Comment 10 Kurt Jaeger 2019-02-22 06:19:13 UTC
Ups, sorry, wrong PR!
Comment 11 Kurt Jaeger 2019-02-22 06:19:40 UTC
Comment on attachment 202250 [details] patch-v2 wrong PR for this patch.
Comment 12 topical 2019-02-26 16:28:56 UTC
Is there anything else I can do?
Comment 13 Kurt Jaeger 2019-02-26 22:28:56 UTC
Comment 14 commit-hook 2019-02-26 22:29:16 UTC
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: firstname.lastname@example.org 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