17.8.1.1.1. memfile.c

This example behaves the same as fops.c, except that the in-memory virtual file has unlimited size. In the kernel module we have therefore to so a bit of memory management and somehow increase the size of the buffer as needed.

TODO: this example builds but oopses with out of memory on our currently default kernel v5.9.2 when doing the big allocation at:

dd if=/dev/zero of="$f" bs=1k count=1M

It works however on kernel 6.8.12, we’re not sure why. We do have a potential krealloc vs kvrealloc on version check which is a very likely reason for the issue, but it has not been investigated.