https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113082

--- Comment #5 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
I think it would be reasonable for glibc to require that audit modules 
don't change errno, at least when acting for libc function calls where 
glibc guarantees not changing errno.  I think user-provided IFUNC 
resolvers are only relevant for user-provided functions and so shouldn't 
be relevant to this issue (if a user declares their own function with a 
noerrno attribute, and also has an IFUNC resolver for that function, they 
need to make sure the IFUNC resolver behaves consistently with the 
attribute).

It would also seem reasonable for glibc to guarantee that most string and 
memory functions (maybe excluding a few that involve the locale or other 
external state, such as strcoll or strerror, and definitely excluding 
those such as strdup that involve memory allocation) don't change errno.  
We may need to be careful about what "obviously" shouldn't affect errno 
(consider e.g. the ongoing discussions around qsort - where avoiding 
memory allocation should as a side effect also avoid affecting errno, but 
it's unclear how we might simultaneously avoid memory allocation, keep a 
stable sort, achieve O(n log(n)) worst case performance, and keep good 
performance for typical inputs).

Reply via email to