All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Dufour <ldufour@linux.ibm.com>
To: David Hildenbrand <david@redhat.com>,
	linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, Sachin Sant <sachinp@linux.ibm.com>,
	Suren Baghdasaryan <surenb@google.com>
Subject: Re: [PATCH] powerpc/mm: fix mmap_lock bad unlock
Date: Mon, 6 Mar 2023 15:09:04 +0100	[thread overview]
Message-ID: <d720d943-ea5d-451b-b8fa-ec9ad56f6dbf@linux.ibm.com> (raw)
In-Reply-To: <7161f75e-9f40-f881-84b8-1eaaec0b0e3f@redhat.com>

On 06/03/2023 15:07:26, David Hildenbrand wrote:
> On 06.03.23 14:55, Laurent Dufour wrote:
>> When page fault is tried holding the per VMA lock, bad_access_pkey() and
>> bad_access() should not be called because it is assuming the mmap_lock is
>> held.
>> In the case a bad access is detected, fall back to the default path,
>> grabbing the mmap_lock to handle the fault and report the error.
>>
>> Fixes: 169db3bb4609 ("powerc/mm: try VMA lock-based page fault handling
>> first")
>> Reported-by: Sachin Sant <sachinp@linux.ibm.com>
>> Link:
>> https://lore.kernel.org/linux-mm/842502FB-F99C-417C-9648-A37D0ECDC9CE@linux.ibm.com
>> Cc: Suren Baghdasaryan <surenb@google.com>
>> Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
>> ---
>>   arch/powerpc/mm/fault.c | 8 ++------
>>   1 file changed, 2 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
>> index c7ae86b04b8a..e191b3ebd8d6 100644
>> --- a/arch/powerpc/mm/fault.c
>> +++ b/arch/powerpc/mm/fault.c
>> @@ -479,17 +479,13 @@ static int ___do_page_fault(struct pt_regs *regs,
>> unsigned long address,
>>         if (unlikely(access_pkey_error(is_write, is_exec,
>>                          (error_code & DSISR_KEYFAULT), vma))) {
>> -        int rc = bad_access_pkey(regs, address, vma);
>> -
>>           vma_end_read(vma);
>> -        return rc;
>> +        goto lock_mmap;
>>       }
>>         if (unlikely(access_error(is_write, is_exec, vma))) {
>> -        int rc = bad_access(regs, address);
>> -
>>           vma_end_read(vma);
>> -        return rc;
>> +        goto lock_mmap;
>>       }
>>         fault = handle_mm_fault(vma, address, flags |
>> FAULT_FLAG_VMA_LOCK, regs);
> 
> IIUC, that commit is neither upstream not in mm-stable -- it's unstable.
> Maybe raise that as a review comment in reply to the original patch, so we
> can easily connect the dots and squash it into the original, problematic
> patch that is still under review.
> 
Oh yes, I missed that. I'll reply to the Suren's thread.

Thanks,
Laurent.

WARNING: multiple messages have this Message-ID (diff)
From: Laurent Dufour <ldufour@linux.ibm.com>
To: David Hildenbrand <david@redhat.com>,
	linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org
Cc: Suren Baghdasaryan <surenb@google.com>,
	linux-kernel@vger.kernel.org, Sachin Sant <sachinp@linux.ibm.com>
Subject: Re: [PATCH] powerpc/mm: fix mmap_lock bad unlock
Date: Mon, 6 Mar 2023 15:09:04 +0100	[thread overview]
Message-ID: <d720d943-ea5d-451b-b8fa-ec9ad56f6dbf@linux.ibm.com> (raw)
In-Reply-To: <7161f75e-9f40-f881-84b8-1eaaec0b0e3f@redhat.com>

On 06/03/2023 15:07:26, David Hildenbrand wrote:
> On 06.03.23 14:55, Laurent Dufour wrote:
>> When page fault is tried holding the per VMA lock, bad_access_pkey() and
>> bad_access() should not be called because it is assuming the mmap_lock is
>> held.
>> In the case a bad access is detected, fall back to the default path,
>> grabbing the mmap_lock to handle the fault and report the error.
>>
>> Fixes: 169db3bb4609 ("powerc/mm: try VMA lock-based page fault handling
>> first")
>> Reported-by: Sachin Sant <sachinp@linux.ibm.com>
>> Link:
>> https://lore.kernel.org/linux-mm/842502FB-F99C-417C-9648-A37D0ECDC9CE@linux.ibm.com
>> Cc: Suren Baghdasaryan <surenb@google.com>
>> Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
>> ---
>>   arch/powerpc/mm/fault.c | 8 ++------
>>   1 file changed, 2 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
>> index c7ae86b04b8a..e191b3ebd8d6 100644
>> --- a/arch/powerpc/mm/fault.c
>> +++ b/arch/powerpc/mm/fault.c
>> @@ -479,17 +479,13 @@ static int ___do_page_fault(struct pt_regs *regs,
>> unsigned long address,
>>         if (unlikely(access_pkey_error(is_write, is_exec,
>>                          (error_code & DSISR_KEYFAULT), vma))) {
>> -        int rc = bad_access_pkey(regs, address, vma);
>> -
>>           vma_end_read(vma);
>> -        return rc;
>> +        goto lock_mmap;
>>       }
>>         if (unlikely(access_error(is_write, is_exec, vma))) {
>> -        int rc = bad_access(regs, address);
>> -
>>           vma_end_read(vma);
>> -        return rc;
>> +        goto lock_mmap;
>>       }
>>         fault = handle_mm_fault(vma, address, flags |
>> FAULT_FLAG_VMA_LOCK, regs);
> 
> IIUC, that commit is neither upstream not in mm-stable -- it's unstable.
> Maybe raise that as a review comment in reply to the original patch, so we
> can easily connect the dots and squash it into the original, problematic
> patch that is still under review.
> 
Oh yes, I missed that. I'll reply to the Suren's thread.

Thanks,
Laurent.

  reply	other threads:[~2023-03-06 14:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06 13:55 [PATCH] powerpc/mm: fix mmap_lock bad unlock Laurent Dufour
2023-03-06 13:55 ` Laurent Dufour
2023-03-06 14:07 ` David Hildenbrand
2023-03-06 14:07   ` David Hildenbrand
2023-03-06 14:09   ` Laurent Dufour [this message]
2023-03-06 14:09     ` Laurent Dufour
2023-03-06 17:13     ` Suren Baghdasaryan
2023-03-06 17:13       ` Suren Baghdasaryan
  -- strict thread matches above, loose matches on Subject: below --
2023-02-27 17:36 [PATCH v4 31/33] powerc/mm: try VMA lock-based page fault handling first Suren Baghdasaryan
2023-03-06 15:42 ` [PATCH] powerpc/mm: fix mmap_lock bad unlock Laurent Dufour
2023-03-06 15:42   ` Laurent Dufour

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=d720d943-ea5d-451b-b8fa-ec9ad56f6dbf@linux.ibm.com \
    --to=ldufour@linux.ibm.com \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=sachinp@linux.ibm.com \
    --cc=surenb@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.