[PATCH] Fix wordsize-32 mmap offset for negative value (BZ#18877)

Dmitry V. Levin ldv@altlinux.org
Thu Aug 27 20:51:00 GMT 2015


On Thu, Aug 27, 2015 at 05:13:13PM -0300, Adhemerval Zanella wrote:
> This patch fixes the default wordsize-32 mmap implementation offset
> calculation for negative values.  Current code uses signed shift
> operation to calculate the multiple size to use with syscall and
> it is implementation defined.  Change it to use a division base
> on mmap page size (default being as before, 4096).
> 
> Tested on armv7hf.
> 
>        [BZ #18877]
>        *  misc/Makefile (tests): Add tst-mmap
>        * sysdeps/unix/sysv/linux/generic/wordsize-32/mmap.c (__mmap): Fix
>        offset calculation for negative values.
>        * misc/tst-mmap.c: New file.

As we have posix/tst-mmap.c already, my idea was to call it
tst-mmap-offset.c,

> +  char fname[] = "tst-mmap-offset-XXXXXX";

hence the name of this temporary file.

> -                                   offset >> MMAP_PAGE_SHIFT);
> +                                   offset/MMAP_PAGE_UNIT);

offset / MMAP_PAGE_UNIT


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150827/5c7379a2/attachment.sig>


More information about the Libc-alpha mailing list