diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2018-01-09 12:02:55 -0800 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-01-12 14:09:08 -0800 |
commit | c96900435fa9fdfd9702a60cd765bd85e380303e (patch) | |
tree | bbda292a21a12d0e37644506400a65b5acdb5c81 /fs/xfs/xfs_linux.h | |
parent | aff68a5502d24be416e256478448e228f1a88aaf (diff) | |
download | linux-c96900435fa9fdfd9702a60cd765bd85e380303e.tar.gz linux-c96900435fa9fdfd9702a60cd765bd85e380303e.tar.bz2 linux-c96900435fa9fdfd9702a60cd765bd85e380303e.zip |
xfs: use %px for data pointers when debugging
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>
Diffstat (limited to 'fs/xfs/xfs_linux.h')
-rw-r--r-- | fs/xfs/xfs_linux.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h index 74d3576c8043..bee51a14a906 100644 --- a/fs/xfs/xfs_linux.h +++ b/fs/xfs/xfs_linux.h @@ -291,4 +291,16 @@ static inline uint64_t howmany_64(uint64_t x, uint32_t y) #define XFS_IS_REALTIME_MOUNT(mp) (0) #endif +/* + * 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. + */ +#ifdef DEBUG +# define PTR_FMT "%px" +#else +# define PTR_FMT "%p" +#endif + #endif /* __XFS_LINUX__ */ |