Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 643204 - x11-drivers/nvidia-drivers with kernel 4.14.11 with PAGE_TABLE_ISOLATION - FATAL: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol 'cpu_tlbstate'
Summary: x11-drivers/nvidia-drivers with kernel 4.14.11 with PAGE_TABLE_ISOLATION - FA...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Jeroen Roovers (RETIRED)
URL: https://devtalk.nvidia.com/default/to...
Whiteboard:
Keywords:
: 643250 643362 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-01-03 02:47 UTC by Chris Smith
Modified: 2018-01-15 05:23 UTC (History)
27 users (show)

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


Attachments
4.14.11 .config file (config-4.14.11,102.82 KB, text/plain)
2018-01-03 19:28 UTC, Rolf S. Arvidson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Smith 2018-01-03 02:47:40 UTC
make -f /usr/src/linux-4.14.11-gentoo/scripts/Makefile.modpost
  find /var/tmp/portage/x11-drivers/nvidia-drivers-387.34/work/kernel/.tmp_versions -name '*.mod' | xargs -r grep -h '\.ko$' | sort -u | sed 's/\.ko$/.o/' | scripts/mod/modpost   -i ./Module.symvers -I /var/tmp/portage/x11-drivers/nvidia-drivers-387.34/work/kernel/Module.symvers  -o /var/tmp/portage/x11-drivers/nvidia-drivers-387.34/work/kernel/Module.symvers -S  -w  -s -T -
FATAL: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol 'cpu_tlbstate'
make[3]: *** [/usr/src/linux-4.14.11-gentoo/scripts/Makefile.modpost:92: __modpost] Error 1


Recompiling gentoo-sources-4.14.11 with PAGE_TABLE_ISOLATION disables allows the nVidia driver to compile and install.
Comment 1 xxoo 2018-01-03 03:09:02 UTC
when 340.104, same issue too.
Comment 2 Ben Kohler gentoo-dev 2018-01-03 17:45:29 UTC
*** Bug 643250 has been marked as a duplicate of this bug. ***
Comment 3 Rolf S. Arvidson 2018-01-03 19:25:21 UTC
Identical error to Chris's, and can confirm that his change, building sys-kernel/gentoo-sources-4.14.11 with
# CONFIG_PAGE_TABLE_ISOLATION is not set
allows x11-drivers/nvidia-drivers-387.34 to compile/install OK
Comment 4 Rolf S. Arvidson 2018-01-03 19:28:24 UTC
Created attachment 513124 [details]
4.14.11 .config file

Added kernel config
Comment 5 Cănărău Constantin 2018-01-03 21:24:50 UTC
It remains to be seen how serious x86 PTI issue really is, even without an hypervisor.
Considering the noise in the media and despite potential serious performance impact PAGE_TABLE_ISOLATION can became mandatory for Intel CPUs. 
As a personal opinion, I do not want to assume that kind of risks. Short term solution ? Nouveau ?
Comment 6 Nick 2018-01-04 06:10:43 UTC
Short term solution that keeps PAGE_TABLE_ISOLATION=y is this: https://devtalk.nvidia.com/default/topic/1028222/lts-kernel-patch-for-intel-cpu-vulnerability-breaks-nvidia-driver/

I can confirm that applying the patch in the link allows nvidia-drivers to compile with PAGE_TABLE_ISOLATION=y on 4.14.11, and the driver seems to work fine upon booting (despite what the poster who provides the patch says, I needed to change the license in all three files and not just nv.c).

I'm not going to attach it as a patch since I doubt this can be endorsed by distros but here is the text of the patch you want (in /etc/portage/patches/x11-drivers/nvidia-drivers-<VERSION>) in case the link becomes broken:

diff -urN NVIDIA-Linux-x86_64-384.98/kernel/nvidia/nv.c NVIDIA-Linux-x86_64-384.98-new/kernel/nvidia/nv.c
--- NVIDIA-Linux-x86_64-384.98/kernel/nvidia/nv.c	2017-10-26 23:19:51.000000000 +0000
+++ NVIDIA-Linux-x86_64-384.98-new/kernel/nvidia/nv.c	2018-01-03 11:11:11.642969571 +0000
@@ -40,7 +40,7 @@
 
 #if (NV_BUILD_MODULE_INSTANCES != 0)
 #if defined(MODULE_LICENSE)
-MODULE_LICENSE("NVIDIA");
+MODULE_LICENSE("GPL");
 #endif
 #if defined(MODULE_INFO)
 MODULE_INFO(supported, "external");
