Re: stop using mquery(2) inside realloc(3)

2022-06-28 Thread Theo de Raadt
This diff to stop using mquery has been in snaps for a few weeks, and I finally noticed some fallout. But it is amusing fallout: If you have a snap with the diff installed, you cannot build an install media in a shortcut way, since malloc.c in the real tree uses mquery, but the installed libc

Re: stop using mquery(2) inside realloc(3)

2022-05-14 Thread Philip Guenther
On Sat, 14 May 2022, Philip Guenther wrote: > On Sat, 14 May 2022, Theo de Raadt wrote: > > I worry a little about having libc use an undocumented mmap(2) flag. > > About as much as using mquery, which is non-standard. > > > > Maybe __MAP_NOREPLACE should get documentation? __MAP_NOFAULT is in

Re: stop using mquery(2) inside realloc(3)

2022-05-14 Thread Philip Guenther
On Sat, 14 May 2022, Theo de Raadt wrote: > I worry a little about having libc use an undocumented mmap(2) flag. > About as much as using mquery, which is non-standard. > > Maybe __MAP_NOREPLACE should get documentation? __MAP_NOFAULT is in the > same situation. The behaviour of these flags

Re: stop using mquery(2) inside realloc(3)

2022-05-14 Thread Theo de Raadt
I worry a little about having libc use an undocumented mmap(2) flag. About as much as using mquery, which is non-standard. Maybe __MAP_NOREPLACE should get documentation? __MAP_NOFAULT is in the same situation. The behaviour of these flags should be documented (set in stone), which may also

Re: stop using mquery(2) inside realloc(3)

2022-05-14 Thread Otto Moerbeek
On Fri, May 13, 2022 at 08:21:19PM -0700, Philip Guenther wrote: > If you try to grow a 'large' (at least half a page) allocation with > realloc(3), it'll try to extend the memory mapping for it and if that > works it won't need to move it. (on a side note: it does not do anything at all if

stop using mquery(2) inside realloc(3)

2022-05-13 Thread Philip Guenther
If you try to grow a 'large' (at least half a page) allocation with realloc(3), it'll try to extend the memory mapping for it and if that works it won't need to move it. Currently, it does that by using mquery(2) to see if that area is available and if so then trying to mmap it, munmaping it