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

Finn Thain
2024-08-08T01:57:14Z

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.

> 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