Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 371021 - sys-kernel/hardened-sources-2.6.39 build error involving tools/gcc/pax_plugin.so
Summary: sys-kernel/hardened-sources-2.6.39 build error involving tools/gcc/pax_plugin.so
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: The Gentoo Linux Hardened Kernel Team (OBSOLETE)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-10 12:17 UTC by Tony Vroon (RETIRED)
Modified: 2011-07-31 21:12 UTC (History)
2 users (show)

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


Attachments
Kernel config (config,52.18 KB, text/plain)
2011-06-10 12:17 UTC, Tony Vroon (RETIRED)
Details
GCC debug output (blueness-debug-info.txt,30.39 KB, text/plain)
2011-06-10 12:34 UTC, Tony Vroon (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tony Vroon (RETIRED) gentoo-dev 2011-06-10 12:17:46 UTC
Created attachment 276497 [details]
Kernel config

Build fails as follows:
scripts/kconfig/conf --silentoldconfig Kconfig
warning: (HAVE_TEXT_POKE_SMP) selects STOP_MACHINE which has unmet direct dependencies (SMP && MODULE_UNLOAD || HOTPLUG_CPU)
warning: (HAVE_TEXT_POKE_SMP) selects STOP_MACHINE which has unmet direct dependencies (SMP && MODULE_UNLOAD || HOTPLUG_CPU)
  HOSTCC  -fPIC tools/gcc/pax_plugin.o
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  HOSTCC  scripts/kallsyms
  CC      scripts/mod/empty.o
cc1: error: Cannot load plugin /usr/src/linux-2.6.39-hardened/tools/gcc/pax_plugin.so
/usr/src/linux-2.6.39-hardened/tools/gcc/pax_plugin.so: cannot open shared object file: No such file or directory
cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"
make[2]: *** [scripts/mod/empty.o] Error 1
make[1]: *** [scripts/mod] Error 2
make[1]: *** Waiting for unfinished jobs....
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs....
  HOSTLLD -shared tools/gcc/pax_plugin.so

System information:

Portage 2.1.10 (hardened/linux/amd64/no-multilib, gcc-4.5.2, glibc-2.13-r2, 2.6.38-hardened-r6 x86_64)
=================================================================
System uname: Linux-2.6.38-hardened-r6-x86_64-Intel-R-_Xeon-TM-_CPU_3.20GHz-with-gentoo-2.0.2
Timestamp of tree: Fri, 10 Jun 2011 00:00:01 +0000
app-shells/bash:          4.2_p10
dev-lang/python:          2.4.4-r6, 2.5.4-r2, 2.6.6-r2, 2.7.1-r1
dev-util/cmake:           2.8.4-r1
sys-apps/baselayout:      2.0.2
sys-apps/openrc:          0.8.2-r1
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.10.3, 1.11.1-r1
sys-devel/binutils:       2.21
sys-devel/gcc:            3.4.6-r2, 4.3.4, 4.4.4-r2, 4.5.2
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 2.6.38 (virtual/os-headers)
sys-libs/glibc:           2.13-r2
Repositories: gentoo linx
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
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="/srv/linx-portage/overlay"
SYNC="rsync://portage-rsync.linx.net/gentoo-portage"
USE="acl amd64 animgif bash-completion berkdb bzip2 calendar cgi cli cracklib crypt cxx dahdi device-mapper diskio dri elf expat fastcgi gd gdbm gif gnutls hardened iconv ipv6 jabber jbig jpeg justify lm_sensors lzma md5sum mmx modules mpm-prefork mudflap ncurses network-cron no-old-linux nptl nptlonly ogg pam pcre perl png pppd python readline rss session snmp span speex sqlite sse sse2 ssl sysfs syslog threads truetype unicode urandom vhosts vorbis xml xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci 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 auth_digest authn_anon authn_dbd 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 dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="worker" CALLIGRA_FEATURES="braindump flow karbon kexi kpresenter krita tables words" CAMERAS="ptp2" 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 mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" 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, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Tony Vroon (RETIRED) gentoo-dev 2011-06-10 12:34:54 UTC
Created attachment 276503 [details]
GCC debug output
Comment 2 Anthony Basile gentoo-dev 2011-06-10 18:28:23 UTC
Okay upstream knows about this issue:

    http://forums.grsecurity.net/viewtopic.php?f=3&t=2649

Repeating from there, edit the main Makefile and change

   -fplugin=$(obj)/tools/gcc/pax_plugin.so

to

   -fplugin=$(objtree)/tools/gcc/pax_plugin.so


Also, your toolchain is "slightly" broken:

warning: GMP header version 5.0.1 differs from library version 5.0.2.
warning: MPFR header version 3.0.0-p3 differs from library version 3.0.1.
warning: MPC header version 0.8.2 differs from library version 0.9.

You probably want to re-emerge gmp, mpfr and mpc.

This is fixed in hardened-sources-2.6.39-r1 which will hit the tree soon.
Comment 3 Anthony Basile gentoo-dev 2011-06-11 10:49:47 UTC
> This is fixed in hardened-sources-2.6.39-r1 which will hit the tree soon.

Its in the tree now.  Can you test?
Comment 4 Tony Vroon (RETIRED) gentoo-dev 2011-06-13 09:06:41 UTC
(In reply to comment #3)
> Its in the tree now.  Can you test?

No change visible:

warning: (HAVE_TEXT_POKE_SMP) selects STOP_MACHINE which has unmet direct dependencies (SMP && MODULE_UNLOAD || HOTPLUG_CPU)
#
# configuration written to .config
#
scripts/kconfig/conf --silentoldconfig Kconfig
warning: (HAVE_TEXT_POKE_SMP) selects STOP_MACHINE which has unmet direct dependencies (SMP && MODULE_UNLOAD || HOTPLUG_CPU)
warning: (HAVE_TEXT_POKE_SMP) selects STOP_MACHINE which has unmet direct dependencies (SMP && MODULE_UNLOAD || HOTPLUG_CPU)
  HOSTCC  -fPIC tools/gcc/pax_plugin.o
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/pnmtologo
  CC      scripts/mod/empty.o
cc1: error: Cannot load plugin /usr/src/linux-2.6.39-hardened-r1/tools/gcc/pax_plugin.so
/usr/src/linux-2.6.39-hardened-r1/tools/gcc/pax_plugin.so: cannot open shared object file: No such file or directory
cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"
make[2]: *** [scripts/mod/empty.o] Error 1
make[1]: *** [scripts/mod] Error 2
make[1]: *** Waiting for unfinished jobs....
  HOSTLLD -shared tools/gcc/pax_plugin.so
make: *** [scripts] Error 2
cyan linux #
Comment 5 PaX Team 2011-06-13 10:22:35 UTC
(In reply to comment #4)
> warning: (HAVE_TEXT_POKE_SMP) selects STOP_MACHINE which has unmet direct
> dependencies (SMP && MODULE_UNLOAD || HOTPLUG_CPU)

i don't know about this one, but iirc we don't change these options so you might want to report it upstream.

> cc1: error: Cannot load plugin
> /usr/src/linux-2.6.39-hardened-r1/tools/gcc/pax_plugin.so
> /usr/src/linux-2.6.39-hardened-r1/tools/gcc/pax_plugin.so: cannot open shared
> object file: No such file or directory
> cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"
> make[2]: *** [scripts/mod/empty.o] Error 1
> make[1]: *** [scripts/mod] Error 2
> make[1]: *** Waiting for unfinished jobs....
>   HOSTLLD -shared tools/gcc/pax_plugin.so

looks like i still haven't properly fixed the plugin dependency so (highly?) parallel builds can fail, i'll take yet another look :P.
Comment 6 Tony Vroon (RETIRED) gentoo-dev 2011-06-13 12:07:26 UTC
(In reply to comment #5)
> > warning: (HAVE_TEXT_POKE_SMP) selects STOP_MACHINE which has unmet direct
> > dependencies (SMP && MODULE_UNLOAD || HOTPLUG_CPU)
> i don't know about this one, but iirc we don't change these options so you
> might want to report it upstream.

It dislikes me turning off the module loader entirely. It reduces the attack surface, so I am not open to enabling it to just to cure a warning.

> looks like i still haven't properly fixed the plugin dependency so (highly?)
> parallel builds can fail, i'll take yet another look :P.

It's a -j4 on a dual Xeon with hyperthreading, so it shouldn't be too bad.
Comment 7 PaX Team 2011-06-13 14:13:24 UTC
(In reply to comment #3)
> > This is fixed in hardened-sources-2.6.39-r1 which will hit the tree soon.
> 
> Its in the tree now.  Can you test?

just to be sure, which grsec version is in it?
Comment 8 Anthony Basile gentoo-dev 2011-06-13 14:46:26 UTC
(In reply to comment #7)
> (In reply to comment #3)
> > > This is fixed in hardened-sources-2.6.39-r1 which will hit the tree soon.
> > 
> > Its in the tree now.  Can you test?
> 
> just to be sure, which grsec version is in it?

2.6.39-r1 =  vanilla 2.6.39.1 + genpatches-2.6.39-2 +
  grsecurity-2.2.2-2.6.39.1-201106071941
Comment 9 Tony Vroon (RETIRED) gentoo-dev 2011-06-17 13:24:26 UTC
#
# configuration written to .config
#
scripts/kconfig/conf --silentoldconfig Kconfig
warning: (HAVE_TEXT_POKE_SMP) selects STOP_MACHINE which has unmet direct dependencies (SMP && MODULE_UNLOAD || HOTPLUG_CPU)
warning: (HAVE_TEXT_POKE_SMP) selects STOP_MACHINE which has unmet direct dependencies (SMP && MODULE_UNLOAD || HOTPLUG_CPU)
  HOSTCC  -fPIC tools/gcc/pax_plugin.o
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/pnmtologo
  CC      scripts/mod/empty.o
cc1: error: Cannot load plugin /usr/src/linux-2.6.39-hardened-r2/tools/gcc/pax_plugin.so
/usr/src/linux-2.6.39-hardened-r2/tools/gcc/pax_plugin.so: cannot open shared object file: No such file or directory
cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"
make[2]: *** [scripts/mod/empty.o] Error 1
make[1]: *** [scripts/mod] Error 2
make[1]: *** Waiting for unfinished jobs....
  HOSTLLD -shared tools/gcc/pax_plugin.so
make: *** [scripts] Error 2
Comment 10 Tony Vroon (RETIRED) gentoo-dev 2011-06-27 09:13:50 UTC
Still an issue on 2.6.39-r3 which is based on 2.6.39.1 + genpatches-2.6.39-2 +
 grsecurity-2.2.2-2.6.39.1-201106211740:

#
# configuration written to .config
#
scripts/kconfig/conf --silentoldconfig Kconfig
warning: (HAVE_TEXT_POKE_SMP) selects STOP_MACHINE which has unmet direct dependencies (SMP && MODULE_UNLOAD || HOTPLUG_CPU)
warning: (HAVE_TEXT_POKE_SMP) selects STOP_MACHINE which has unmet direct dependencies (SMP && MODULE_UNLOAD || HOTPLUG_CPU)
  HOSTCC  -fPIC tools/gcc/pax_plugin.o
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/pnmtologo
  CC      scripts/mod/empty.o
cc1: error: Cannot load plugin /usr/src/linux-2.6.39-hardened-r3/tools/gcc/pax_plugin.so
/usr/src/linux-2.6.39-hardened-r3/tools/gcc/pax_plugin.so: cannot open shared object file: No such file or directory
cc1: warning: unrecognized command line option "-Wno-unused-but-set-variable"
make[2]: *** [scripts/mod/empty.o] Error 1
make[1]: *** [scripts/mod] Error 2
make[1]: *** Waiting for unfinished jobs....
  HOSTLLD -shared tools/gcc/pax_plugin.so
make: *** [scripts] Error 2
Comment 11 Anthony Basile gentoo-dev 2011-06-27 21:04:44 UTC
Okay I hit a couple of issues:

1) make mrproper does not remove pax_plugin.so  If you get a bad .so from some previous compile, it just carries through:

cyan linux # ls tools/gcc/
Makefile  modules.order  pax_plugin.c  pax_plugin.o  pax_plugin.so  

cyan linux # make mrproper
 ...

cyan linux # ls tools/gcc/
Makefile  pax_plugin.c  pax_plugin.so


2) I seem to be able to reproduce this by doing the following:

    make mrproper
    rm -f tools/gcc/pax_plugin.so <because of problem 1 above>
    <configure with CONFIG_PAX_MEMORY_STACKLEAK=y>
    make -j 5

If instead of make -j 5 you do

    make

it works.  In either case, the plugin is built, but in the former case, it cannot be loaded with -fplugin=


@pageexec comments?
Comment 12 PaX Team 2011-06-28 10:19:51 UTC
(In reply to comment #11)
> 1) make mrproper does not remove pax_plugin.so  If you get a bad .so from some
> previous compile, it just carries through:

yes i know about it, looks like the existing kbuild infrastructure for shared libs needs more tweaks to remove such targets (i already tried to add the shared libs to the clean target but obviously it didn't work ;).

> 
> 2) I seem to be able to reproduce this by doing the following:
> 
>     make mrproper
>     rm -f tools/gcc/pax_plugin.so <because of problem 1 above>
>     <configure with CONFIG_PAX_MEMORY_STACKLEAK=y>
>     make -j 5

in the meantime i got a new box where i can reproduce it myself too. the issue is that the pax-plugin target needs some infrastructure (as far as the makefile knows) that in turn needs pax-plugin itself (but the makefile doesn't know about it), so it's a kinda chicken and egg problem. since the plugin compiles fine with -j1, it's obviously a false dependency but breaking it is not trivial as the make targets involved are used in several other places well.
Comment 13 Anthony Basile gentoo-dev 2011-07-31 21:12:45 UTC
This has been fixed.  I'm aiming to stabilize 2.6.39-r8.  Reopen this if you hit it Tony still, but I'd be surprised.