From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/3] xfs: use %px for data pointers when debugging
Date: Wed, 10 Jan 2018 10:04:09 +1100 [thread overview]
Message-ID: <20180109230409.GP16421@dastard> (raw)
In-Reply-To: <151553077155.16288.9554063846414673501.stgit@magnolia>
On Tue, Jan 09, 2018 at 12:46:11PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> 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>
It sucks to have to play games like this, but we have to be able to
debug the code somehow....
> diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
> index fd03780..0949bab 100644
> --- a/fs/xfs/xfs_linux.h
> +++ b/fs/xfs/xfs_linux.h
> @@ -291,4 +291,10 @@ static inline uint64_t howmany_64(uint64_t x, uint32_t y)
> #define XFS_IS_REALTIME_MOUNT(mp) (0)
> #endif
>
> +#ifdef DEBUG
> +# define PTR_FMT "%px"
> +#else
> +# define PTR_FMT "%p"
> +#endif
Can you add a comment here explaining why this is different?
Otherwise it looks OK.
Reviewed-by: Dave Chinner <dchinner@redhat.com>
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2018-01-09 23:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-09 20:45 [PATCH 0/3] xfs: printk fixes Darrick J. Wong
2018-01-09 20:45 ` [PATCH 1/3] xfs: change 0x%p -> %p in print messages Darrick J. Wong
2018-01-09 22:59 ` Dave Chinner
2018-01-09 20:46 ` [PATCH 2/3] xfs: use %pS printk format for direct instruction addresses Darrick J. Wong
2018-01-09 23:01 ` Dave Chinner
2018-01-09 20:46 ` [PATCH 3/3] xfs: use %px for data pointers when debugging Darrick J. Wong
2018-01-09 23:04 ` Dave Chinner [this message]
2018-01-09 23:16 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180109230409.GP16421@dastard \
--to=david@fromorbit.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.