Re: arm64: perf test 26 rpi4 oops

From: Mike Galbraith
Date: Sun Jul 30 2023 - 01:59:10 EST


On Fri, 2023-07-28 at 15:18 +0100, Will Deacon wrote:
>
> Looking at this quickly with Mark, the most likely explanation is that
> a bogus kernel address is being passed as the source pointer to
> copy_to_user(). On a whim, are you able to revert 4c91c07c93bb ("mm:
> vmalloc: convert vread() to vread_iter()") and see if the issue persists? If
> not, maybe you can try the commit before?

Ok, did that. Neither helped, I had to revert 2e1c0170771e

6.1.42 clean
6.2.16 not so clean
[ 180.564427] __vm_enough_memory: pid: 1935, comm: objdump, no enough memory for the allocation
[ 180.564445] __vm_enough_memory: pid: 1935, comm: objdump, no enough memory for the allocation
6.4.7 oops
+Revert-mm-vmalloc-convert-vread-to-vread_iter.patch oops
+Revert-iov_iter-add-copy_page_to_iter_nofault.patch oops
+Revert-fs-proc-kcore-convert-read_kcore-to-read_kcore_iter.patch oops
+Revert-fs-proc-kcore-avoid-bounce-buffer-for-ktext-data.patch back to 6.2 induced alloc failures
[ 48.718233] __vm_enough_memory: pid: 1747, comm: objdump, not enough memory for the allocation
[ 48.718264] __vm_enough_memory: pid: 1747, comm: objdump, not enough memory for the allocation

6.4.7 plus only arm64 revert (sorta) of e025ab842ec3 does the same
[ 37.587688] Unhandled KCORE type: 0
[ 37.611042] __vm_enough_memory: pid: 1736, comm: objdump, not enough memory for the allocation
[ 37.611073] __vm_enough_memory: pid: 1736, comm: objdump, not enough memory for the allocation

--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -554,6 +554,8 @@ static ssize_t read_kcore_iter(struct ki
fallthrough;
case KCORE_VMEMMAP:
case KCORE_TEXT:
+ if (!kern_addr_valid(start))
+ goto invalid_addr;
/*
* We use _copy_to_iter() to bypass usermode hardening
* which would otherwise prevent this operation.
@@ -563,6 +565,7 @@ static ssize_t read_kcore_iter(struct ki
goto out;
}
break;
+invalid_addr:
default:
pr_warn_once("Unhandled KCORE type: %d\n", m->type);
if (iov_iter_zero(tsz, iter) != tsz) {