[LTP] [PATCH 1/1] mmap20: Fix invalid address

Li Wang liwang@redhat.com
Thu Apr 6 12:29:37 CEST 2023


On Thu, Apr 6, 2023 at 5:49 PM Petr Vorel <pvorel@suse.cz> wrote:

> Hi all,
>
> > Hi Petr,
>
> > (1<<9) is also used by another flag on alpha, but it said not
> > linux-specific,
> > so I guess it won't be a problem (at least for now).
> >   alpha/include/uapi/asm/mman.h:#define _MAP_HASSEMAPHORE 0x0200
>
> Good point! I checked only glibc/musl headers, obviously checking kernel
> sources
> is better as it contains old archs. It affects alpha, ia64 and sparc
> (well, they might not even compile current LTP, we were dropping ia64 fixes
> anyway).
>

Okay, I only noticed that alpha is not defined 0x0200 for Linux
specifically.



>
> $ git grep -w 0x0200 arch/*/include/uapi/asm/mman.h
> arch/alpha/include/uapi/asm/mman.h:#define _MAP_HASSEMAPHORE 0x0200
> arch/ia64/include/uapi/asm/mman.h:#define MAP_GROWSUP   0x0200          /*
> register stack-like segment */
> arch/sparc/include/uapi/asm/mman.h:#define MAP_GROWSDOWN        0x0200
>       /* stack-like segment */
>
> But as 0x400 (1 << 10) is not used anywhere, I merged it with this value.
>


Hmm, I didn't understand here why merged with 0x0400,
aren't there still duplicated flags?

$ git grep -w 0x0400 arch/*/include/uapi/asm/mman.h
arch/alpha/include/uapi/asm/mman.h:#define _MAP_INHERIT 0x0400
arch/mips/include/uapi/asm/mman.h:#define MAP_NORESERVE 0x0400          /*
don't check for reservations */
arch/xtensa/include/uapi/asm/mman.h:#define MAP_NORESERVE       0x0400
     /* don't check for reservations */



>
> It'd be good to follow Jan's solution (don't map a file, and then add
> MAP_SYNC
> to flags), but I'll postpone it to later/when needed/never (there are other
> tests which needs to be fixed.
>
> Thanks a lot both!
>
> Kind regards,
> Petr
>
>

-- 
Regards,
Li Wang


More information about the ltp mailing list