From owner-svn-ports-head@freebsd.org Tue Feb 26 22:28:54 2019 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D87DA1505F41; Tue, 26 Feb 2019 22:28:53 +0000 (UTC) (envelope-from pi@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7B9DF7683F; Tue, 26 Feb 2019 22:28:53 +0000 (UTC) (envelope-from pi@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54329B980; Tue, 26 Feb 2019 22:28:53 +0000 (UTC) (envelope-from pi@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1QMSrqs008066; Tue, 26 Feb 2019 22:28:53 GMT (envelope-from pi@FreeBSD.org) Received: (from pi@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1QMSrX4008065; Tue, 26 Feb 2019 22:28:53 GMT (envelope-from pi@FreeBSD.org) Message-Id: <201902262228.x1QMSrX4008065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pi set sender to pi@FreeBSD.org using -f From: Kurt Jaeger Date: Tue, 26 Feb 2019 22:28:53 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r493985 - head/devel/ElectricFence/files X-SVN-Group: ports-head X-SVN-Commit-Author: pi X-SVN-Commit-Paths: head/devel/ElectricFence/files X-SVN-Commit-Revision: 493985 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7B9DF7683F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2019 22:28:54 -0000 Author: pi Date: Tue Feb 26 22:28:52 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 Modified: head/devel/ElectricFence/files/patch-efence.c Modified: head/devel/ElectricFence/files/patch-efence.c ============================================================================== --- head/devel/ElectricFence/files/patch-efence.c Tue Feb 26 22:24:15 2019 (r493984) +++ head/devel/ElectricFence/files/patch-efence.c Tue Feb 26 22:28:52 2019 (r493985) @@ -1,12 +1,38 @@ ---- efence.c.orig Mon Jan 13 17:24:08 2003 -+++ efence.c Mon Jan 13 17:22:50 2003 -@@ -271,7 +271,9 @@ - char * string; - Slot * slot; +--- efence.c.orig 2019-02-26 17:53:52.941236000 +0100 ++++ efence.c 2019-02-26 17:56:18.688752000 +0100 +@@ -38,6 +38,7 @@ + # include + # include + #endif ++#include -+#if 0 - EF_Print(version); -+#endif + #ifdef malloc + #undef malloc +@@ -670,6 +671,27 @@ + release(); - #ifdef USE_SEMAPHORE - if (sem_init(&EF_sem, 0, 1) >= 0) { + return address; ++} ++ ++extern C_LINKAGE int ++posix_memalign(void **memptr, size_t alignment, size_t userSize) ++{ ++ /* ++ * Per standard, posix_memalign returns EINVAL when alignment ++ * is not a power of two or power of sizeof(void*). efence ++ * doesn't check the value of alignment in memalign, but then ++ * again, memalign was never specified very well, and on some ++ * systems odd alignments could indeed have been allowed. ++ */ ++ if ((alignment & (alignment - 1)) ++ || alignment % sizeof (void *)) ++ return EINVAL; ++ ++ void *ptr = memalign (alignment, userSize); ++ if (ptr == NULL) ++ return ENOMEM; ++ *memptr = ptr; ++ return 0; + } + + /*