Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 282201

Summary: kernel sources compiled with gcc enabled PIE fail to enable framebuffer.
Product: Gentoo Linux Reporter: Xake <kanelxake>
Component: [OLD] Core systemAssignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers <kernel>
Status: RESOLVED FIXED    
Severity: normal CC: 2009_Kev_Gentoo, hardened, hkmaly, kfm, meyerm, tommy, zorry
Priority: High Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=c47efe5548abbf53c2f66e06dcb46183b11d6b22
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Make gcc not use hardened when checking for command options

Description Xake 2009-08-21 12:55:46 UTC
Since gentoo-sources-2.6.29 (or even vanilla-sources) my computer has a problem booting.

The message is:
"Undefined video mode number: ffff"

If I press enter (or use vga=ask) I get an empty list.

This is both at system boot or if I start the kernel in kvm with an empty cmdline.
After some compiling/recompiling I found that kernel versions 2.6.28 does not have this problem but newer.

The kernel configuration is the default you get if you do not pass any options to genkernel. have also tried "make defconfig" and have tried the config from the livecd.

So I do not know really where this problem is.
It came with the newer versions of the kernel, however fedora-11 nor ubuntu-9.04 seems to have this problem.

Reproducible: Always

Steps to Reproduce:
1. emerge \>=gentoo-sources-2.6.29*
2. genkernel all
3. reboot into the new kernel

Actual Results:  
"Undefined video mode number: ffff"

and then the kernel wait for 30 seconds for you to either press enter (to get an empty list of avaible modes) or press space to resume boot.

Expected Results:  
booting should continue instantly

Portage 2.2_rc38 (hardened/linux/amd64/2008.0, gcc-4.4.1, glibc-2.10.1-r0, 2.6.31-rc6 x86_64)
=================================================================
System uname: Linux-2.6.31-rc6-x86_64-Intel-R-_Core-TM-_i7_CPU_920_@_2.67GHz-with-gentoo-2.0.1
Timestamp of tree: Fri, 21 Aug 2009 01:00:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p28
dev-java/java-config: 2.1.8-r1
dev-lang/python:     2.6.2-r1, 3.1.1
dev-python/pycrypto: 2.0.1-r8
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.6.4-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.4.3-r3
sys-apps/sandbox:    2.0
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.9.6-r2, 1.10.2, 1.11
sys-devel/binutils:  2.19.1-r1
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="amd64 ~amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -ftree-vectorize -ggdb -mtune=native -floop-interchange -floop-strip-mine -floop-block"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-march=native -O2 -pipe -ftree-vectorize -ggdb -mtune=native -floop-interchange -floop-strip-mine -floop-block"
DISTDIR="/var/portage/distfiles"
FEATURES="assume-digests candy ccache distlocks fixpackages metadata-transfer parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict test unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="ftp://ftp.sunet.se/pub/os/Linux/distributions/gentoo"
LANG="sv_SE.UTF-8"
LC_ALL="C"
LDFLAGS="-Wl,--as-needed -Wl,-O1 -Wl,--sort-common -Wl,--warn-once,--hash-style=gnu"
LINGUAS="sv"
MAKEOPTS="-j25 -l10"
PKGDIR="/var/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="/var/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/gnome /usr/local/portage/layman/x11 /usr/local/portage/layman/xake-toolchain /usr/local/portage/mine /usr/local/portage/notify-osd-overlay"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac accessibility acl acpi alsa amd64 amr amrnb amrwb applet archive avahi bash-completion bluetooth bzip2 cairo ccache cdaudio cdda cdr cleartype cli consolekit cracklib crypt cups cxx dbus deskbar device-mapper devicekit devkit dhcpcd digitalradio djvu dmraid dri dts dvd dvdr dvi eds encode eselect evo exif faac fat fbcondecor ffmpeg fftw flac fuse gallium gdbm gif glib gmp gnome gnome-keyring gnutls gphoto2 gpm grammar graphite gsf gsm gstreamer gtk hal hardened iconv iconvacl icu id3tag idn ieee1394 iptc isdnlog jabber java6 jpeg jpeg2k justify kvm lcms libnotify logrotate lvm mad maps math matroska mktemp mms mmx mmxext moonlight mp2 mp3 mpeg mpi mtp mudflap multilib musepack musicbrainz nautilus ncurses network-cron networkmanager nfs nls nptl nptlonly ntfs offensive ogg opencore-amr opengl openmp openntpd ots pam pango parted pcre pdf perl pic pidgin png policykit pppd pulseaudio python qemu quicktime readline reflection samba session smp sms speex spell spl sse sse2 ssl ssse3 startup-notification subversion svg sysfs test tex theora thesaurus threads tiff totem tracker truetype udev unicode urandom usb userlocales v4l vhook videos vim-syntax vorbis x264 x364 xcb xcomposite xmp xmpp xorg xulrunner xv xvid xvmc zlib" ALSA_CARDS="hda-intel" 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 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" CAMERAS="canon" ELIBC="glibc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="sv" SANE_BACKENDS="net" USERLAND="GNU" VIDEO_CARDS="nv nouveau"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Saphirus 2009-08-21 20:43:23 UTC
The "video mode number" issue is making me believe you have improper drivers selected or some improper kernel configuration, as I've used genkernel successfully since 2.6.24, and am currently running 2.6.30-r4. 
Comment 2 Xake 2009-08-21 22:16:14 UTC
Did you read that I used the configuration from genkernel without changes? The way I did it was that I emptied /etc/kernels and ran 'genkernel all' which picks upp the kernel-config boundled with genkernel. 2.6.28 did not give the message, 2.6.29 did give the message. So in that case is the 'misconfiguration' in the default configuration for genkernel, thus a bug here.

