[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a0e2af81-39de-8c25-e7bd-f2234a0d7f8b@infradead.org>
Date: Fri, 21 Oct 2022 17:02:57 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: Ira Weiny <ira.weiny@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Matthew Wilcox <willy@...radead.org>,
kernel test robot <yujie.liu@...el.com>,
"Fabio M. De Francesco" <fmdefrancesco@...il.com>,
lkp@...ts.01.org, lkp@...el.com, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Peter Xu <peterx@...hat.com>,
Andrea Arcangeli <aarcange@...hat.com>
Subject: Re: [shmem] 7a7256d5f5: WARNING:possible_recursive_locking_detected
On 10/21/22 17:00, Ira Weiny wrote:
>
> I was about to get this patch ready to send when I found this:
>
> commit b6ebaedb4cb1a18220ae626c3a9e184ee39dd248
> Author: Andrea Arcangeli <aarcange@...hat.com>
> Date: Fri Sep 4 15:47:08 2015 -0700
>
> userfaultfd: avoid mmap_sem read recursion in mcopy_atomic
>
> If the rwsem starves writers it wasn't strictly a bug but lockdep
> doesn't like it and this avoids depending on lowlevel implementation
> details of the lock.
>
> [akpm@...ux-foundation.org: delete weird BUILD_BUG_ON()]
> Signed-off-by: Andrea Arcangeli <aarcange@...hat.com>
> Acked-by: Pavel Emelyanov <xemul@...allels.com>
> ...
>
> So I wonder if the true fix is something to lockdep?
>
> Regardless I'll send the below patch because it will restore things to a
> working order.
with ; added to each + line.
> But I'm CC'ing Andrea for comments.
>
> Ira
>
>>
>> Ira
>>
>> diff --git a/mm/shmem.c b/mm/shmem.c
>> index 8280a5cb48df..6c8e99bf5983 100644
>> --- a/mm/shmem.c
>> +++ b/mm/shmem.c
>> @@ -2424,9 +2424,11 @@ int shmem_mfill_atomic_pte(struct mm_struct *dst_mm,
>>
>> if (!zeropage) { /* COPY */
>> page_kaddr = kmap_local_folio(folio, 0);
>> + pagefault_disable()
>> ret = copy_from_user(page_kaddr,
>> (const void __user *)src_addr,
>> PAGE_SIZE);
>> + pagefault_enable()
>> kunmap_local(page_kaddr);
>>
>> /* fallback to copy_from_user outside mmap_lock */
>>
>>
--
~Randy
Powered by blists - more mailing lists