[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210310160612.dd57fcc60cbc4cc4bf86b869@linux-foundation.org>
Date: Wed, 10 Mar 2021 16:06:12 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Sean Christopherson <seanjc@...gle.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
David Rientjes <rientjes@...gle.com>,
Ben Gardon <bgardon@...gle.com>,
Jason Gunthorpe <jgg@...pe.ca>, Michal Hocko <mhocko@...e.com>,
=?ISO-8859-1?Q? "J=E9r=F4m?= =?ISO-8859-1?Q?e_Glisse" ?=
<jglisse@...hat.com>, Andrea Arcangeli <aarcange@...hat.com>,
Johannes Weiner <hannes@...xchg.org>,
Dimitri Sivanich <dimitri.sivanich@....com>
Subject: Re: [PATCH] mm/oom_kill: Ensure MMU notifier range_end() is paired
with range_start()
On Wed, 10 Mar 2021 13:31:17 -0800 Sean Christopherson <seanjc@...gle.com> wrote:
> Invoke the MMU notifier's .invalidate_range_end() callbacks even if one
> of the .invalidate_range_start() callbacks failed. If there are multiple
> notifiers, the notifier that did not fail may have performed actions in
> its ...start() that it expects to unwind via ...end(). Per the
> mmu_notifier_ops documentation, ...start() and ...end() must be paired.
>
> The only in-kernel usage that is fatally broken is the SGI UV GRU driver,
> which effectively blocks and sleeps fault handlers during ...start(), and
> unblocks/wakes the handlers during ...end(). But, the only users that
> can fail ...start() are the i915 and Nouveau drivers, which are unlikely
> to collide with the SGI driver.
>
> KVM is the only other user of ...end(), and while KVM also blocks fault
> handlers in ...start(), the fault handlers do not sleep and originate in
> killable ioctl() calls. So while it's possible for the i915 and Nouveau
> drivers to collide with KVM, the bug is benign for KVM since the process
> is dying and KVM's guest is about to be terminated.
>
> So, as of today, the bug is likely benign. But, that may not always be
> true, e.g. there is a potential use case for blocking memslot updates in
> KVM while an invalidation is in-progress, and failure to unblock would
> result in said updates being blocked indefinitely and hanging.
>
> Found by inspection. Verified by adding a second notifier in KVM that
> periodically returns -EAGAIN on non-blockable ranges, triggering OOM,
> and observing that KVM exits with an elevated notifier count.
Given that there's no way known of triggering this in 5.11 or earlier,
I'd normally question the need to backport into -stable kernels.
But I guess that people might later develop modules which they want to
load into earlier kernels, in which case this might bite them. So I
agree on the cc:stable thing.
Powered by blists - more mailing lists