[PATCH 1/2] mmap: decode MAP_UNINITIALIZE
Dmitry V. Levin
ldv at altlinux.org
Tue Jan 22 18:54:51 UTC 2013
On Tue, Jan 22, 2013 at 06:09:50PM +0100, Bernhard Reutner-Fischer wrote:
> On 22 January 2013 10:35, Dmitry V. Levin <ldv at altlinux.org> wrote:
> > On Tue, Jan 22, 2013 at 10:16:42AM +0100, Bernhard Reutner-Fischer wrote:
> >> On 21 January 2013 15:23, Dmitry V. Levin <ldv at altlinux.org> wrote:
> >> > On Mon, Jan 21, 2013 at 02:36:55PM +0100, Bernhard Reutner-Fischer wrote:
> >> >> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
> >> >> ---
> >> >> mem.c | 3 +++
> >> >> 1 file changed, 3 insertions(+)
> >> >>
> >> >> diff --git a/mem.c b/mem.c
> >> >> index 0279030..53fcf85 100644
> >> >> --- a/mem.c
> >> >> +++ b/mem.c
> >> >> @@ -159,6 +159,9 @@ static const struct xlat mmap_flags[] = {
> >> >> #ifdef MAP_STACK
> >> >> { MAP_STACK, "MAP_STACK" },
> >> >> #endif
> >> >> +#ifdef MAP_UNINITIALIZE
> >> >> + { MAP_UNINITIALIZE,"MAP_UNINITIALIZE"},
> >> >> +#endif
> >> >> #ifdef MAP_NOSYNC
> >> >> { MAP_NOSYNC, "MAP_NOSYNC" },
> >> >> #endif
> >> >
> >> > You mean MAP_UNINITIALIZED?
> >>
> >> ugh, it seems that the name changed mid-flight :(
> >> So yes, i mean MAP_UNINITIALIZED, i will change uClibc to add the 'D'.
> >
> > OK, is there a chance to get MAP_UNINITIALIZED defined to 0?
>
> AFAICS no.
linux/include/uapi/asm-generic/mman-common.h contains this:
#ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED
# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be uninitialized */
#else
# define MAP_UNINITIALIZED 0x0 /* Don't support this flag */
#endif
So I'm not quite sure it cannot be defined to 0x0.
> > If yes, then there needs to be a check for that case, e.g.
> > #if MAP_UNINITIALIZED > 0
>
> #if defined MAP_UNINITIALIZED && MAP_UNINITIALIZED + 0 > 0
> for a redundant, exhaustive check but no, it is always 0x4000000
Is there any need for this " + 0" arithemtics?
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20130122/6db0d082/attachment.bin>
More information about the Strace-devel
mailing list