Skip to content

Commit

Permalink
cheribsdtest: Don't link against libpthread for non-mt variants
Browse files Browse the repository at this point in the history
Restricting libpthread to just the -mt variants is a very deliberate
choice in order to ensure that we test the implementations of things
like signals without libthr's interposition.

Document this clearly in the Makefile so this doesn't happen again, and
combine the two .ifdef's.

Fixes:	abb906e ("cheribsdtest: Add a couple of regression tests for async revocation")
  • Loading branch information
jrtc27 committed Feb 6, 2025
1 parent ab216a1 commit 040438e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 5 additions & 5 deletions bin/cheribsdtest/Makefile.cheribsdtest
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,9 @@ CFLAGS+= -DCHERIBSDTEST_CHERI_REVOKE_TESTS
# Enable sub-object bounds only in tests specifically designed for them.
CFLAGS.cheribsdtest_bounds_subobject.c+=-cheri-bounds=subobject-safe

.ifdef CHERIBSD_THREAD_TESTS
CFLAGS+= -DCHERIBSD_THREAD_TESTS
.endif

MAN=

LIBADD+= procstat pthread util xo z
LIBADD+= procstat util xo z

.ifdef CHERIBSD_DYNAMIC_TESTS
CFLAGS+= -DCHERIBSD_DYNAMIC_TESTS
Expand All @@ -85,7 +81,11 @@ NO_SHARED?= YES
SRCS+= cheribsdtest_ifunc.c
.endif

# Both variants exist so we can test with and without libthr's interposition on
# things like signals.
.ifdef CHERIBSD_THREAD_TESTS
CFLAGS+= -DCHERIBSD_THREAD_TESTS
LIBADD+= pthread
SRCS+= cheribsdtest_tls_threads.c
.endif

Expand Down
7 changes: 6 additions & 1 deletion bin/cheribsdtest/cheribsdtest_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
#include <fcntl.h>
#include <inttypes.h>
#include <libprocstat.h>
#include <pthread.h>
#include <signal.h>
#include <stdatomic.h>
#include <stdbool.h>
Expand All @@ -76,6 +75,10 @@
#include <sysexits.h>
#include <unistd.h>

#ifdef CHERIBSD_THREAD_TESTS
#include <pthread.h>
#endif

#include "cheribsdtest.h"

static const char *skip_need_writable_tmp(const char *name __unused);
Expand Down Expand Up @@ -1731,6 +1734,7 @@ CHERIBSDTEST(cheri_revoke_async,
cheribsdtest_success();
}

#ifdef CHERIBSD_THREAD_TESTS
static void *
forker(void *arg)
{
Expand Down Expand Up @@ -1820,6 +1824,7 @@ CHERIBSDTEST(cheri_revoke_async_fork,

cheribsdtest_success();
}
#endif /* CHERIBSD_THREAD_TESTS */

/*
* Repeatedly invoke libcheri_caprevoke logic.

Check warning on line 1830 in bin/cheribsdtest/cheribsdtest_vm.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line
Expand Down

0 comments on commit 040438e

Please sign in to comment.