This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] posix: Fix generic p{read,write}v buffer allocation (BZ#22457)



On 24/11/2017 01:58, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> On 23/11/2017 17:08, Florian Weimer wrote:
>>> * 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.
> 
>> Indeed we do not need to align to page size, however the alignment
>> requirement was the motivation to actually change its implementation
>> (check commit message for c79a72aa5cb8357c216a71015c7448a9259c8531).
> 
> I meant that there is no way to query the alignment required for
> O_DIRECT, and that page size alignment might be insufficient.  Some
> file systems hard-code a 4K alignment requirement, and microblaze has
> at least 4K pages, so we should be good.  But it feels strange to
> write a check against the wrong constant.
> 

Alright, looks like I am over-enginering it. I will remove the check
as well.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]