diff --git a/sys/sys/kassert.h b/sys/sys/kassert.h --- a/sys/sys/kassert.h +++ b/sys/sys/kassert.h @@ -38,6 +38,16 @@ extern bool panicked; #define KERNEL_PANICKED() __predict_false(panicked) +/* + * Try to trap accesses. + * TODO: use kmsan if available + */ +#ifdef INVARIANTS +#define DEBUG_POISON_POINTER(x) ({ x = (void *)(UINTPTR_MAX - 4096); }) +#else +#define DEBUG_POISON_POINTER(x) +#endif + #ifdef INVARIANTS /* The option is always available */ #define VNASSERT(exp, vp, msg) do { \ if (__predict_false(!(exp))) { \