lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87cz2q722b.fsf@nvidia.com>
Date:   Wed, 24 May 2023 14:57:23 +1000
From:   Alistair Popple <apopple@...dia.com>
To:     Zhi Wang <zhi.wang.linux@...il.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>, will@...nel.org,
        catalin.marinas@....com, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, robin.murphy@....com,
        nicolinc@...dia.com, linux-arm-kernel@...ts.infradead.org,
        kvm@...r.kernel.org, jgg@...dia.com,
        John Hubbard <jhubbard@...dia.com>,
        Sean Christopherson <seanjc@...gle.com>
Subject: Re: [PATCH 1/2] mmu_notifiers: Restore documentation for
 .invalidate_range()


Zhi Wang <zhi.wang.linux@...il.com> writes:

> On Wed, 24 May 2023 11:47:28 +1000
> Alistair Popple <apopple@...dia.com> wrote:
>
> It is actually commit 4e15a073a168 ("Revert "mm, mmu_notifier:
> annotate mmu notifiers with blockable invalidate callbacks"")'s problem.
> It tries to revert commit 5ff7091f5a2c but forgets to get back this
> piece of comment.

See my response to John [1]. I don't think it was entirely correct to
remove the comment in the first place but I haven't reviewed that whole
series given it got mostly reverted so I'm probably missing something.

The important thing is the comment is put back and that it was and still
is true. There is enough history in the commit message for people to dig
through how it happened if it's of interest, but commit 4e15a073a168
seems like a reasonble enough thing to put as a Fixes tag so will add
that.

[1] - https://lore.kernel.org/linux-mm/87lehe72v4.fsf@nvidia.com/

> It would be better to have a Fixes tag in the commit message.
>
>> The .invalidate_range() callback is called by
>> mmu_notifier_invalidate_range() which is often called while holding
>> the ptl spin-lock. Therefore any implementations of this callback must
>> not sleep. This was originally documented when the call back was added
>> in commit 0f0a327fa12c ("mmu_notifier: add the callback for
>> mmu_notifier_invalidate_range()") but appears to have been
>> inadvertently removed by commit 5ff7091f5a2c ("mm, mmu_notifier:
>> annotate mmu notifiers with blockable invalidate callbacks").
>> 
>> Restore the comment to make it clear that .invalidate_range()
>> callbacks may not sleep.
>> 
>> Signed-off-by: Alistair Popple <apopple@...dia.com>
>> ---
>>  include/linux/mmu_notifier.h | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
>> index 64a3e05..447d757 100644
>> --- a/include/linux/mmu_notifier.h
>> +++ b/include/linux/mmu_notifier.h
>> @@ -200,6 +200,9 @@ struct mmu_notifier_ops {
>>  	 * external TLB range needs to be flushed. For more in depth
>>  	 * discussion on this see Documentation/mm/mmu_notifier.rst
>>  	 *
>> +	 * The invalidate_range() function is called under the ptl
>> +	 * spin-lock and not allowed to sleep.
>> +	 *
>>  	 * Note that this function might be called with just a sub-range
>>  	 * of what was passed to invalidate_range_start()/end(), if
>>  	 * called between those functions.
>> 
>> base-commit: 44c026a73be8038f03dbdeef028b642880cf1511

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