[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <57CBF6B2-4745-4E36-9AA5-7E0876E3DA8F@lca.pw>
Date: Sat, 18 Apr 2020 09:01:35 -0400
From: Qian Cai <cai@....pw>
To: Joerg Roedel <joro@...tes.org>
Cc: iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH] iommu/amd: fix a race in fetch_pte()
> On Apr 18, 2020, at 8:10 AM, Joerg Roedel <joro@...tes.org> wrote:
>
> Yes, your patch still looks racy. You need to atomically read
> domain->pt_root to a stack variable and derive the pt_root pointer and
> the mode from that variable instead of domain->pt_root directly. If you
> read the domain->pt_root twice there could still be an update between
> the two reads.
> Probably the lock in increase_address_space() can also be avoided if
> pt_root is updated using cmpxchg()?
Hard to tell without testing further. I’ll leave that optimization in the future, and focus on fixing those races first.
Powered by blists - more mailing lists