Funny part is that the weekly livecd boots without problems, but using that configuration for gentoo-sources-2.6.30* (which is what the cd uses) gives me the message.

If you search the forums @ f.g.o you will find more people that seems to have this problem, one of them even suggested that it had to do with the introduction of Intel KMS which neither he or I uses.

I have another gentoo-computer which does not have this problem, and I do not know why...

The funny part is that I just took out grub2 for a spin, and doing no other change but to use grub2 the message disappered.

So I think this seems to be that newer kernels fails to init the VGABIOS or something like that with genkernels default configuration (or any other configuration I tried) and thus got no modes unless the bootloader does something.
SYSLINUX for the livecd seems to do the trick, grub2 seems to do the trick, grub-0.x does not do the trick for me. And if you were online over at #gentoo-hardened@irc.freenode.org you would see Anarchy complaining about what appeared to be the exact same problem.
Comment 3 Jory A. Pratt gentoo-dev 2009-08-22 18:54:38 UTC
Hardened will be assignee until we can rule out a toolchain issue first.
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-08-22 19:00:39 UTC
bringing in base-system, as I've been wondering something re grub1 and hardened kernels for a bit.

If you explicitly recompile and reinstall (the MBR) grub1 with a your GCC profile changed to non-hardened, does the problem go away?
Comment 5 Xake 2009-08-22 19:27:20 UTC
Ok, efter som talking with Anarchy I realised the following (where /boot/kernel is a link to my current system kernel):

With hardened gcc-specs:
'kvm -kernel /boot/kernel'
gives the message.
With "-vanilla" gcc-specs there is no message.

Using kvm rules out that the bootloader got anything to do with this problem (even if it seems to be able to be used as a workaround).

So this seems to be miscompilation with hardened.
Next step: rule out SSP and/or PIE...
Comment 6 Jory A. Pratt gentoo-dev 2009-08-22 20:35:38 UTC
*** Bug 257914 has been marked as a duplicate of this bug. ***
Comment 7 Jory A. Pratt gentoo-dev 2009-08-22 21:25:57 UTC
This is defintely an issue when using PIE enabled gcc, disable PIE support in gcc will resolve the issue with framebuffers. This is a workaround until we find out what code is being generated that is causing such an issue.
Comment 8 kfm 2009-08-22 21:26:55 UTC
I'm experiencing the same problem and must confess to being somewhat puzzled; aren't the hardened specs disregarded in the -D__KERNEL__ case? For the record, I'm also using grub-static-0.97-r9.
Comment 9 Xake 2009-08-22 22:28:42 UTC
For reference the kernel commit that breaks this:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a1a00b58855ccdbedf556b4f5638d5208b454472

