I would guess that the people using msync to check whether an address is valid are using it more because it doesn't require you to have any open file descriptors, than because they're being "careful." In fact, it's not even clear according to the man page that you can use msync on memory that wasn't allocated with mmap. I really have no idea what msync is "supposed" to do on memory allocated with brk, for example. So it's just another case of people relying on some pretty hairy implementation details.
As far as I can see, your best bet for checking address validity probably is "mincore." It definitely doesn't make any sense for a shim library to intercept that function.
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds