I just thought of named anonymous VMA may help. We can give the privateBut then that'd require CONFIG_ANON_VMA_NAME unfortunately :(
/dev/zero mapping a name, for example, just "/dev/zero". However,
"[anon:/dev/zero]" will show up in smaps/maps. We can't keep the device
numbers and inode number either, but it seems it can tell the user this
mapping comes from /dev/zero, and it also explicitly tells us it is
specially treated by kernel. Hopefully setting anon_name is permitted.
I think this maps thing is the killer here really.
It'd be nice to -specifically- have a means of expressing this kind of VMA,
we have a means of setting a VMA anon, so maybe we can 'set a VMA to
/dev/zero' and somehow explicitly know that we've done this and identify
this special case.
I'm not sure that the .mmap callback is the right place to do this and I"m
not sure how exactly this would work but this could be workable.
I agree the actual offset into the zero page is of no relevance and no
_sane_ user will care, but this way we could put /dev/zero in [s]maps,
treat this VMA as anon, but also add semantic information about the
existence of this weird corner case.