DF-5019 / mytcase.c
/* * DF-5019 PoC — out-of-tree tbridge testcase module. * * Registers a minimal testcase via TBRIDGE_TESTCASE_MODULE so that * tbridge_curtest != NULL while tbridge_testcase (the proplib dict) is * still NULL. The run function immediately reports completion, which * drives tbridge_test_done() with a NULL tbridge_testcase: * * tbridge.c:196 KKASSERT(tbridge_testcase != NULL); * * DragonFly's X86_64_GENERIC ships with INVARIANTS (sys/config/ * X86_64_GENERIC:56), so KKASSERT is live and this panics the kernel. */ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/module.h> #include <sys/tbridge.h> static int mytcase_abort(void) { return (0); } static void mytcase_run(void *arg) { tbridge_printf("mytcase: running\n"); tbridge_test_done(RESULT_PASS); /* -> KKASSERT(NULL) panic */ } static struct tbridge_testcase mytcase = { mytcase_abort, mytcase_run }; TBRIDGE_TESTCASE_MODULE(mytcase, &mytcase); |