* [PATCH] powerpc/mm: Fix missing mmap_sem release
@ 2017-09-07 16:25 Laurent Dufour
2017-09-07 20:51 ` Davidlohr Bueso
0 siblings, 1 reply; 3+ messages in thread
From: Laurent Dufour @ 2017-09-07 16:25 UTC (permalink / raw)
To: benh, mpe, linuxppc-dev; +Cc: linux-kernel
The commit b5c8f0fd595d ("powerpc/mm: Rework mm_fault_error()") reviewed
the way the error path is managed in __do_page_fault() but it was a bit too
agressive when handling a case by returning without releasing the mmap_sem.
By the way, replacing current->mm->mmap_sem by mm->mmap_sem as mm is set to
current->mm.
Fixes: b5c8f0fd595d ("powerpc/mm: Rework mm_fault_error()")
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Laurent Dufour <laurent.du4@free.fr>
---
arch/powerpc/mm/fault.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 4797d08581ce..f799ccf37d27 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -521,10 +521,11 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,
* User mode? Just return to handle the fatal exception otherwise
* return to bad_page_fault
*/
+ up_read(&mm->mmap_sem);
return is_user ? 0 : SIGBUS;
}
- up_read(¤t->mm->mmap_sem);
+ up_read(&mm->mmap_sem);
if (unlikely(fault & VM_FAULT_ERROR))
return mm_fault_error(regs, address, fault);
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/mm: Fix missing mmap_sem release
2017-09-07 16:25 [PATCH] powerpc/mm: Fix missing mmap_sem release Laurent Dufour
@ 2017-09-07 20:51 ` Davidlohr Bueso
2017-09-08 7:08 ` Laurent Dufour
0 siblings, 1 reply; 3+ messages in thread
From: Davidlohr Bueso @ 2017-09-07 20:51 UTC (permalink / raw)
To: Laurent Dufour; +Cc: benh, mpe, linuxppc-dev, linux-kernel
On Thu, 07 Sep 2017, Laurent Dufour wrote:
>The commit b5c8f0fd595d ("powerpc/mm: Rework mm_fault_error()") reviewed
>the way the error path is managed in __do_page_fault() but it was a bit too
>agressive when handling a case by returning without releasing the mmap_sem.
>
>By the way, replacing current->mm->mmap_sem by mm->mmap_sem as mm is set to
>current->mm.
>
>Fixes: b5c8f0fd595d ("powerpc/mm: Rework mm_fault_error()")
>Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>Signed-off-by: Laurent Dufour <laurent.du4@free.fr>
>---
> arch/powerpc/mm/fault.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
>index 4797d08581ce..f799ccf37d27 100644
>--- a/arch/powerpc/mm/fault.c
>+++ b/arch/powerpc/mm/fault.c
But... here:
/*
* If we need to retry the mmap_sem has already been released,
* and if there is a fatal signal pending there is no guarantee
* that we made any progress. Handle this case first.
*/
>@@ -521,10 +521,11 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,
> * User mode? Just return to handle the fatal exception otherwise
> * return to bad_page_fault
> */
>+ up_read(&mm->mmap_sem);
> return is_user ? 0 : SIGBUS;
> }
Per the above comment, for that case handle_mm_fault()
has already released mmap_sem. The same occurs in x86,
for example.
Thanks,
Davidlohr
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/mm: Fix missing mmap_sem release
2017-09-07 20:51 ` Davidlohr Bueso
@ 2017-09-08 7:08 ` Laurent Dufour
0 siblings, 0 replies; 3+ messages in thread
From: Laurent Dufour @ 2017-09-08 7:08 UTC (permalink / raw)
To: Davidlohr Bueso; +Cc: benh, mpe, linuxppc-dev, linux-kernel
On 07/09/2017 22:51, Davidlohr Bueso wrote:
> On Thu, 07 Sep 2017, Laurent Dufour wrote:
>
>> The commit b5c8f0fd595d ("powerpc/mm: Rework mm_fault_error()") reviewed
>> the way the error path is managed in __do_page_fault() but it was a bit too
>> agressive when handling a case by returning without releasing the mmap_sem.
>>
>> By the way, replacing current->mm->mmap_sem by mm->mmap_sem as mm is set to
>> current->mm.
>>
>> Fixes: b5c8f0fd595d ("powerpc/mm: Rework mm_fault_error()")
>> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> Signed-off-by: Laurent Dufour <laurent.du4@free.fr>
>> ---
>> arch/powerpc/mm/fault.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
>> index 4797d08581ce..f799ccf37d27 100644
>> --- a/arch/powerpc/mm/fault.c
>> +++ b/arch/powerpc/mm/fault.c
>
> But... here:
>
> /*
> * If we need to retry the mmap_sem has already been released,
> * and if there is a fatal signal pending there is no guarantee
> * that we made any progress. Handle this case first.
> */
>
>> @@ -521,10 +521,11 @@ static int __do_page_fault(struct pt_regs *regs,
>> unsigned long address,
>> * User mode? Just return to handle the fatal exception otherwise
>> * return to bad_page_fault
>> */
>> + up_read(&mm->mmap_sem);
>> return is_user ? 0 : SIGBUS;
>> }
>
> Per the above comment, for that case handle_mm_fault()
> has already released mmap_sem. The same occurs in x86,
> for example.
Oops, my bad.
Please forget about this stupid patch...
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-09-08 7:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-07 16:25 [PATCH] powerpc/mm: Fix missing mmap_sem release Laurent Dufour
2017-09-07 20:51 ` Davidlohr Bueso
2017-09-08 7:08 ` Laurent Dufour
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).