How this should be handled I leave to the one who wants to touch gcc-3.4.6-r2 and/or hardened gcc-4 and/or the kernel source.
Comment 10 SpanKY gentoo-dev 2009-08-22 23:25:18 UTC
doesnt seem related to grub ...
Comment 11 Fredric Johansson 2009-08-27 15:56:48 UTC
This issue seems to be due to video-vga.c being compiled incorrectly.
video-vga.o is missing the section .videocards when compiled with hardened-specs
while its there when compiled with hardenednopie
Reverting the the commit shown in comment #9 and compiling shows the section in the objectfile even for hardenedspecs
Comment 12 Xake 2009-08-27 16:38:33 UTC
The funny part about it is that video-vga.c is compiled without hardened just like it should.
The only thing in the kernel tree built with hardened (like it always have been) is the userspace tools (like kallsyms and other stuff compiled with HOSTCC) and since those are used to generate headers and asm-symbol-tables and so on I am unsure if they can somehow have an impact.
Comment 13 Magnus Granberg gentoo-dev 2009-08-28 01:20:09 UTC
Created attachment 202445 [details, diff]
Make gcc not use hardened when checking for command options

The arch/*/boot/Makefile use cc-options to check for GCC command options and
cc-options use the hardened specs when checking for GCC command options.
When -fPIE is pass to cc1 it can't use -ffreestanding or -fno-toplevel-reorder.
Then it fail to build stuff with -ffreestanding and -fno-toplevel-reorder.
Thanks Vinky
Comment 14 Kevin Zuber 2009-08-30 17:19:47 UTC
I've got the same messages, using kvm and a hardened profile.
But I do not use genkernel. I'm using a self configured kernel.

Also my system dies after some time (a few minutes - some hours). Kernel stack trace is the result. I don't know if it has something to do with this bug or is another one.
Comment 15 Jory A. Pratt gentoo-dev 2009-08-30 18:47:43 UTC
(In reply to comment #14)
> I've got the same messages, using kvm and a hardened profile.
> But I do not use genkernel. I'm using a self configured kernel.
> 
> Also my system dies after some time (a few minutes - some hours). Kernel stack
> trace is the result. I don't know if it has something to do with this bug or is
> another one.
> 

Test the patch. ALl issues with framebuffer not working can be fixed with the simple inclusion of patch here on the bug report.
Comment 16 Xake 2009-09-24 18:56:55 UTC
I have to say congratulations to Zorry and anarchy for landing this patch!

Now maybe it is time to reassign this bug to the gentoo kernel developers and maybe get this integrated into the genpatches-base since this hits all hardened gentoo-users currently, even them using gentoo-sources?
Comment 17 Jory A. Pratt gentoo-dev 2009-09-25 00:39:53 UTC
Kernel team please add to genpatches-base for all supported .29,30,31 kernels please.
Comment 18 Mike Pagano gentoo-dev 2009-09-26 16:46:03 UTC
InSVN for .30 and .31, the two currently supported gentoo-sources kernel.
Comment 19 Mike Pagano gentoo-dev 2009-10-09 13:27:53 UTC
released in both 2.6.30 and 2.6.31 gentoo sources
Comment 20 meyerm 2009-12-10 23:21:22 UTC
Will this get into hardened-sources as well?
Comment 21 Xake 2009-12-11 08:28:45 UTC
(In reply to comment #20)
> Will this get into hardened-sources as well?
> 

For hardened-sources this breaks currently only with 2.6.29, and that will probably never go stable and is currently not worked on. Instead the hardened team is working on 2.6.31, where this is fixed and it should enter the tree "when it is ready"(tm) which is hopefully soon.
Comment 22 meyerm 2009-12-11 16:58:45 UTC
Great! Thank you very much.