Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 01 May 2026 02:59:04 +0000
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 910f78a5143a - main - tests: fix remaining test failures under _FORTIFY_SOURCE
Message-ID:  <69f416f8.43746.6e22ea83@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=910f78a5143af32dfcb237a463397aa0c31c07df

commit 910f78a5143af32dfcb237a463397aa0c31c07df
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2026-05-01 02:57:51 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2026-05-01 02:58:48 +0000

    tests: fix remaining test failures under _FORTIFY_SOURCE
    
    The getgroups test is a NetBSD tests, so just apply our larger hammer
    and disable the feature entirely.  The audit test can take a more
    surgical approach and use __ssp_real() appropriately, since it's a local
    one.
    
    PR:             294881
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D56735
---
 include/ssp/stdio.h         | 7 +++++++
 lib/libc/tests/sys/Makefile | 1 +
 tests/sys/audit/network.c   | 4 +++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/ssp/stdio.h b/include/ssp/stdio.h
index 17bda8d3ee2d..73c601c408ce 100644
--- a/include/ssp/stdio.h
+++ b/include/ssp/stdio.h
@@ -75,6 +75,13 @@ __ssp_redirect_raw_impl(char *, gets_s, gets_s,
 	}
 
 	retbuf = __ssp_real(gets_s)(buf, len);
+
+	/*
+	 * If the implementation did *not* handle the case correctly, then
+	 * there's a risk that they could have corrupted us into not failing
+	 * here.  We have tests that cover this, so we'll just count on finding
+	 * a broken implementation early on in a less hostile environmnt.
+	 */
 	if (need_fail && retbuf != NULL)
 		__chk_fail();
 	return (retbuf);
diff --git a/lib/libc/tests/sys/Makefile b/lib/libc/tests/sys/Makefile
index 88f8191a16eb..ef689dcf019c 100644
--- a/lib/libc/tests/sys/Makefile
+++ b/lib/libc/tests/sys/Makefile
@@ -22,6 +22,7 @@ NETBSD_ATF_TESTS_C+=		dup_test
 NETBSD_ATF_TESTS_C+=		fsync_test
 NETBSD_ATF_TESTS_C+=		getcontext_test
 NETBSD_ATF_TESTS_C+=		getgroups_test
+FORTIFY_SOURCE.t_getgroups.c=	0
 NETBSD_ATF_TESTS_C+=		getitimer_test
 NETBSD_ATF_TESTS_C+=		getlogin_test
 NETBSD_ATF_TESTS_C+=		getpid_test
diff --git a/tests/sys/audit/network.c b/tests/sys/audit/network.c
index 2d9aed34111a..52a8a25c091b 100644
--- a/tests/sys/audit/network.c
+++ b/tests/sys/audit/network.c
@@ -29,6 +29,8 @@
 #include <sys/uio.h>
 #include <sys/un.h>
 
+#include <ssp/ssp.h>
+
 #include <atf-c.h>
 #include <fcntl.h>
 #include <stdarg.h>
@@ -959,7 +961,7 @@ ATF_TC_BODY(recvmsg_failure, tc)
 	snprintf(extregex, sizeof(extregex),
 		"recvmsg.*return,failure : Bad address");
 	FILE *pipefd = setup(fds, auclass);
-	ATF_REQUIRE_EQ(-1, recvmsg(-1, NULL, 0));
+	ATF_REQUIRE_EQ(-1, __ssp_real(recvmsg)(-1, NULL, 0));
 	check_audit(fds, extregex, pipefd);
 }
 


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f416f8.43746.6e22ea83>