commit 6ccee9c10b06465f44da97e4b10d57200ff87e69 (HEAD -> poison_ptr4) Author: Mateusz Guzik <mjg@FreeBSD.org> Date: Tue Nov 28 15:23:25 2023 +0000 Add DEBUG_POISON_POINTER If you have a pointer which you know points to stale data, you can fill it with junk so that dereference later will trap.g Reviewed by: Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D40946
Sample usage is nameidata, which leaks entirely to the caller and where use of stale pointers is very much a possibility. For example accessing ni_dvp when WANTPARENT nor LOCKPARENT were specified.
I don't care about the name or the specific implementation, feel free to roll your own. What I do care about is the functionality.