Skip to contentSkip to conversation

mmap to fixed adr

DISCUSSION Volker Poplawski 2 participants 2 messages Jun 19, 2011

lore
Share & tools
lore
#0 lore raw

Hi,

is there a VA range in userspace which is always safe for mmap() with fixed adr? (x86_64 mostly)

I.e. a VA range where mmap() or ld will never map memory.

I know I can try particular fixed adr with mmap() and check if the mapping succeeds. However this is not what I want. I want mmap() to stay clear of certain ranges and map memory there myself.

Regards
.....Volker

#1 lore raw
Quoted 6 lines · Volker Poplawski

Hi,

is there a VA range in userspace which is always safe for mmap() with fixed adr? (x86_64 mostly)

I.e. a VA range where mmap() or ld will never map memory.

likely, you can find it out by yourself using:
cat /proc/self/maps | head

there you can find where kernel maps the very first object. Then, IMO, all you need to do is preceed that address. Beware, IMHO, don't start with address 0 as you might screw NULL handler.

Signature · 7 lines
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com