Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 341029 - app-text/ghostscript-gpl-8.71-r6. : always segfauts on hardened
Summary: app-text/ghostscript-gpl-8.71-r6. : always segfauts on hardened
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Printing (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Printing Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-14 19:15 UTC by Andrei Ruslantsev
Modified: 2012-02-19 23:10 UTC (History)
4 users (show)

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


Attachments
Output of emerge --info (emerge-info.txt,4.12 KB, text/plain)
2010-12-21 14:12 UTC, mephinet
Details
modified ebuild which disables -fomit-frame-pointer on hardened profiles (ghostscript-gpl-8.71-r7.ebuild,5.82 KB, text/plain)
2010-12-21 14:57 UTC, mephinet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Ruslantsev 2010-10-14 19:15:04 UTC
All my printers stopped working suddenly. I watched logs
dmesg:
gs[18910]: segfault at 1008 ip 0810b477 sp bfc16
/var/log/cups/error_log:
E [13/Oct/2010:10:38:19 +0400] PID 18910 (/usr/libexec/cups/filter/pstoraster) crashed on signal 11!
--SKIP--
D [13/Oct/2010:21:50:22 +0400] [Job 635] Set job-printer-state-message to "SpliX Cannot open job", current level=ERROR
--SKIP--
D [13/Oct/2010:21:50:22 +0400] [Job 635] printer-state-message="SpliX Error while rendering the request. Check the previous message"

I've tried this versions of software
cups-1.4.4-r2 и cups-1.3.11-r2
all versions of ghostscript-gpl in portage
spix-2.0.0
gutenprint-5.2.5-r1

If I try to run gs fron console, it segfauts all times except I run it with --help option
I can't connect this bug to any software update


Reproducible: Always

Steps to Reproduce:
1.Print anything.

Actual Results:  
Nothing. Only records in logs

Expected Results:  
To get printed page

FEATURES variable contains unknown value(s): loadpolicy
Portage 2.1.9.16 (selinux/v2refpolicy/x86/hardened, gcc-4.4.4, glibc-2.12.1-r1, 2.6.32-hardened-r1 i686)
=================================================================
System uname: Linux-2.6.32-hardened-r1-i686-Intel-R-_Celeron-R-_CPU_1.80GHz-with-gentoo-2.0.1
Timestamp of tree: Tue, 12 Oct 2010 20:00:19 +0000
ccache version 2.4 [enabled]
app-shells/bash: 4.1_p9
dev-lang/python: 2.6.6, 3.1.2-r4
dev-util/ccache: 2.4-r8
dev-util/cmake: 2.8.1-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc: 0.6.3
sys-apps/sandbox: 2.3-r1
sys-devel/autoconf: 2.13, 2.68
sys-devel/automake: 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils: 2.20.1-r1
sys-devel/gcc: 4.4.4-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool: 2.2.10
sys-devel/make: 3.81-r2
virtual/os-headers: 2.6.35 (sys-kernel/linux-headers)
ACCEPT_KEYWORDS="x86 ~x86"
ACCEPT_LICENSE="* -@EULA -Ms-PL"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=native -mtune=native -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo"
CXXFLAGS="-march=native -mtune=native -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs ccache collision-protect distlocks fixlafiles fixpackages loadpolicy news parallel-fetch protect-owned sandbox selinux sesandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="ru_RU.UTF-8"
LC_ALL=""
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="ru"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=" "
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac accessibility acl acpi alsa amr bluetooth branding bzip2 cairo cdda cleartype cli consolekit cracklib crypt cups cxx dbus djvu dri dvd dvdr dvdread encode exif fbcon fbcondecor fbsplash festival ffmpeg flac fortran gd gif gimp git gnutls gphoto2 gpm gtk hal hardened hddtemp iconv imagemagick ipv6 jack jpeg jpeg2k lcms lm_sensors mad mikmod mng modules mp3 mpeg mplayer mudflap ncurses nls nptl ogg opencore-amr opengl openmp pam pcre pdf perl pic plotutils png portaudio pppd python quicktime readline reflection sdl selinux session slang spell ssl subversion svg tcpd tga theora tiff truetype unicode usb vorbis wavpack wxwidgets x86 xattr xcb xml xorg xscreensaver xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="ru" PHP_TARGETS="php-5.2" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby18" SANE_BACKENDS="hp hp3500 hp3900 hp4200" USERLAND="GNU" VIDEO_CARDS="radeon fbdev vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Michael Orlitzky gentoo-dev 2010-11-10 03:28:18 UTC
Confirming, and I think hardened should be CCed on this. Compiling with the default hardened gcc-4.4.4-r2 causes all versions of ghostscript-gpl to segfault pretty much immediately.

Switching to vanilla gcc and recompiling is a temporary workaround.
Comment 2 Michael Orlitzky gentoo-dev 2010-11-11 18:18:55 UTC
More info: this problem only seems to affect x86, and not amd64. Haven't tested any other arches.
Comment 3 Michael Orlitzky gentoo-dev 2010-11-11 20:44:20 UTC
A little more experimentation and help from Zorry has shown the problem to be the combination of PIE and -fomit-frame-pointer in CFLAGS.

The suggested fix is to remove -fomit-frame-pointer from CFLAGS; it apparently doesn't play nicely with PIE in some cases.
Comment 4 mephinet 2010-12-21 14:07:17 UTC
I'm having the same issue, also hardened on x86.

Following your comments, I expected that adding this line to the src_compile function before the emake call would fix the problem:

use x86 && gcc-specs-pie && filter-flags -fomit-frame-pointer

This is not the case, though. After emerging the modified ebuild, I still get:

$ gs
Segmentation fault
Comment 5 mephinet 2010-12-21 14:12:06 UTC
Created attachment 257681 [details]
Output of emerge --info
Comment 6 mephinet 2010-12-21 14:54:48 UTC
Placing the mentioned line in the pkg_setup function instead solves to problem.
Comment 7 mephinet 2010-12-21 14:57:09 UTC
Created attachment 257686 [details]
modified ebuild which disables -fomit-frame-pointer on hardened profiles

The attached ebuild solves the problem by disabling -fomit-frame-pointer on x86 builds with PIE enabled.
Comment 8 Andreas K. Hüttel archtester gentoo-dev 2012-01-22 21:00:52 UTC
@hardened: what do you think / advise?

Is this still happening with current ghostscript-gpl-9.04-r5 ?
Comment 9 Michael Orlitzky gentoo-dev 2012-01-22 21:28:29 UTC
It looks OK now. We still have the server that had this problem, and I just now compiled ghostscript on it with -fomit-frame-pointer and PIE:

  CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer" emerge -1 libpaper 
  ghostscript-gpl
  ...

  # gs
  GPL Ghostscript 9.04 (2011-08-05)
  Copyright (C) 2011 Artifex Software, Inc.  All rights reserved.
  This software comes with NO WARRANTY: see the file PUBLIC for details.
  GS>

No crash.
Comment 10 Andreas K. Hüttel archtester gentoo-dev 2012-02-19 23:10:05 UTC
(In reply to comment #9)
> It looks OK now. We still have the server that had this problem, and I just now
> compiled ghostscript on it with -fomit-frame-pointer and PIE:
> 
>   CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer" emerge -1 libpaper 
>   ghostscript-gpl
>   ...
> 
>   # gs
>   GPL Ghostscript 9.04 (2011-08-05)
>   Copyright (C) 2011 Artifex Software, Inc.  All rights reserved.
>   This software comes with NO WARRANTY: see the file PUBLIC for details.
>   GS>
> 
> No crash.

Excellent, thanks.