On Mon, 13 Jan 2025 14:15:38 +0100 Thomas Weißschuh
<[email protected]> wrote:
> The virtual_address_range selftest reads from the start of each mapping
> listed in /proc/self/maps.
> However not all mappings are valid to be arbitrarily accessed.
>
> For example the vvar data used for virtual clocks on x86 [vvar_vclock]
> can only be accessed if 1) the kernel configuration enables virtual
> clocks and 2) the hypervisor provided the data for it.
> Only the VDSO itself has the necessary information to know this.
> Since commit e93d2521b27f ("x86/vdso: Split virtual clock pages into
> dedicated mapping")
> the virtual clock data was split out into its own mapping, leading
> to EFAULT from read() during the validation.
>
> Check for the VM_IO flag as a proxy.
> It is present for the VVAR mappings and MMIO ranges can be dangerous to
> access arbitrarily.
>
> Reported-by: kernel test robot <[email protected]>
> Closes: https://lore.kernel.org/oe-lkp/[email protected]
> Fixes: e93d2521b27f ("x86/vdso: Split virtual clock pages into dedicated
> mapping")
> Fixes: 010409649885 ("selftests/mm: confirm VA exhaustion without reliance on
> correctness of mmap()")
> Suggested-by: David Hildenbrand <[email protected]>
> Link:
> https://lore.kernel.org/lkml/[email protected]/
> Signed-off-by: Thomas Weißschuh <[email protected]>
>
> Revert "selftests/mm: virtual_address_range: Avoid reading VVAR mappings"
>
> This reverts commit 05cc5d292ac4238684b59922aecf59c932edefa0.
I'm assuming that the above two lines simply shouldn't be here?