diff -urN NVIDIA-Linux-x86_64-384.98/kernel/nvidia/nv-frontend.c NVIDIA-Linux-x86_64-384.98-new/kernel/nvidia/nv-frontend.c
--- NVIDIA-Linux-x86_64-384.98/kernel/nvidia/nv-frontend.c	2017-10-26 23:19:52.000000000 +0000
+++ NVIDIA-Linux-x86_64-384.98-new/kernel/nvidia/nv-frontend.c	2018-01-03 11:11:34.569635270 +0000
@@ -15,7 +15,7 @@
 #include "nv-frontend.h"
 
 #if defined(MODULE_LICENSE)
-MODULE_LICENSE("NVIDIA");
+MODULE_LICENSE("GPL");
 #endif
 #if defined(MODULE_INFO)
 MODULE_INFO(supported, "external");
diff -urN NVIDIA-Linux-x86_64-384.98/kernel/nvidia-modeset/nvidia-modeset-linux.c NVIDIA-Linux-x86_64-384.98-new/kernel/nvidia-modeset/nvidia-modeset-linux.c
--- NVIDIA-Linux-x86_64-384.98/kernel/nvidia-modeset/nvidia-modeset-linux.c	2017-10-26 23:19:56.000000000 +0000
+++ NVIDIA-Linux-x86_64-384.98-new/kernel/nvidia-modeset/nvidia-modeset-linux.c	2018-01-03 11:12:20.209633345 +0000
@@ -1309,7 +1309,7 @@
 module_exit(nvkms_exit);
 
 #if defined(MODULE_LICENSE)
-  MODULE_LICENSE("NVIDIA");
+  MODULE_LICENSE("GPL");
 #endif
 #if defined(MODULE_INFO)
   MODULE_INFO(supported, "external");
Comment 7 Cănărău Constantin 2018-01-04 13:40:30 UTC
Yes, both solutions, Nick posted patch and setting EXPORT_SYMBOL(cpu_tlbstate) in /usr/src/linux/arch/x86/mm/init.c work, but only as temporarily personal workaround. 
Of course, no distribution can "officially" resort to that kind of fix. 
Thank you!
Comment 8 Jeroen Roovers (RETIRED) gentoo-dev 2018-01-04 21:20:43 UTC
You could try out 384.111 or 390.12. Make sure you have a backup kernel in place in case it goes horribly wrong and you can't stop it from loading nvidia.ko.
Comment 9 Harris Landgarten 2018-01-04 22:18:40 UTC
I can verify that nvidia-drivers-390.12 builds and running fine with 4.11.2 with page_isolation enabled
Comment 10 Chris Smith 2018-01-04 23:16:16 UTC
Success building nvidia-drivers-390.12 against gentoo-sources-4.14.11-r2. Running OK so far.
Comment 11 Chris Smith 2018-01-04 23:17:09 UTC
(In reply to Chris Smith from comment #10)
> Success building nvidia-drivers-390.12 against gentoo-sources-4.14.11-r2.
> Running OK so far.

Yes, with KPTI enabled.
Comment 12 email200202 2018-01-05 15:56:55 UTC
nvidia-drivers-390.12 builds OK on gentoo-sources-4.14.11-r2
Comment 13 Jeroen Roovers (RETIRED) gentoo-dev 2018-01-05 22:41:35 UTC
Just a note of WARNING: be very careful about running this on an AMD CPU. Those patches were not written with *gasp* alternative x86 architectures in mind. Indeed, it crashed one of my systems while loading a web browser that does some *GL stuff for *gasp* rendering web pages.
Comment 14 Jonas Stein gentoo-dev 2018-01-06 01:21:45 UTC
*** Bug 643362 has been marked as a duplicate of this bug. ***
Comment 15 Stefano 2018-01-06 12:19:45 UTC
(In reply to email200202 from comment #12)
> nvidia-drivers-390.12 builds OK on gentoo-sources-4.14.11-r2

Confirm original bug, confirm that 390.12 builds on 4.14.11-r2, seemingly the resulting driver works okay also with bbswitch/bumblebee.
Comment 16 Frank Krömmelbein 2018-01-06 15:25:26 UTC
Works for me on amd64 without issues: 
sys-kernel/gentoo-sources-4.14.12 and x11-drivers/nvidia-drivers-390.12
Comment 18 kfm 2018-01-09 00:49:38 UTC
I should have posted the upstream commit. Here it is:-

https://github.com/torvalds/linux/commit/1e5476815fd7.patch
Comment 19 Helmut Auer 2018-01-11 11:17:56 UTC
The problem is fixed with kernel 4.14.13 !