public inbox for gentoo-hardened@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-hardened] What does the pic USE flag do these days?
@ 2018-09-19  7:24 Hanno Böck
  2018-09-20 23:16 ` Luis Ressel
  0 siblings, 1 reply; 4+ messages in thread
From: Hanno Böck @ 2018-09-19  7:24 UTC (permalink / raw
  To: gentoo-hardened

Hi,

One of the differences between gentoo standard and hardened profiles is
the pic use flag.

I wonder what it does and if it has any meaning these days. From what I
understand in any modern-day Linux system position independent code
(pic) is always used, as we have ASLR and pie executables (in Gentoo
since 17.0 profiles).

In many cases it seems to disable assembly optimizations, often with
comments indicating that the assembly is not "pic friendly" (e.g. gzip
useflag description says "disable optimized assembly code that is not
PIC friendly").

If the flag just disables assembly optimizations then I wonder if it
should be renamed (or if we need it at all - in case these assembly
optimizations have no downsides).


-- 
Hanno Böck
https://hboeck.de/

mail/jabber: hanno@hboeck.de
GPG: FE73757FA60E4E21B937579FA5880072BBB51E42


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-hardened] What does the pic USE flag do these days?
  2018-09-19  7:24 [gentoo-hardened] What does the pic USE flag do these days? Hanno Böck
@ 2018-09-20 23:16 ` Luis Ressel
  2018-09-27 13:45   ` Hanno Böck
  0 siblings, 1 reply; 4+ messages in thread
From: Luis Ressel @ 2018-09-20 23:16 UTC (permalink / raw
  To: gentoo-hardened; +Cc: Hanno Böck

On Wed, 19 Sep 2018 09:24:27 +0200
Hanno Böck <hanno@hboeck.de> wrote:

> If the flag just disables assembly optimizations then I wonder if it
> should be renamed (or if we need it at all - in case these assembly
> optimizations have no downsides).

Many (all?) of the ebuilds with this flag do indeed only disable
assembly snippets, and most of them only do this on 32-bit x86 (gzip
being the prominent exception).

I haven't looked at any code yet, but I think it could be a good idea
to just remove the flag (and hard-wire it to true in the cases where it
only affects x86-32, examine the situation a bit further for gzip).

Cheers,
Luis Ressel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-hardened] What does the pic USE flag do these days?
  2018-09-20 23:16 ` Luis Ressel
@ 2018-09-27 13:45   ` Hanno Böck
  2018-09-27 14:42     ` Alexander Tsoy
  0 siblings, 1 reply; 4+ messages in thread
From: Hanno Böck @ 2018-09-27 13:45 UTC (permalink / raw
  To: gentoo-hardened

On Fri, 21 Sep 2018 00:16:48 +0100
Luis Ressel <aranea@aixah.de> wrote:

> On Wed, 19 Sep 2018 09:24:27 +0200
> Hanno Böck <hanno@hboeck.de> wrote:
> 
> > If the flag just disables assembly optimizations then I wonder if it
> > should be renamed (or if we need it at all - in case these assembly
> > optimizations have no downsides).  
> 
> Many (all?) of the ebuilds with this flag do indeed only disable
> assembly snippets, and most of them only do this on 32-bit x86 (gzip
> being the prominent exception).

And ffmpeg and mesa.

In ffmpeg the flag description says:
"Force shared libraries to be built as PIC (this is slower)"

Which confuses me - I thought shared libraries are always PIC.

It looks to me these are all historic leftovers, but I'd like to
understand it better before I open bugs asking for removal of these
flags.

-- 
Hanno Böck
https://hboeck.de/

mail/jabber: hanno@hboeck.de
GPG: FE73757FA60E4E21B937579FA5880072BBB51E42


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-hardened] What does the pic USE flag do these days?
  2018-09-27 13:45   ` Hanno Böck
@ 2018-09-27 14:42     ` Alexander Tsoy
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Tsoy @ 2018-09-27 14:42 UTC (permalink / raw
  To: gentoo-hardened

В Чт, 27/09/2018 в 15:45 +0200, Hanno Böck пишет:
> On Fri, 21 Sep 2018 00:16:48 +0100
> Luis Ressel <aranea@aixah.de> wrote:
> 
> > On Wed, 19 Sep 2018 09:24:27 +0200
> > Hanno Böck <hanno@hboeck.de> wrote:
> > 
> > > If the flag just disables assembly optimizations then I wonder if
> > > it
> > > should be renamed (or if we need it at all - in case these
> > > assembly
> > > optimizations have no downsides).  
> > 
> > Many (all?) of the ebuilds with this flag do indeed only disable
> > assembly snippets, and most of them only do this on 32-bit x86
> > (gzip
> > being the prominent exception).
> 
> And ffmpeg and mesa.
> 
> In ffmpeg the flag description says:
> "Force shared libraries to be built as PIC (this is slower)"
> 
> Which confuses me - I thought shared libraries are always PIC.
> 
> It looks to me these are all historic leftovers, but I'd like to
> understand it better before I open bugs asking for removal of these
> flags.

IIRC the main issue was a limited general purpose register set on x86
architecture.
https://wiki.gentoo.org/wiki/Hardened/Toolchain#Issues_with_PIEs

"Occasionally application code will fail to compile with -fPIE. If this
happens it is usually down to non-position-independent assembler code,
and is most prevelant on X86 which has a limited general purpose
register set."

I guess a lot of programs was fixed since then. For example currently I
don't see any problems when building mesa with USE=-pic on x86_32.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-27 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-19  7:24 [gentoo-hardened] What does the pic USE flag do these days? Hanno Böck
2018-09-20 23:16 ` Luis Ressel
2018-09-27 13:45   ` Hanno Böck
2018-09-27 14:42     ` Alexander Tsoy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox