[PATCH v2 1/2] string: _FORTIFY_SOURCE=3 using __builtin_dynamic_object_size
Jakub Jelinek
jakub@redhat.com
Mon Dec 14 15:02:00 GMT 2020
On Mon, Dec 14, 2020 at 03:54:11PM +0100, Florian Weimer wrote:
> > diff --git a/NEWS b/NEWS
> > index 0820984547..4167f34c13 100644
> > --- a/NEWS
> > +++ b/NEWS
> > @@ -28,6 +28,11 @@ Major new features:
> > The 32-bit RISC-V port requires at least Linux 5.4, GCC 7.1 and binutils
> > 2.28.
> >
> > +* A new fortification level _FORTIFY_SOURCE=3 is available. At this level,
> > + glibc may use additional checks that may be computationally expensive. At
> > + present these checks are available only on LLVM 9 and later. The latest GCC
> > + available at this time (10.2) does not support this level of fortification.
>
> I think it's still a fixed overhead per call (i.e., not proportional to
> buffer size or stack depth). So the performance warning is perhaps a
> bit too strong (likewise in the manual).
It is definitely not a fixed overhead per call, it is an overhead on
everything that performs address arithmetics on the affected pointers, any
PHI nodes for those pointers etc.
Basically, everything that would feed into a particular
__builtin_dynamic_object_size performs exact rather than approximate size
computation and effectively turns all the related code into mudflap-like or
other forms of bounds-checking code.
Jakub
More information about the Libc-alpha
mailing list