joshlf
joshlf

Reputation: 23577

Can mremap place mappings at 0?

According to both the Linux man page and the POSIX spec, mmap will not place new mappings at address 0 so long as the MAP_FIXED flag isn't provided.

Is the same true for Linux's mremap? The man page description for the REMAP_FIXED flag says that it "serves a similar purpose to the MAP_FIXED flag of mmap(2)," but doesn't explicitly say that, if it's not present, mremap is guaranteed to not place the mapping at 0.

Is this guarantee actually made? If so, is it documented somewhere?

Upvotes: 0

Views: 81

Answers (1)

Florian Weimer
Florian Weimer

Reputation: 33719

No, Linux mremap will not place mappings at address 0. Most systems will not even do this if MREMAP_FIXED is specified.

Upvotes: 1

Related Questions