This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] posix: Fix generic p{read,write}v buffer allocation (BZ#22457)
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Thu, 23 Nov 2017 20:08:16 +0100
- Subject: Re: [PATCH] posix: Fix generic p{read,write}v buffer allocation (BZ#22457)
- Authentication-results: sourceware.org; auth=none
- References: <1511455130-19179-1-git-send-email-adhemerval.zanella@linaro.org>
* Adhemerval Zanella:
> + size_t mmap_size = ALIGN_UP (bytes, GLRO(dl_pagesize));
> + void *buffer = __mmap (NULL, mmap_size, PROT_READ | PROT_WRITE,
> + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
> + if (__glibc_unlikely (buffer == MAP_FAILED)
> + || __glibc_unlikely (!PTR_IS_ALIGNED (buffer, GLRO(dl_pagesize))))
> return -1;
I don't think POSIX requires that the length of the mapping is a
multiple of the page size. You could probably drop the alignment
check, too, because I don't really see any reason why the alignment
requirement would be related to the page size.