Use `mmap` to check the pages in batch and `mprotect` to check one by one. Check the link for more details. (both Chinese and English version are provided)
Original writeup (https://jo4-code.blogspot.com/2019/05/def-con-ctf-qualifier-2019-knowyourmem.html).