This is the mail archive of the glibc-bugs@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]

[Bug regex/16851] re_node_set_alloc should not return REG_ESPACE when size == 0


https://sourceware.org/bugzilla/show_bug.cgi?id=16851

--- Comment #7 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
(In reply to eggert from comment #6)
> (In reply to Adhemerval Zanella from comment #4)
> 
> > Paul, I am planning to sync gnulib regex with glibc, and glibc support
> > malloc interposition. Do we need to handle this case?
> 
> We don't *need* to handle this case, since POSIX and the C standard prohibit
> malloc interposition in conforming programs, glibc has every right to insist
> on its own rules when it supports malloc interposition as an extension, and
> one of those rules can be "malloc (0) must return nonnull on success".
> 
> That being said, it would be easy to add support for
> interposed-malloc-0-returning-NULL to the regex code by doing as Nathan
> Kennedy suggests at the top of bug 16851. Although this would add an extra
> pair of instructions, these instructions would be executed only in a cold
> path so there should be little runtime overhead.
> 
> On the other hand, I expect that there are several other places in glibc
> that break if an interposed malloc (0) returns NULL on success. Do we really
> want to audit glibc and "fix" every instance? Wouldn't it be better just to
> document that interposed malloc must behave in a certain way? I'm not sure
> we should make glibc a bit bigger and slower simply to cater to malloc
> interposers that don't conform to glibc's API.

Right, I think we can expect an interposable malloc to follow glibc semantics,
I will bring this up on libc-alpha.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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