Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 378731 - sys-kernel/hardened-sources-2.6.39-r{9,10,11,12,13} build fails without CONFIG_SMP
Summary: sys-kernel/hardened-sources-2.6.39-r{9,10,11,12,13} build fails without CONFI...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: The Gentoo Linux Hardened Kernel Team (OBSOLETE)
URL: http://forums.gentoo.org/viewtopic-t-...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-11 05:55 UTC by Boney McCracker
Modified: 2011-08-27 00:28 UTC (History)
7 users (show)

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


Attachments
config-2.6.39-hardened-r12.txt (brendler) (config-2.6.39-hardened-r12.txt,48.35 KB, text/plain)
2011-08-18 00:49 UTC, Boney McCracker
Details
genkernel.log 2.6.39-hardened-r12 (genkernel.log-r12.bz2,22.83 KB, text/plain)
2011-08-18 21:17 UTC, Radoslaw Madej (radegand)
Details
kernel config 2.6.39-hardened-r12 (config-2.6.39-hardened-r12,81.12 KB, text/plain)
2011-08-18 21:18 UTC, Radoslaw Madej (radegand)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Boney McCracker 2011-08-11 05:55:30 UTC
On a hardened ~x86 system which has been running hardened-sources for a couple of years, hardened-sources-2.6.39-r9 and -r10 fail to build.

The URL links to a forum discussion where someone has suggested this is due to "a gcc plugin to make all structures constant" and provides a bit more explanation, although I have no idea how likely that is.

Recent changes include gcc-4.5.2  --->  gcc-4.5.3

Note that sys-kernel/hardened-sources-2.6.39-r8 still builds fine.



Reproducible: Always

Steps to Reproduce:
make sys-kernel/hardened-sources-2.6.39-r9 or -r10


Actual Results:  
-----------------------------------------------------------------------------

linux # make oldconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/docproc
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/kxgettext.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/lex.zconf.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf --oldconfig Kconfig
#
# configuration written to .config
#
linux # make
scripts/kconfig/conf --silentoldconfig Kconfig
  HOSTCC  -fPIC tools/gcc/constify_plugin.o
  HOSTCC  -fPIC tools/gcc/stackleak_plugin.o
  HOSTLLD -shared tools/gcc/stackleak_plugin.so
  HOSTLLD -shared tools/gcc/constify_plugin.so
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
  CC      arch/x86/kernel/asm-offsets.s
In file included from include/linux/fs.h:393:0,
                 from include/linux/module.h:19,
                 from include/linux/crypto.h:21,
                 from arch/x86/kernel/asm-offsets.c:8:
include/linux/semaphore.h: In function ‘sema_init’:
include/linux/semaphore.h:35:17: error: assignment of read-only location ‘*sem’
In file included from /usr/src/linux-2.6.39-hardened-r10/arch/x86/include/asm/uaccess.h:11:0,
                 from include/linux/uaccess.h:5,
                 from include/linux/crypto.h:26,
                 from arch/x86/kernel/asm-offsets.c:8:
