An example device driver that allows to mmap a single kernel accessible page
Tested with Linux v5.11.
make -C /path/to/kernel/source M=`pwd` modules
insmod kernel-mmap-device.c
A character device is created at /dev/kernel-mmap-device
This device can be open
ed read-only and the first page can then be mmap
ed to read the kernel memory page.
GPLv2 or later