From: Long Li <leo.lilong@huawei.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: <djwong@kernel.org>, <chandanbabu@kernel.org>,
<linux-xfs@vger.kernel.org>, <david@fromorbit.com>,
<yi.zhang@huawei.com>, <houtao1@huawei.com>,
<yangerkun@huawei.com>
Subject: Re: [PATCH 3/5] xfs: add XFS_ITEM_UNSAFE for log item push return result
Date: Tue, 27 Aug 2024 17:41:49 +0800 [thread overview]
Message-ID: <20240827094149.GB2719005@ceph-admin> (raw)
In-Reply-To: <ZslU0yvCX9pbJq8C@infradead.org>
On Fri, Aug 23, 2024 at 08:34:43PM -0700, Christoph Hellwig wrote:
> On Fri, Aug 23, 2024 at 07:04:37PM +0800, Long Li wrote:
> > After pushing log items, the log item may have been freed, making it
> > unsafe to access in tracepoints. This commit introduces XFS_ITEM_UNSAFE
> > to indicate when an item might be freed during the item push operation.
>
> So instead of this magic unsafe operation I think declaring a rule that
> the lip must never be accessed after the return is the much saner
> choice.
>
> We'll then need to figure out how we can still keep useful tracing
> without accessing the lip. The only information the trace points need
> from the lip itself are the type, flags, and lsn and those seem small
> enough to save on the stack before calling into ->iop_push.
>
>
Hi Christoph,
Thank you for pointing out the issues with the current approach. Establishing
a rule to not access 'lip' after the item has been pushed would indeed make
the logic clearer.
However, saving the log item information that needs to be traced on the stack
also looks unappealing:
1. We would need to add new log item trace code, instead of using the
generic DEFINE_LOG_ITEM_EVENT macro definition. This increases code
redundancy.
2. We would need to use CONFIG_TRACEPOINTS to manage whether we need
to save type, flags, lsn, and other information on the stack.
3. If we need to extend tracing to other fields of the log item in
the future, we would need to add new variables.
If we save log item on the stack before each push, I think it would affect
performance, although this impact would be minimal. I wonder what other
people's opinions are?
Thanks,
Long Li
next prev parent reply other threads:[~2024-08-27 9:31 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-23 11:04 [PATCH 0/5] xfs: fix and cleanups for log item push Long Li
2024-08-23 11:04 ` [PATCH 1/5] xfs: remove redundant set null for ip->i_itemp Long Li
2024-08-23 16:37 ` Darrick J. Wong
2024-08-25 4:52 ` Christoph Hellwig
2024-08-23 11:04 ` [PATCH 2/5] xfs: ensuere deleting item from AIL after shutdown in dquot flush Long Li
2024-08-23 17:00 ` Darrick J. Wong
2024-08-24 3:08 ` Long Li
2024-08-27 9:40 ` Dave Chinner
2024-08-31 13:45 ` Long Li
2024-08-23 11:04 ` [PATCH 3/5] xfs: add XFS_ITEM_UNSAFE for log item push return result Long Li
2024-08-23 17:17 ` Darrick J. Wong
2024-08-24 3:30 ` Long Li
2024-08-27 9:44 ` Dave Chinner
2024-08-24 3:34 ` Christoph Hellwig
2024-08-27 9:41 ` Long Li [this message]
2024-08-27 10:00 ` Dave Chinner
2024-08-27 12:30 ` Christoph Hellwig
2024-08-27 21:52 ` Dave Chinner
2024-08-28 4:23 ` Christoph Hellwig
2024-08-29 10:16 ` Dave Chinner
2024-08-23 11:04 ` [PATCH 4/5] xfs: fix a UAF when dquot item push Long Li
2024-08-23 17:20 ` Darrick J. Wong
2024-08-24 2:03 ` Long Li
2024-08-23 11:04 ` [PATCH 5/5] xfs: fix a UAF when inode " Long Li
2024-08-23 17:22 ` Darrick J. Wong
2024-08-27 8:14 ` Long Li
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=20240827094149.GB2719005@ceph-admin \
--to=leo.lilong@huawei.com \
--cc=chandanbabu@kernel.org \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=houtao1@huawei.com \
--cc=linux-xfs@vger.kernel.org \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox