From: Yu Kuai <yukuai1@huaweicloud.com>
To: Logan Gunthorpe <logang@deltatee.com>,
Yu Kuai <yukuai1@huaweicloud.com>,
song@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org,
yi.zhang@huawei.com, yangerkun@huawei.com,
"yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH v3 3/3] md: protect md_thread with rcu
Date: Fri, 31 Mar 2023 09:08:19 +0800 [thread overview]
Message-ID: <7efda5d2-96bf-05a4-418d-122bfdf2ce04@huaweicloud.com> (raw)
In-Reply-To: <67b0f0fb-e9f3-b716-f22f-0ca091a291b0@deltatee.com>
Hi, Logan!
在 2023/03/31 3:35, Logan Gunthorpe 写道:
>
> A couple points:
>
> I don't think we need a double pointer here. rcu_dereference() doesn't
> actually do anything but annotate the fact that we are accessing a
> pointer protected by rcu. It does require annotations on that pointer
> (__rcu) which is checked by sparse (I suspect this patch will produce a
> lot of sparse errors from kbuild bot).
>
> I think all we need is:
>
> void md_wakeup_thread(struct md_thread __rcu *rthread)
> {
> struct md_thread *thread;
>
> rcu_read_lock();
> thread = rcu_dereference(rthread);
> ...
> rcu_read_unlock();
>
> }
>
> The __rcu annotation will have to be added to all the pointers this
> function is called on as well as to md_register_thread() and
> md_unregister_thread(). And anything else that uses those pointers.
> Running sparse on the code and eliminating all new errors for the patch
> is important.
Yes, you're right, I'll remove patch 2 and update patch 3. And I'll try
to run sparse before sending the new version.
Thanks,
Kuai
next prev parent reply other threads:[~2023-03-31 1:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 20:20 [PATCH v3 0/3] md: fix uaf for sync_thread Yu Kuai
2023-03-30 20:20 ` [PATCH v3 1/3] md: pass a md_thread pointer to md_register_thread() Yu Kuai
2023-03-30 20:20 ` [PATCH v3 2/3] md: pass a md_thread pointer to md_wakeup_thread() Yu Kuai
2023-03-30 20:20 ` [PATCH v3 3/3] md: protect md_thread with rcu Yu Kuai
2023-03-30 18:40 ` kernel test robot
2023-03-30 19:35 ` Logan Gunthorpe
2023-03-31 1:08 ` Yu Kuai [this message]
2023-03-31 6:36 ` Yu Kuai
2023-03-31 15:41 ` Logan Gunthorpe
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=7efda5d2-96bf-05a4-418d-122bfdf2ce04@huaweicloud.com \
--to=yukuai1@huaweicloud.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=song@kernel.org \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@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
all inboxes | Powered by JetHome®