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: RFC: __attribute_alloc_size__ on allocation functions (BZ#23741)


On Fri, Nov 9, 2018 at 10:11 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> BZ#23741 suggests glibc adds gcc __attribute_alloc_size__ on malloc functions
> so asking allocation larger than PTRDIFF_MAX emits a warning that the value
> exceeds maximum object size.

I think it makes sense to add the annotations and disallow allocations
larger than PTRDIFF_MAX for malloc and its family, but *not* for mmap,
brk, sbrk, and any other hypothetical system memory-allocation
primitives (IIRC Mach has something else) because those are not
necessarily used to allocate "objects" in the sense of the C standard,
and we know from other cases that people don't like it when glibc's
system call wrappers impose restrictions that the bare system call
doesn't.

zw


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