If you use MAP_FIXED to require mmap to create a mapping at a specific address, then yes it is possible that you are overwriting an existing mapping, such as space allocated by malloc , part of partitions or partitions of a shared library, etc. In principle, there is always an error in using MAP_FIXED if you have not already received the address range by calling mmap without specifying MAP_FIXED (so you know that it belongs to you); in this case, you can intentionally rewrite parts of the display using MAP_FIXED ).
Other answers to everything seemed to miss the fact that you said "close to a specific address", which to me means MAP_FIXED . If you are not using MAP_FIXED , please specify how you get the mapping "close to a specific address".
source share