This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: Spectre V1 diagnostic / mitigation


On Wed, 19 Dec 2018, Florian Weimer wrote:

> * Richard Biener:
> 
> > On Wed, 19 Dec 2018, Florian Weimer wrote:
> >
> >> * Richard Biener:
> >> 
> >> > The cost is probably target dependent - on x86 it's simply a $fs based
> >> > load/store.
> >> 
> >> Do you need to reserve something in the TCB for this?
> >
> > No idea.  But I figured using TLS with the patch only works when
> > optimizing and not with -O0.  Huh.  Anyway, it should be equivalent
> > to what presence of
> >
> > __thread void *_SV1MASK = (void *)-1l;
> >
> > requires (plus I make that symbol GNU_UNIQUE).  I see this
> > allocates -1 in the .tdata section marked TLS.
> 
> Oh.  That's going to be substantially worse for PIC, even with the
> initial-exec model, especially on architectures which do not have
> arbitrary PC-relative loads.  Which is why I'm asking about the TCB
> reservation.

Sure, if we'd ever deploy this in production placing this in the
TCB for glibc targets might be beneifical.  But as said the
current implementation was just an experiment intended to be
maximum portable.  I suppose the dynamic loader takes care
of initializing the TCB data?

I would expect most targets to use tricks with the stack pointer
for passing around the mask in any case (using the msb is sth
that was suggested for example).

Richard.

> Thanks,
> Florian
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)


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