Re: [PATCH v2] mmap.2: MAP_FIXED updated documentation

2017-12-09 Thread John Hubbard
On 12/09/2017 09:19 AM, Pavel Machek wrote: > On Thu 2017-12-07 15:02:21, Michal Hocko wrote: >> On Thu 07-12-17 13:58:05, Cyril Hrubis wrote: >>> Hi! >> (It does seem unfortunate that the man page cannot help the programmer >> actually write correct code here. He or she is forced to read t

Re: [PATCH v2] mmap.2: MAP_FIXED updated documentation

2017-12-09 Thread Pavel Machek
On Thu 2017-12-07 15:02:21, Michal Hocko wrote: > On Thu 07-12-17 13:58:05, Cyril Hrubis wrote: > > Hi! > > > >> (It does seem unfortunate that the man page cannot help the programmer > > > >> actually write correct code here. He or she is forced to read the > > > >> kernel > > > >> implementation

Re: [PATCH v2] mmap.2: MAP_FIXED updated documentation

2017-12-07 Thread Cyril Hrubis
Hi! > >> (It does seem unfortunate that the man page cannot help the programmer > >> actually write correct code here. He or she is forced to read the kernel > >> implementation, in order to figure out the true alignment rules. I was > >> hoping we could avoid that.) > > > > It would be nice if we

Re: [PATCH v2] mmap.2: MAP_FIXED updated documentation

2017-12-07 Thread Michal Hocko
On Thu 07-12-17 13:58:05, Cyril Hrubis wrote: > Hi! > > >> (It does seem unfortunate that the man page cannot help the programmer > > >> actually write correct code here. He or she is forced to read the kernel > > >> implementation, in order to figure out the true alignment rules. I was > > >> hopi

Re: [PATCH v2] mmap.2: MAP_FIXED updated documentation

2017-12-06 Thread John Hubbard
On 12/06/2017 02:01 AM, Cyril Hrubis wrote: > Hi! >> (It does seem unfortunate that the man page cannot help the programmer >> actually write correct code here. He or she is forced to read the kernel >> implementation, in order to figure out the true alignment rules. I was >> hoping we could avoid

Re: [PATCH v2] mmap.2: MAP_FIXED updated documentation

2017-12-06 Thread Cyril Hrubis
Hi! > (It does seem unfortunate that the man page cannot help the programmer > actually write correct code here. He or she is forced to read the kernel > implementation, in order to figure out the true alignment rules. I was > hoping we could avoid that.) It would be nice if we had this informatio

Re: [PATCH v2] mmap.2: MAP_FIXED updated documentation

2017-12-05 Thread Michal Hocko
On Mon 04-12-17 23:42:00, John Hubbard wrote: > On 12/04/2017 11:05 PM, Michal Hocko wrote: > > On Mon 04-12-17 18:14:18, John Hubbard wrote: > >> On 12/04/2017 02:55 AM, Cyril Hrubis wrote: > >>> Hi! > >>> I know that we are not touching the rest of the existing description for > >>> MAP_FIXED how

Re: [PATCH v2] mmap.2: MAP_FIXED updated documentation

2017-12-04 Thread John Hubbard
On 12/04/2017 11:08 PM, Michal Hocko wrote: > On Mon 04-12-17 18:52:27, John Hubbard wrote: >> On 12/04/2017 03:31 AM, Mike Rapoport wrote: >>> On Sun, Dec 03, 2017 at 06:14:11PM -0800, john.hubb...@gmail.com wrote: From: John Hubbard >> [...] +.IP +Given the above limitations,

Re: [PATCH v2] mmap.2: MAP_FIXED updated documentation

2017-12-04 Thread John Hubbard
On 12/04/2017 11:05 PM, Michal Hocko wrote: > On Mon 04-12-17 18:14:18, John Hubbard wrote: >> On 12/04/2017 02:55 AM, Cyril Hrubis wrote: >>> Hi! >>> I know that we are not touching the rest of the existing description for >>> MAP_FIXED however the second sentence in the manual page says that "add

Re: [PATCH v2] mmap.2: MAP_FIXED updated documentation

2017-12-04 Thread Michal Hocko
On Mon 04-12-17 18:52:27, John Hubbard wrote: > On 12/04/2017 03:31 AM, Mike Rapoport wrote: > > On Sun, Dec 03, 2017 at 06:14:11PM -0800, john.hubb...@gmail.com wrote: > >> From: John Hubbard > >> > [...] > >> +.IP > >> +Given the above limitations, one of the very few ways to use this option > >

Re: [PATCH v2] mmap.2: MAP_FIXED updated documentation

2017-12-04 Thread Michal Hocko
On Mon 04-12-17 18:14:18, John Hubbard wrote: > On 12/04/2017 02:55 AM, Cyril Hrubis wrote: > > Hi! > > I know that we are not touching the rest of the existing description for > > MAP_FIXED however the second sentence in the manual page says that "addr > > must be a multiple of the page size." Whi

Re: [PATCH v2] mmap.2: MAP_FIXED updated documentation

2017-12-04 Thread John Hubbard
On 12/04/2017 03:31 AM, Mike Rapoport wrote: > On Sun, Dec 03, 2017 at 06:14:11PM -0800, john.hubb...@gmail.com wrote: >> From: John Hubbard >> [...] >> +.IP >> +Given the above limitations, one of the very few ways to use this option >> +safely is: mmap() a region, without specifying MAP_FIXED. T

Re: [PATCH v2] mmap.2: MAP_FIXED updated documentation

2017-12-04 Thread John Hubbard
On 12/04/2017 02:55 AM, Cyril Hrubis wrote: > Hi! > I know that we are not touching the rest of the existing description for > MAP_FIXED however the second sentence in the manual page says that "addr > must be a multiple of the page size." Which however is misleading as > this is not enough on some

Re: [PATCH v2] mmap.2: MAP_FIXED updated documentation

2017-12-04 Thread Mike Rapoport
On Sun, Dec 03, 2017 at 06:14:11PM -0800, john.hubb...@gmail.com wrote: > From: John Hubbard > > Previously, MAP_FIXED was "discouraged", due to portability > issues with the fixed address. In fact, there are other, more > serious issues. Also, in some limited cases, this option can > be used saf

Re: [PATCH v2] mmap.2: MAP_FIXED updated documentation

2017-12-04 Thread Cyril Hrubis
Hi! I know that we are not touching the rest of the existing description for MAP_FIXED however the second sentence in the manual page says that "addr must be a multiple of the page size." Which however is misleading as this is not enough on some architectures. Code in the wild seems to (mis)use SHM

[PATCH v2] mmap.2: MAP_FIXED updated documentation

2017-12-03 Thread john . hubbard
From: John Hubbard Previously, MAP_FIXED was "discouraged", due to portability issues with the fixed address. In fact, there are other, more serious issues. Also, in some limited cases, this option can be used safely. Expand the documentation to discuss both the hazards, and how to use it safely