> On Jul 7, 2025, at 2:19 PM, Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote: > > On Mon, Jul 7, 2025 at 1:44 PM Yifei Liu <yifei.l.liu@xxxxxxxxxx> wrote: >> >> Hi Alexei, >> >> I recently noticed that the verifier_arena_large selftest would fail on the overflow and underflow section for 64k page size kernels. After a deeper investigation, the similar issue is also reproducible on 4k page size over both x86 and aarch64 platforms. >> >> The root reason of this failure looks to be a failed or missing check of the pointer upper 32-bit from the user space. User space could access the arena space value even the pointer is not in the assigned user space pointer range. For example, if the user_vm_start is 7f7d26200000 and arena size is 4G (end upper bound is 7f7e26200000), when I set *(7f7e26200000 - 65536) = 20, I could also get the value of (7f7d26200000 - 65536) as 20. It should be 0 if that is out of the range. >> >> Could you please take a look at this issue? Or could you please point me where is the place doing the address translation and I could try to provide a patch for this? >> >> Thank you very much. >> Yifei >> >> Methods on reproduce: >> 1. Use a 64k page size arm based kernel and run verifier_arena_large selftest, it would failed on return 12 and 13. Or > > Are you sure you're running the latest kernel ? > This sounds like issue fixed in commit 517e8a7835e8 ("bpf: Fix > softlockup in arena_map_free on 64k page kernel”) Thanks for the reply. I do check this fix and it is not related to the one I mentioned above. It just fix the guard range so that it would not set the start address without page alignment. > > In general this is not a security vulnerability in any way. > 32-bit wraparound is there by design. If we do not check the upper 32-bit value, it would be wide open for user-space to access the arena space. And maybe even the user-space process cannot access the memory outside the 4G area because it would try to translate all the pointers to that area. Plus, it would consistently fail the verifier_arena_large selftest for 64k page size kernels. Maybe we want to skip some of the overflow/underflow tests if the page size is 64k? Thank you Yifei