Re: [PATCH v4 1/2] m68k: Handle __generic_copy_to_user faults more carefully

Michael Schmitz
2024-08-08T06:58:12Z

Hi Greg,

Am 08.08.2024 um 18:05 schrieb Greg Ungerer:
> Hi Michael, Finn,
>
> On 8/8/24 11:57, Finn Thain wrote:
>>
>> Hello Michael
>>
>> On Thu, 8 Aug 2024, Michael Schmitz wrote:
>>
>>>> Well, that __clear_user() bug is no longer theoretical. I accidentally
>>>> bumped into it when I sent a ^C to a shell script I wrote to test some
>>>> mac_scsi driver patches...
>>
>> ...
>>
>>>
>>> I'm afraid I've lost track of where we're at with this patch series.
>>> Does it need more work, or more bug reports such as the one below?
>>
>> Apparently the series is waiting for some testing on a Coldfire system
>> with MMU.
>
> Ok, I am in a state that I can do that now (I managed to fix my M5475EVB
> board).
> If I test the v4 versions of this patch set that should do the job?

Yes, v4 is the one to test.

I'll see that I can dig out my test code to reproduce the bug.

Thanks,

Michael

>
> Regards
> Greg
>
>
>
>>> The previous bug reports might be considered somewhat contrived but this
>>> one's from 'real' user space code, and none too complex at that?
>>>
>>
>> Right. That code was as follows. There's nothing here aimed at
>> arch/m68k/lib/uaccess.c in particular, just IO to a block device and a
>> tmpfs filesystem.
>>
>>
>> #!/bin/bash
>>
>> set -e -u
>>
>> filename=$1
>>
>> rand=/tmp/rand_test_data
>> zero=/tmp/zero_test_data
>> len=512K
>>
>> dd if=/dev/urandom of=$rand bs=$len count=1 2>/dev/null
>> dd if=/dev/zero of=$zero bs=$len count=1 2>/dev/null
>>
>> write() {
>> dd $args if=$orig of=$filename # oflag=direct
>> }
>>
>> compare() {
>> echo 3 > /proc/sys/vm/drop_caches
>> if ! cmp -n $len $orig $filename ; then
>> diff -u <(hexdump -C < $orig) <(hexdump -C < $filename)
>> fi
>> }
>>
>> while true; do
>> for args in "bs=512k count=1" "bs=64k count=8" "bs=4k
>> count=128" "bs=512 count=1k" ; do
>> echo $args
>> orig=$rand ; write ; compare
>> orig=$zero ; write ; compare
>> sync
>> echo
>> done
>> done