include/linux/sched.h: In function ‘thread_group_cputime_init’:
include/linux/sched.h:2579:2: error: assignment of read-only member ‘lock’
make[1]: *** [arch/x86/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2
------------------------------------------------------------------------------



Expected Results:  
N/A



~ # emerge --info
Portage 2.1.10.10 (hardened/linux/x86, gcc-4.5.3, glibc-2.13-r4, 2.6.39-hardened-r8 i686)
=================================================================
System uname: Linux-2.6.39-hardened-r8-i686-Pentium_III_-Coppermine-with-gentoo-2.0.3
Timestamp of tree: Wed, 10 Aug 2011 19:15:01 +0000
ccache version 3.1.5 [enabled]
app-shells/bash:          4.2_p10
dev-lang/python:          2.7.2-r2, 3.2-r2
dev-util/ccache:          3.1.5
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/openrc:          0.8.3-r1
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.68
sys-devel/automake:       1.11.1-r1
sys-devel/binutils:       2.21.1
sys-devel/gcc:            4.5.3
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-r4
Repositories: gentoo local-portage
ACCEPT_KEYWORDS="x86 ~x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O3 -march=pentium3 -pipe -fomit-frame-pointer -fgraphite-identity -floop-block -floop-strip-mine -floop-interchange"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O3 -march=pentium3 -pipe -fomit-frame-pointer -fgraphite-identity -floop-block -floop-strip-mine -floop-interchange"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs ccache distlocks ebuild-locks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="ftp://ftp.gtlib.gatech.edu/pub/gentoo http://gentoo.osuosl.org/ http://open-systems.ufl.edu/mirrors/gentoo "
LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
LDFLAGS="-Wl,--hash-style=gnu,-O1 -Wl,--as-needed"
LINGUAS="en_US en"
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="/usr/local/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="acl berkdb bzip2 caps cli cracklib crypt cxx dri gdbm gpm hardened iconv modules mudflap ncurses nls nptl nptlonly openmp pam pcre perl pic python readline session ssl sysfs syslog threads unicode urandom x86 xorg zlib" ALSA_CARDS="emu10k1" 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" 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="evdev" KERNEL="linux" LINGUAS="en_US en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nv" 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, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Boney McCracker 2011-08-11 14:25:43 UTC
Also: in the forum thread at the URL, you can see there is at least one other user having the same issue (I take that an indicator that there may be an actual problem, although I know it could just be two users being incompetent simultaneously in the same way).  Thank you.
Comment 2 Anthony Basile gentoo-dev 2011-08-11 15:11:21 UTC
@pipacs:

2.6.39-r9  = grsecurity-2.2.2-2.6.39.4-201108052113
2.6.39-r10 = grsecurity-2.2.2-2.6.39.4-201108071438

I've only been testing with 4.5.2 so I didn't hit it.
Comment 3 Attila Tóth 2011-08-13 12:00:18 UTC
I see the same error message on my Pentium-M laptop even using gcc-4.5.2. While hardened-sources-2.6.39-r8 still compiles fine. Additionally on my Athlon-MP server both -r8 and -r10 compiles even with 4.5.3. It has to do something with the combo of architecture, kernel version and gcc version.
Comment 4 Brad Spengler 2011-08-13 12:38:20 UTC
Hi guys,

Just enable CONFIG_SMP for now as a workaround.  This will be fixed properly soon.

Thanks,
-Brad
Comment 5 Aditya Iyer 2011-08-15 02:49:56 UTC
kernels hardened-sources-2.6.39-r9 and -r10 emerge successfully for me but virtualbox-modules-4.1.0-r1 fails to emerge with the below error. emerges fine with hardened-sources-2.6.39-r8. am using gcc-4.5.3. 

/var/tmp/portage/app-emulation/virtualbox-modules-4.1.0-r1/work/vboxdrv/SUPDrv.c: In function ‘supdrvIDC_LdrGetSymbol’:
/var/tmp/portage/app-emulation/virtualbox-modules-4.1.0-r1/work/vboxdrv/SUPDrv.c:4346:17: error: assignment of read-only member ‘Out’
/var/tmp/portage/app-emulation/virtualbox-modules-4.1.0-r1/work/vboxdrv/SUPDrv.c:4377:21: error: assignment of read-only member ‘Out’

am assuming it's the same issue, or can open another bug.
Comment 6 Aditya Iyer 2011-08-15 02:50:46 UTC
missed adding that am on amd64 and CONFIG_SMP is on.
Comment 7 Anthony Basile gentoo-dev 2011-08-15 08:18:46 UTC
(In reply to comment #5)
> kernels hardened-sources-2.6.39-r9 and -r10 emerge successfully for me but
> virtualbox-modules-4.1.0-r1 fails to emerge with the below error. emerges fine
> with hardened-sources-2.6.39-r8. am using gcc-4.5.3. 
> 
> /var/tmp/portage/app-emulation/virtualbox-modules-4.1.0-r1/work/vboxdrv/SUPDrv.c:
> In function ‘supdrvIDC_LdrGetSymbol’:
> /var/tmp/portage/app-emulation/virtualbox-modules-4.1.0-r1/work/vboxdrv/SUPDrv.c:4346:17:
> error: assignment of read-only member ‘Out’
> /var/tmp/portage/app-emulation/virtualbox-modules-4.1.0-r1/work/vboxdrv/SUPDrv.c:4377:21:
> error: assignment of read-only member ‘Out’
> 
> am assuming it's the same issue, or can open another bug.

Different issue, please open another bug.
Comment 8 PaX Team 2011-08-15 10:25:27 UTC
(In reply to comment #7)
> Different issue, please open another bug.

also include the fix i've just uploaded to my homedir ;)
Comment 9 Anthony Basile gentoo-dev 2011-08-16 09:45:34 UTC
(In reply to comment #4)
> Hi guys,
> 
> Just enable CONFIG_SMP for now as a workaround.  This will be fixed properly
> soon.
> 
> Thanks,
> -Brad

I just put

    hardened-sources-2.6.32-r62 = grsecurity-2.2.2-2.6.32.44-201108141242

    hardened-sources-2.6.39-r12 = grsecurity-2.2.2-2.6.39.4-201108141242

on the tree.  Does this contain the fix?

@all.  Test please.  I have not be hitting this one since I have not yet moved to gcc-4.5.3 on any of my test systems.
Comment 10 Boney McCracker 2011-08-16 23:33:36 UTC
> I just put
> 
>     hardened-sources-2.6.32-r62 = grsecurity-2.2.2-2.6.32.44-201108141242
> 
>     hardened-sources-2.6.39-r12 = grsecurity-2.2.2-2.6.39.4-201108141242
> 
> on the tree.  Does this contain the fix?
> 
> @all.  Test please.  I have not be hitting this one since I have not yet moved
> to gcc-4.5.3 on any of my test systems.

Testing hardened-sources-2.6.39-r12 I get the same error:
-----------------------------------------------------------------------
linux # make
scripts/kconfig/conf --silentoldconfig Kconfig
  HOSTCC  -fPIC tools/gcc/constify_plugin.o
  HOSTCC  -fPIC tools/gcc/stackleak_plugin.o
  HOSTLLD -shared tools/gcc/stackleak_plugin.so
  HOSTLLD -shared tools/gcc/constify_plugin.so
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  CC      kernel/bounds.s
  GEN     include/generated/bounds.h
  CC      arch/x86/kernel/asm-offsets.s
In file included from include/linux/fs.h:393:0,
                 from include/linux/module.h:19,
                 from include/linux/crypto.h:21,
                 from arch/x86/kernel/asm-offsets.c:8:
include/linux/semaphore.h: In function ‘sema_init’:
include/linux/semaphore.h:35:17: error: assignment of read-only location ‘*sem’
In file included from /usr/src/linux-2.6.39-hardened-r12/arch/x86/include/asm/uaccess.h:11:0,
                 from include/linux/uaccess.h:5,
                 from include/linux/crypto.h:26,
                 from arch/x86/kernel/asm-offsets.c:8:
include/linux/sched.h: In function ‘thread_group_cputime_init’:
include/linux/sched.h:2579:2: error: assignment of read-only member ‘lock’
make[1]: *** [arch/x86/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2
-----------------------------------------------------------------------
Comment 11 Anthony Basile gentoo-dev 2011-08-17 09:10:22 UTC
(In reply to comment #10)
> > I just put
> > 
> >     hardened-sources-2.6.32-r62 = grsecurity-2.2.2-2.6.32.44-201108141242
> > 
> >     hardened-sources-2.6.39-r12 = grsecurity-2.2.2-2.6.39.4-201108141242
> > 
> > on the tree.  Does this contain the fix?
> > 
> > @all.  Test please.  I have not be hitting this one since I have not yet moved
> > to gcc-4.5.3 on any of my test systems.
> 
> Testing hardened-sources-2.6.39-r12 I get the same error:
> -----------------------------------------------------------------------
> linux # make
> scripts/kconfig/conf --silentoldconfig Kconfig
>   HOSTCC  -fPIC tools/gcc/constify_plugin.o
>   HOSTCC  -fPIC tools/gcc/stackleak_plugin.o
>   HOSTLLD -shared tools/gcc/stackleak_plugin.so
>   HOSTLLD -shared tools/gcc/constify_plugin.so
>   CHK     include/linux/version.h
>   UPD     include/linux/version.h
>   CHK     include/generated/utsrelease.h
>   UPD     include/generated/utsrelease.h
>   CC      kernel/bounds.s
>   GEN     include/generated/bounds.h
>   CC      arch/x86/kernel/asm-offsets.s
> In file included from include/linux/fs.h:393:0,
>                  from include/linux/module.h:19,
>                  from include/linux/crypto.h:21,
>                  from arch/x86/kernel/asm-offsets.c:8:
> include/linux/semaphore.h: In function ‘sema_init’:
> include/linux/semaphore.h:35:17: error: assignment of read-only location ‘*sem’
> In file included from
> /usr/src/linux-2.6.39-hardened-r12/arch/x86/include/asm/uaccess.h:11:0,
>                  from include/linux/uaccess.h:5,
>                  from include/linux/crypto.h:26,
>                  from arch/x86/kernel/asm-offsets.c:8:
> include/linux/sched.h: In function ‘thread_group_cputime_init’:
> include/linux/sched.h:2579:2: error: assignment of read-only member ‘lock’
> make[1]: *** [arch/x86/kernel/asm-offsets.s] Error 1
> make: *** [prepare0] Error 2
> -----------------------------------------------------------------------

Okay, I started to look at this more carefully.  Its part of upstream's new constification push.  Can you attach you config file so I can be sure I'm hitting the same bug.
Comment 12 Boney McCracker 2011-08-17 22:37:29 UTC
(In reply to comment #11)
> Okay, I started to look at this more carefully.  Its part of upstream's new
> constification push.  Can you attach you config file so I can be sure I'm
> hitting the same bug.

No, because I have un-emerged it, deleted the source directories, masked hardened-source-2.6.39-r{9-12}, and reverted to -r8.

I can emerge -r12 again, set CONFIG_SMP=y again, and send you the configuration file. Would you like me to do so?
Comment 13 Francisco Blas Izquierdo Riera (RETIRED) gentoo-dev 2011-08-17 23:06:05 UTC
(In reply to comment #12)
> No, because I have un-emerged it, deleted the source directories, masked
> hardened-source-2.6.39-r{9-12}, and reverted to -r8.
> 
> I can emerge -r12 again, set CONFIG_SMP=y again, and send you the configuration
> file. Would you like me to do so?
If you want to see it fixed in the foreseable future please do, AFAIK nor the PaX Team nor spender nor blueness practice adivination techniques and can't fix the problem if they can't reproduce it ;)
Comment 14 Brad Spengler 2011-08-17 23:08:40 UTC
It's not necessary; we can reproduce the same bug.

Thanks,
-Brad
Comment 15 Boney McCracker 2011-08-18 00:49:00 UTC
Created attachment 283707 [details]
config-2.6.39-hardened-r12.txt (brendler)

I did it anyway.  This is the same config, stripped of all the firewall/router crap, so it will be simpler to compare. I did run 'make' again and verified that it fails with precisely the same error.

Thanks.
Comment 16 Boney McCracker 2011-08-18 00:58:47 UTC
Also, just for accuracy, since posting emerge --info above, have upgraded gcc from 4.5.3 to 4.5.3-r1 (with the problem persisting, of course).
Comment 17 Attila Tóth 2011-08-18 12:40:55 UTC
(In reply to comment #16)
> Also, just for accuracy, since posting emerge --info above, have upgraded gcc
> from 4.5.3 to 4.5.3-r1 (with the problem persisting, of course).

I'd like to confirm as well.
Comment 18 Radoslaw Madej (radegand) 2011-08-18 21:16:20 UTC
I also fail to compile 2.6.39-hardened-r19 but the compilation seems to be failing in another place, see the attached log file.
Comment 19 Radoslaw Madej (radegand) 2011-08-18 21:17:14 UTC
Created attachment 283825 [details]
genkernel.log 2.6.39-hardened-r12
Comment 20 Radoslaw Madej (radegand) 2011-08-18 21:18:03 UTC
Created attachment 283827 [details]
kernel config 2.6.39-hardened-r12
Comment 21 Anthony Basile gentoo-dev 2011-08-18 22:21:46 UTC
(In reply to comment #20)
> Created attachment 283827 [details]
> kernel config 2.6.39-hardened-r12

This is a different issue. The problem is the version of gcc and -Wno-unused-but-set-variable and the above workaround does not apply here.

Open another bug if you want, and try compiling with gcc-4.4.5 and/or gcc-4.5.3 and/or gcc-4.6.0.
Comment 22 Dennis Freise 2011-08-19 22:19:49 UTC
Bug confirmed.
temporary fix confirmed (CONFIG_SMP=y)
Comment 23 Anthony Basile gentoo-dev 2011-08-24 12:10:25 UTC
Upstream is dropping support for 2.6.39 and I added the ebuild for the last one to the tree.  Unfortunately I don't think it solves this bug.

Can people please test the following on x86 with CONFIG_SMP on and off:

    hardened-sources-2.6.39-r13
    hardened-sources-2.6.32-r63

Please use gcc-4.4.5.

(If you have time/energy, you can also test with gcc-4.5.3 and gcc-4.6.0.  These will probably lead to a different compile time error irrespective of whether SMP is on or off --- see Madej's comments above.  Open another bug for that.)
Comment 24 PaX Team 2011-08-24 12:38:01 UTC
(In reply to comment #23)
> Upstream is dropping support for 2.6.39 and I added the ebuild for the last one
> to the tree.  Unfortunately I don't think it solves this bug.

actually, i should have fixed the !SMP problem, along with many others reported for the last month (including gcc plugin support for 4.6.x as well, tested on allyesconfig and allmodconfig), so if anything still fails, let me know.
Comment 25 Boney McCracker 2011-08-24 14:54:08 UTC
(In reply to comment #23)

I no longer have gcc-4.4.5 installed.  Using gcc-4.5.3, hardened-sources-2.6.39-r13 fails with the exact same error originally posted.
Comment 26 Attila Tóth 2011-08-25 15:56:12 UTC
(In reply to comment #24)
> (In reply to comment #23)
> > Upstream is dropping support for 2.6.39 and I added the ebuild for the last one
> > to the tree.  Unfortunately I don't think it solves this bug.
> 
> actually, i should have fixed the !SMP problem, along with many others reported
> for the last month (including gcc plugin support for 4.6.x as well, tested on
> allyesconfig and allmodconfig), so if anything still fails, let me know.

I was waiting for a version bump and I could test hardened sources today. However in the mean time we have hardened-sources-3.0.3. So I went for that one. My feedback is positive. It compiled fine using gcc-4.5.3 and !CONFIG_SMP. Although I don't know what's the case with hardened-sources-2.6.39-r13...
Comment 27 Boney McCracker 2011-08-25 16:51:49 UTC
Yes, hardened-sources-3.0.3 is okay with "CONFIG_SMP=n" and gcc-4.5.3.
Comment 28 Anthony Basile gentoo-dev 2011-08-26 10:14:24 UTC
Upstream has moved passed 2.6.39 to 3.0.3.  I don't believe the fix made it into any 2.6.39 so 2.6.39-r8 will be the last stable hardened kernel in the .39 series.  I will leave hardened-sources-2.6.39-r{9,10,11,12,13} up for a while but when the first 3.0.3 is stabilized, these will be removed.  Users who need .39 will be asked to use -r8, unless someone gives me a *very* good reason to backport the fix.

FYI, my approach has been to frequently put new ebuilds up so that this community can test and report back upstream.  However, few of these reach stable which mean something one can use on production machines.
Comment 29 Boney McCracker 2011-08-26 13:47:40 UTC
I for one don't need 2.6.39. Thank you all.
Comment 30 Anthony Basile gentoo-dev 2011-08-27 00:28:17 UTC
Reopen this if you don't feel this issue is closed as per comment 28.