Opened 13 years ago

Closed 12 years ago

#3325 closed Bugs (wontfix)

Limited support for mapping regions to specific addresses in Linux

Reported by: Andy Schneider <andrew.schneider@…> Owned by: Ion Gaztañaga
Milestone: Boost 1.40.0 Component: interprocess
Version: Boost 1.39.0 Severity: Showstopper
Keywords: Cc:

Description

Hi,

Changeset 3098 removed the use of MAP_FIXED when an address was provided to boost::mapped_region's constructor. I have a use-case where I need to construct a partially overlapping set of memory mappings. Without MAP_FIXED, on Linux mmap() doesn't use my address hint (because of the overlap) and my use-case fails.

I have read the short debate about the use of MAP_FIXED being dangerous and support being withdrawn and I'd like to challenge the conclusion:

1) Overlapping mmap's are part of a pattern for implementing a poor mans circular addressing on platforms that don't support that. Currently this pattern is ruled out.

2) Whilst some might cut themselves with the sharp knife of overlapping mmaps, that isn't in a sufficient reason to remove a feature supporting legitimate use-cases.

I've patched this locally for my purposes. Perhaps we need an additional flag to turn on support for overlapping mmaps (where this exists - which isn't Windows)?

I've flagged this as a Showstopper as I would not be able to complete my solution without the patch I've put in place.

Change History (3)

comment:1 by Andy Schneider <andrew.schneider@…>, 13 years ago

Another solution would be to separate out the mapping action from some 'reserve virtual address range' function. That would allow you to reserve a virtual address range and then map a file into that without explicitly having an overlapping mmap exposed in the API. It'd solve one of the patterns for using overlapping mappings on Linux. It's not fully general though.

comment:2 by Steven Watanabe, 13 years ago

Component: Noneinterprocess
Owner: set to Ion Gaztañaga

comment:3 by Ion Gaztañaga, 12 years ago

Resolution: wontfix
Status: newclosed

For portability MAP_FIXED won't be supported.

Note: See TracTickets for help on using tickets.