git: 4bfc94008706 - main - security/samhain: don't use sbrk
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 18 Feb 2025 21:01:49 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/ports/commit/?id=4bfc94008706401027f79514540aa47889d4cb29
commit 4bfc94008706401027f79514540aa47889d4cb29
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2023-12-05 23:52:36 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-02-18 20:59:20 +0000
security/samhain: don't use sbrk
Samhain has an internal malloc implementation that uses sbrk and malloc.
There's a fallback during initialization if sbrk fails so replace sbrk
calls with a function that return the failure value ((void *)-1).
PR: 275646
Approved by: freebsd@gregv.net (maintainer)
---
security/samhain/Makefile | 2 +-
security/samhain/files/patch-src_dnmalloc.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/security/samhain/Makefile b/security/samhain/Makefile
index 6638f656c070..c54b2e30c0cb 100644
--- a/security/samhain/Makefile
+++ b/security/samhain/Makefile
@@ -14,7 +14,7 @@ LICENSE= GPLv2
BROKEN_mips= fails to configure: error: Could not find the libwrap library
BROKEN_mips64= fails to configure: error: Could not find the libwrap library
-USES= sbrk shebangfix
+USES= shebangfix
SHEBANG_FILES= scripts/samhainadmin-gpg.pl.in \
scripts/samhainadmin-sig.pl.in
diff --git a/security/samhain/files/patch-src_dnmalloc.c b/security/samhain/files/patch-src_dnmalloc.c
new file mode 100644
index 000000000000..3ea627f5bf98
--- /dev/null
+++ b/security/samhain/files/patch-src_dnmalloc.c
@@ -0,0 +1,21 @@
+--- src/dnmalloc.c.orig
++++ src/dnmalloc.c
+@@ -660,8 +660,18 @@
+ sample version for pre-OSX macos.
+ */
+
++#ifdef __FreeBSD__
++static void *nosbrk(ptrdiff_t len __unused) {
++ return MORECORE_FAILURE;
++}
++#endif
++
+ #ifndef MORECORE
++#ifdef __FreeBSD__
++#define MORECORE nosbrk
++#else
+ #define MORECORE sbrk
++#endif
+ #endif
+
+