Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 641112 - sys-cluster/util-vserver: vserver-stat segfaults if build with hardened gcc
Summary: sys-cluster/util-vserver: vserver-stat segfaults if build with hardened gcc
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Patrice Clement (RETIRED)
URL:
Whiteboard:
Keywords: PMASKED
Depends on:
Blocks:
 
Reported: 2017-12-15 10:25 UTC by Romain Riviere
Modified: 2019-04-13 06:58 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build log resulting in working binary (log-ok,330.46 KB, text/plain)
2017-12-15 11:40 UTC, Romain Riviere
Details
emerge --info with gcc 5.4.0 hardened (emerge-info-gcc-5.4.0-hardened.txt,4.81 KB, text/plain)
2017-12-29 17:35 UTC, Romain Riviere
Details
emerge --info with gcc 5.4.0 hardened nossp (emerge-info-gcc-5.4.0-hardened-nossp.txt,4.82 KB, text/plain)
2017-12-29 17:35 UTC, Romain Riviere
Details
backtace (file_641112.txt,422 bytes, text/plain)
2017-12-29 17:38 UTC, Romain Riviere
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Romain Riviere 2017-12-15 10:25:16 UTC
When using a hardened gcc profile (or the new gcc 6.4.0), vserver-stat command segfaults:

 execve("/usr/sbin/vserver-stat", [...], [/* 40 vars */]) = 0
 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x28} ---
 +++ killed by SIGSEGV +++
 Segmentation fault

The only way to get a working vserver-stat binary is to build with the -hardenednossp profile.
I tried adding -fno-stack-protector to the flags in a custom ebuild, but that was not enough. The only thing that differs between that custom ebuild and using the nossp profile is the GCC_SPECS, and I don't know about that so I cannot dig any deeper here.

Reproducible: Always
Comment 1 Romain Riviere 2017-12-15 11:40:39 UTC
Created attachment 510126 [details]
build log resulting in working binary

The only difference between the working binary and the segfaulting one is the GCC_SPECS being the hardenednossp. I'm still attaching the build.log for completeness' sake
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2017-12-22 15:37:16 UTC
Comment on attachment 510126 [details]
build log resulting in working binary

That's not very useful, is it?
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2017-12-22 15:39:33 UTC
(In reply to Romain Riviere from comment #0)
> When using a hardened gcc profile (or the new gcc 6.4.0), vserver-stat
> command segfaults:
> 
>  execve("/usr/sbin/vserver-stat", [...], [/* 40 vars */]) = 0
>  --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x28} ---
>  +++ killed by SIGSEGV +++
>  Segmentation fault

Use sys-devel/gdb to produce a backtrace.

> 
> The only way to get a working vserver-stat binary is to build with the
> -hardenednossp profile.
> I tried adding -fno-stack-protector to the flags in a custom ebuild, but
> that was not enough. The only thing that differs between that custom ebuild
> and using the nossp profile is the GCC_SPECS, and I don't know about that so
> I cannot dig any deeper here.

Nobody can dig any deeper unless you at the very least post your `emerge --info` output.
Comment 4 Romain Riviere 2017-12-29 17:35:16 UTC
Created attachment 511978 [details]
emerge --info with gcc 5.4.0 hardened
Comment 5 Romain Riviere 2017-12-29 17:35:53 UTC
Created attachment 511980 [details]
emerge --info with gcc 5.4.0 hardened nossp
Comment 6 Romain Riviere 2017-12-29 17:38:55 UTC
Created attachment 511984 [details]
backtace
Comment 7 Romain Riviere 2017-12-29 17:39:45 UTC
(In reply to Jeroen Roovers from comment #2)
> Comment on attachment 510126 [details]
> build log resulting in working binary
> 
> That's not very useful, is it?

As I said above, it is the exact same build log for the broken binary, not much I could do about that.

The requested info is attached above.
Comment 8 Romain Riviere 2017-12-31 11:16:02 UTC
The problem comes from the __constructor__ attribute in the initHertz() and initPageSize() function declarations. I'm waiting for some feedback from upstream devs.
Comment 9 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-04-13 06:58:42 UTC
Package removed.