From: Li Lingfeng <lilingfeng3@huawei.com>
To: Mikulas Patocka <mpatocka@redhat.com>, Hou Tao <houtao1@huawei.com>
Cc: <dm-devel@lists.linux.dev>, <agk@redhat.com>,
<snitzer@kernel.org>, <tusharsu@linux.microsoft.com>,
<colin.i.king@gmail.com>, <linux-kernel@vger.kernel.org>,
<yi.zhang@huawei.com>, <yangerkun@huawei.com>,
<yukuai3@huawei.com>, <chengzhihao1@huawei.com>,
<lilingfeng@huaweicloud.com>
Subject: Re: [PATCH] dm: introduce spinlocks to prevent concurrent usage and release of device_metadata and hash
Date: Fri, 18 Jul 2025 09:28:34 +0800 [thread overview]
Message-ID: <5d63f92f-1b48-445f-8cbb-a6ae148d36aa@huawei.com> (raw)
In-Reply-To: <5be1fab4-192d-8327-b541-bb92d53313cc@redhat.com>
在 2025/7/18 2:45, Mikulas Patocka 写道:
>
> On Thu, 17 Jul 2025, Hou Tao wrote:
>
>> Hi,
>>
>> On 7/17/2025 10:07 PM, Li Lingfeng wrote:
>>> There is a window between freeing md->ima.active_table.hash and setting
>>> md->ima.active_table.hash to NULL in dm_ima_measure_on_device_resume().
>>> If dm_ima_measure_on_device_remove() accesses md->ima.active_table.hash
>>> concurrently during this window, it could lead to a double free or UAF,
>>> as shown below:
>> The UAF is a problem. However, I think the order of
>> dm_ima_measure_on_device_remove() and dm_ima_measure_on_device_resume is
>> bigger problem. Is it possible to order these two invocations properly
>> by using suspend_lock ?
> That's a good point. The patch just papers over the problem. It will fix
> the UAF warning, but it won't fix the fact that
> dm_ima_measure_on_device_resume can race with
> dm_ima_measure_on_device_remove.
>
> The real fix would be to make sure that dm_ima_measure_* calls are never
> called concurrently on the same table - we should use existing device
> mapper locks for that.
>
> Mikukas
>
Thanks for your advice, I will send a new patch soon.
Thanks,
Lingfeng
prev parent reply other threads:[~2025-07-18 1:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-17 14:07 Li Lingfeng
2025-07-17 9:43 ` Hou Tao
2025-07-17 18:45 ` Mikulas Patocka
2025-07-18 1:28 ` Li Lingfeng [this message]
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=5d63f92f-1b48-445f-8cbb-a6ae148d36aa@huawei.com \
--to=lilingfeng3@huawei.com \
--cc=agk@redhat.com \
--cc=chengzhihao1@huawei.com \
--cc=colin.i.king@gmail.com \
--cc=dm-devel@lists.linux.dev \
--cc=houtao1@huawei.com \
--cc=lilingfeng@huaweicloud.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=snitzer@kernel.org \
--cc=tusharsu@linux.microsoft.com \
--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®