I try to run hardened desktop with nvidia drivers, however some applications (nitrogen xfce4-terminal xfsettingsd) seem to go into infinite loop (using one of the cpus at 100%) with nvidia's libGL.so . [ebuild U ] x11-drivers/nvidia-drivers-319.23 [319.17] USE="X acpi (multilib) pax_kernel tools" 0 k % gdb nitrogen GNU gdb (Gentoo 7.6 p1) 7.6 Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". For bug reporting instructions, please see: <http://bugs.gentoo.org/>... Reading symbols from /usr/bin/nitrogen...(no debugging symbols found)...done. (gdb) run --restore Starting program: /usr/bin/nitrogen --restore warning: Cannot call inferior functions, Linux kernel PaX protection forbids return to non-executable pages! warning: Could not load shared library symbols for linux-vdso.so.1. Do you need "set solib-search-path" or "set sysroot"? [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". ^C Program received signal SIGINT, Interrupt. 0x000003260177a043 in pthread_mutex_lock () from /lib64/libpthread.so.0 (gdb) backtrace #0 0x000003260177a043 in pthread_mutex_lock () from /lib64/libpthread.so.0 #1 0x00000326034c0308 in ?? () from /lib64/ld-linux-x86-64.so.2 #2 0x00000325fed7b135 in ?? () from /lib64/libselinux.so.1 #3 0x00000325fed7a13e in is_selinux_enabled () from /lib64/libselinux.so.1 #4 0x00000325fe596116 in ?? () from /usr/lib64/libGL.so.1 #5 0x00000325fe573429 in ?? () from /usr/lib64/libGL.so.1 #6 0x00000326034cdbb2 in ?? () from /lib64/ld-linux-x86-64.so.2 #7 0x00000326034cdcda in ?? () from /lib64/ld-linux-x86-64.so.2 #8 0x00000326034c06ca in ?? () from /lib64/ld-linux-x86-64.so.2 #9 0x0000000000000002 in ?? () #10 0x000003a37bbc84ee in ?? () #11 0x000003a37bbc8500 in ?? () #12 0x0000000000000000 in ?? () (gdb) When run with LD_PRELOAD="/usr/lib64/opengl/nvidia/lib/libGL.so.1" nitrogen --restore it runs fine I tried both stable (x11-drivers/nvidia-drivers-319.17) and unstable (x11-drivers/nvidia-drivers-319.23). Reproducible: Always Portage 2.1.12.2 (hardened/linux/amd64/selinux, gcc-4.7.3, glibc-2.17, 3.9.4-hardened x86_64) ================================================================= System uname: Linux-3.9.4-hardened-x86_64-Intel-R-_Core-TM-_i3_CPU_M_350_@_2.27GHz-with-gentoo-2.2 KiB Mem: 2996940 total, 1699828 free KiB Swap: 3145724 total, 3145724 free Timestamp of tree: Mon, 27 May 2013 00:45:01 +0000 ld GNU gold (GNU Binutils 2.23.1) 1.11 app-shells/bash: 4.2_p45 dev-lang/python: 2.7.5, 3.2.5, 3.3.2 dev-util/cmake: 2.8.10.2-r2 dev-util/pkgconfig: 0.28 sys-apps/baselayout: 2.2 sys-apps/openrc: 0.11.8 sys-apps/sandbox: 2.6-r1 sys-devel/autoconf: 2.13, 2.69 sys-devel/automake: 1.11.6, 1.12.6, 1.13.2 sys-devel/binutils: 2.23.1 sys-devel/gcc: 4.7.3 sys-devel/gcc-config: 1.8 sys-devel/libtool: 2.4.2 sys-devel/make: 3.82-r4 sys-kernel/linux-headers: 3.9 (virtual/os-headers) sys-libs/glibc: 2.17 Repositories: gentoo hardened-dev my_local_overlay ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="* -@EULA AdobeFlash-11.x PUEL skype-4.0.0.7-copyright google-talkplugin" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O3 -march=native -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-O3 -march=native -pipe" DISTDIR="/usr/portage/distfiles" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox selinux sesandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch webrsync-gpg xattr" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_US.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j5" PKGDIR="/usr/portage/packages" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/var/lib/layman/hardened-development /usr/local/portage" SYNC="" USE="X acpi alsa amd64 apache2 bash-completion berkdb bluetooth bzip2 cli cracklib crypt cups cxx dbus dri dvd gdbm gif gold gpm hardened iconv icu ipv6 jpeg jpeg2k justify libnotify mmx mng modules mp3 mudflap multilib mysql ncurses nls nptl open_perms opengl openmp pam pax_kernel pcre png qt3support qt4 readline selinux session sse sse2 sse4_1 sse4_2 ssl ssse3 tcpd threads tiff udev unicode urandom usb v4l vaapi vdpau vim-syntax vlc wacom xattr xft xinerama zlib zsh-completion" ABI_X86="64" 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="authn_core authz_core socache_shmcb unixd 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="kexi words flow plan sheets stage tables krita karbon braindump author" 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" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_GB pl" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" QEMU_SOFTMMU_TARGETS="x86_64 ppc" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="nvidia" 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, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Created attachment 349404 [details] strace of nitrogen --restore
Created attachment 349406 [details] strace of LD_PRELOAD="/usr/lib64/opengl/nvidia/lib/libGL.so.1" nitrogen --restore
This seems to be caused by selinux awareness in nvidia drivers, after disabling selinux in kernel everything works fine.
warning: Cannot call inferior functions, Linux kernel PaX protection forbids return to non-executable pages! warning: Could not load shared library symbols for linux-vdso.so.1. This is why we masked these on the hardened profiles. We cannot fix this. All you can do is relax the hardening, in which case, just use a vanilla kernel. I'm cc-ing Zero_Chaos who may know more. In my experience, I've never gotten the nvidia drivers working right with hardened. My recommendation is that you use nouveau.
Seems like I'm not the only one to have problems with selinux and nvidia, recently this surfaced on selinux mailing list: http://thread.gmane.org/gmane.comp.security.selinux/19519 https://bugzilla.gnome.org/show_bug.cgi?id=706836 From backtraces on gnome bugzilla seems like same problem, so there are chances that it gets fixed.
The nvidia drivers work for cuda/opencl on hardened, my intent was never to use them as video drivers. I have tested with using xorg-x11 set for opengl and things seem to work okay, I've never gone beyond that.
Just noting that it's supposedly fixed upstream. However I can't test it because 331.17 doesn't seem to build. (Yes, yes, I know, unsupported on hardened :D ) One reason is incompatiblity with 3.11 kernels (num_physpages -> get_num_physpages), other that pax patch needs to be updated (, even with those resolved it seems to fail telling me it tries to modify read only struct /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/work/kernel/nv_uvm_interface.c: In function ‘nvUvmInterfaceRegisterUvmOps’: /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/work/kernel/nv_uvm_interface.c:387:5: error: assignment of member ‘sessionCreate’ in read-only object /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/work/kernel/nv_uvm_interface.c:388:5: error: assignment of member ‘sessionDestroy’ in read-only object /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/work/kernel/nv_uvm_interface.c:389:5: error: assignment of member ‘addressSpaceCreate’ in read-only object /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/work/kernel/nv_uvm_interface.c:390:5: error: assignment of member ‘addressSpaceCreateMirrored’ in read-only object /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/work/kernel/nv_uvm_interface.c:391:5: error: assignment of member ‘addressSpaceDestroy’ in read-only object /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/work/kernel/nv_uvm_interface.c:392:5: error: assignment of member ‘allocGpuMemoryFB’ in read-only object /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/work/kernel/nv_uvm_interface.c:393:5: error: assignment of member ‘allocGpuMemorySys’ in read-only object /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/work/kernel/nv_uvm_interface.c:394:5: error: assignment of member ‘freeGpuMemory’ in read-only object /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/work/kernel/nv_uvm_interface.c:395:5: error: assignment of member ‘cpuMap’ in read-only object /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/work/kernel/nv_uvm_interface.c:396:5: error: assignment of member ‘cpuUnmap’ in read-only object /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/work/kernel/nv_uvm_interface.c:397:5: error: assignment of member ‘channelAllocate’ in read-only object /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/work/kernel/nv_uvm_interface.c:398:5: error: assignment of member ‘channelDestroy’ in read-only object /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/work/kernel/nv_uvm_interface.c:399:5: error: assignment of member ‘channelTranslateError’ in read-only object /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/work/kernel/nv_uvm_interface.c:400:5: error: assignment of member ‘copyEngineAllocate’ in read-only object /var/tmp/portage/x11-drivers/nvidia-drivers-331.17/work/kernel/nv_uvm_interface.c:401:5: error: assignment of member ‘getAttachedUuids’ in read-only object probably caused by something being defined as const (constified?) in either nvidia or kernel itself.
So after editing kernel/nvidia-modules-common.mk to disable UVM, I was able to build driver, after manually applying pax patch (it basically looks the same, haven't looked too much why it fails to apply). Xfce starts without problem, so I confirm that it is fixed by upstream.