diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-02-26 22:43:18 -0600 |
---|---|---|
committer | Eric Sandeen <sandeen@redhat.com> | 2018-02-26 22:43:18 -0600 |
commit | d7e71605e73f5c05ac029046d56781b675311592 (patch) | |
tree | 297be88297f165feb76e23eeb28cd3da1665e72c | |
parent | ef4109d1b66633808ed945c13e6478a5eb09952f (diff) | |
download | xfsprogs-dev-d7e71605e73f5c05ac029046d56781b675311592.tar.gz |
xfs: use %px for data pointers when debugging
Source kernel commit: c96900435fa9fdfd9702a60cd765bd85e380303e
Starting with commit 57e734423ad ("vsprintf: refactor %pK code out of
pointer"), the behavior of the raw '%p' printk format specifier was
changed to print a 32-bit hash of the pointer value to avoid leaking
kernel pointers into dmesg. For most situations that's good.
This is /undesirable/ behavior when we're trying to debug XFS, however,
so define a PTR_FMT that prints the actual pointer when we're in debug
mode.
Note that %p for tracepoints still prints the raw pointer, so in the
long run we could consider rewriting some of these messages as
tracepoints.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r-- | libxfs/libxfs_priv.h | 10 | ||||
-rw-r--r-- | libxfs/xfs_dir2_node.c | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h index 130f6ed2bb..637493d733 100644 --- a/libxfs/libxfs_priv.h +++ b/libxfs/libxfs_priv.h @@ -102,6 +102,16 @@ extern char *progname; #define STATIC static +/* + * Starting in Linux 4.15, the %p (raw pointer value) printk modifier + * prints a hashed version of the pointer to avoid leaking kernel + * pointers into dmesg. If we're trying to debug the kernel we want the + * raw values, so override this behavior as best we can. + * + * In userspace we don't have this problem. + */ +#define PTR_FMT "%p" + /* XXX: need to push these out to make LIBXFS_ATTR defines */ #define ATTR_ROOT 0x0002 #define ATTR_SECURE 0x0008 diff --git a/libxfs/xfs_dir2_node.c b/libxfs/xfs_dir2_node.c index ab9c4afbf1..399926457a 100644 --- a/libxfs/xfs_dir2_node.c +++ b/libxfs/xfs_dir2_node.c @@ -1916,7 +1916,7 @@ xfs_dir2_node_addname_int( (unsigned long long)ifbno, lastfbno); if (fblk) { xfs_alert(mp, - " fblk %p blkno %llu index %d magic 0x%x", + " fblk "PTR_FMT" blkno %llu index %d magic 0x%x", fblk, (unsigned long long)fblk->blkno, fblk->index, |