svn commit: r363881 - head/sys/sys
Mateusz Guzik
mjg at FreeBSD.org
Wed Aug 5 07:28:52 UTC 2020
Author: mjg
Date: Wed Aug 5 07:28:51 2020
New Revision: 363881
URL: https://svnweb.freebsd.org/changeset/base/363881
Log:
vfs: prefill nameidata with garbage on debug kernels
Modified:
head/sys/sys/namei.h
Modified: head/sys/sys/namei.h
==============================================================================
--- head/sys/sys/namei.h Wed Aug 5 05:58:25 2020 (r363880)
+++ head/sys/sys/namei.h Wed Aug 5 07:28:51 2020 (r363881)
@@ -196,11 +196,21 @@ int cache_fplookup(struct nameidata *ndp, enum cache_f
#define NDINIT_ATVP(ndp, op, flags, segflg, namep, vp, td) \
NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, vp, &cap_no_rights, td)
+/*
+ * Note the constant pattern may *hide* bugs.
+ */
+#ifdef INVARIANTS
+#define NDINIT_PREFILL(arg) memset(arg, 0xff, sizeof(*arg))
+#else
+#define NDINIT_PREFILL(arg) do { } while (0)
+#endif
+
#define NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, startdir, rightsp, td) \
do { \
struct nameidata *_ndp = (ndp); \
cap_rights_t *_rightsp = (rightsp); \
MPASS(_rightsp != NULL); \
+ NDINIT_PREFILL(_ndp); \
_ndp->ni_cnd.cn_nameiop = op; \
_ndp->ni_cnd.cn_flags = flags; \
_ndp->ni_segflg = segflg; \
More information about the svn-src-head
mailing list