potential riscv special bug maybe found

Alexandre Ghiti alex at ghiti.fr
Fri Aug 11 02:32:19 PDT 2023


Hi Aurélien, Bo,

On 10/08/2023 13:09, Alexandre Ghiti wrote:
> Hi Aurélien, Bo,
>
>
> On 09/08/2023 16:47, Aurelien Jarno wrote:
>> Hi,
>>
>> On 2023-03-09 23:18, Bo YU wrote:
>>> Hi,
>>>
>>> I am sorry if this is noise.
>>>
>>> Some days ago I noticed strace 6.2 was built failed on riscv64 due to
>>> test cases[0]. There is one program from strace can reproduce it:
>>>
>>> ```
>>> ./tests/read-write ```
>>>
>>> It will be hang.
>>>
>>> In fact, the issue has existed since 5.18. I `git bisect` and finally
>>> found out the issue was introduced by the commit[1]:
>>>
>>> commit 631f871f071746789e9242e514ab0f49067fa97a
>>> Author: Andreas Gruenbacher <agruenba at redhat.com>
>>> Date:   Tue Nov 9 12:56:06 2021 +0100
>>>
>>>      fs/iomap: Fix buffered write page prefaulting
>>>
>>> I do not think there is a problem with this commit, because it does not
>>> affect others arch expect riscv and after I reverted it, it will pass
>>> all test cases from strace(There is still one case failed on qemu, but
>>> this is another store).
>>>
>>> I try to debug something but failed.
>>> Would be appreciated it any help.
>> Please find attached a simpler reproducer extracted from strace, which
>> should make the issue easier to reproduce. It hangs on riscv64 and needs
>> to be killed with -9, while it works fine on amd64.
>
>
> Thanks for the reproducer, I was able to reproduce the problem: the 
> kernel is stuck trying to copy data from user, I'm looking into it 
> right now as this seems very weird. Note that I will be on vacation at 
> the end of the week, if I don't have time to fix this, I'll post my 
> findings here.
>

So I was able to find the root cause and I'm about to send a fix, but in 
a nustshell, our copy_[from|to]_user and clear_user routines do not 
return the number of bytes effectively written when a "fixup exception" 
happens, which causes the hang you both observed.

Thank you very much Aurélien for the reproducer, that really helps!

And thanks Bo for the initial report!

Alex


>
> Thanks again,
>
> Alex
>
>
>> Regards
>> Aurelien
>>
>>
>> _______________________________________________
>> linux-riscv mailing list
>> linux-riscv at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-riscv
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv



More information about the linux-riscv mailing list