diff --git a/.SRCINFO b/.SRCINFO index 352dcb4..14b7c44 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = nvidia-340xx pkgdesc = NVIDIA drivers for linux, 340xx legacy branch pkgver = 340.108 - pkgrel = 5 + pkgrel = 6 url = https://www.nvidia.com/ arch = x86_64 license = custom @@ -11,13 +11,15 @@ pkgbase = nvidia-340xx conflicts = nvidia options = !strip source = https://us.download.nvidia.com/XFree86/Linux-x86_64/340.108/NVIDIA-Linux-x86_64-340.108-no-compat32.run - source = 01-unfuck-for-340.108-build-fix.patch - source = 02-unfuck-for-5.5.x.patch - source = fix_multi_core_build.patch + source = 01-fix_multi_core_build.patch + source = 02-unfuck-for-340.108-build-fix.patch + source = 03-unfuck-for-5.5.x.patch + source = 04-fix_message_in_dmesg.patch sha256sums = 995d44fef587ff5284497a47a95d71adbee0c13020d615e940ac928f180f5b77 + sha256sums = 82d14e9e6ec47c345d225d9f398238b7254cd5ae581c70e8521b9157ec747890 sha256sums = 2b7e3ef24846a40f4492e749be946e4f7f70ebed054bc2c9079f6cbdcbfabe57 sha256sums = c28d65854dd03e6a9e00d79fa0ca3521c11b2c198882bbd50870c8e71d18d765 - sha256sums = 82d14e9e6ec47c345d225d9f398238b7254cd5ae581c70e8521b9157ec747890 + sha256sums = 7f90e80be6338f6fc902d257d8ceb09e89b40d008f7a3ad9fe82833cd5b89316 pkgname = nvidia-340xx pkgdesc = NVIDIA drivers for linux, 340xx legacy branch diff --git a/fix_multi_core_build.patch b/01-fix_multi_core_build.patch similarity index 100% rename from fix_multi_core_build.patch rename to 01-fix_multi_core_build.patch diff --git a/01-unfuck-for-340.108-build-fix.patch b/02-unfuck-for-340.108-build-fix.patch similarity index 100% rename from 01-unfuck-for-340.108-build-fix.patch rename to 02-unfuck-for-340.108-build-fix.patch diff --git a/02-unfuck-for-5.5.x.patch b/03-unfuck-for-5.5.x.patch similarity index 100% rename from 02-unfuck-for-5.5.x.patch rename to 03-unfuck-for-5.5.x.patch diff --git a/04-fix_message_in_dmesg.patch b/04-fix_message_in_dmesg.patch new file mode 100644 index 0000000..f3d7090 --- /dev/null +++ b/04-fix_message_in_dmesg.patch @@ -0,0 +1,51 @@ +Patch by vova7890 +> vova7890 commented on 2020-03-19 01:01 +> I'm facing this message in dmesg: Bad or missing usercopy whitelist? +> Kernel memory exposure attempt detected from SLUB object 'nvidia_stack_t' +> A little search and I had portback this patch to 340xx. +> Can you please add this? https://zvova7890.com.ua/s/ed9JJG8KyQKQQBx +-- +vova7890 commented on 2020-03-19 01:01 +diff -Naur a/nv.c b/nv.c +--- a/nv.c 2019-12-12 00:04:24.000000000 +0200 ++++ b/nv.c 2020-03-19 04:21:13.923750900 +0200 +@@ -752,7 +752,7 @@ + NV_SPIN_LOCK_INIT(&km_lock); + #endif + +- NV_KMEM_CACHE_CREATE(nv_stack_t_cache, NV_STACK_CACHE_STR, nv_stack_t); ++ NV_KMEM_CACHE_CREATE_USERCOPY(nv_stack_t_cache, NV_STACK_CACHE_STR, nv_stack_t); + if (nv_stack_t_cache == NULL) + { + nv_printf(NV_DBG_ERRORS, "NVRM: stack cache allocation failed!\n"); +diff -Naur a/nv-linux.h b/nv-linux.h +--- a/nv-linux.h 2019-12-12 00:04:24.000000000 +0200 ++++ b/nv-linux.h 2020-03-19 04:21:13.927084233 +0200 +@@ -762,9 +762,27 @@ + kmem_cache = kmem_cache_create(name, sizeof(type), \ + 0, 0, NULL); \ + } ++#define NV_KMEM_CACHE_CREATE_FULL(name, size, align, flags, ctor) \ ++ kmem_cache_create(name, size, align, flags, ctor) + #else + #error "NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT value unrecognized!" + #endif ++ ++#define NV_KMEM_CACHE_CREATE_FULL_USERCOPY(name, size, align, flags, useroffset, usersize, ctor) \ ++ kmem_cache_create_usercopy(name, size, align, flags, useroffset, usersize, ctor); ++ ++#ifdef SLAB_USERCOPY ++#define NV_KMEM_CACHE_CREATE_USERCOPY(kmem_cache, name, type) \ ++ { \ ++ kmem_cache = NV_KMEM_CACHE_CREATE_FULL(name, sizeof(type), 0, SLAB_USERCOPY, NULL); \ ++ } ++#else ++#define NV_KMEM_CACHE_CREATE_USERCOPY(kmem_cache, name, type) \ ++ { \ ++ kmem_cache = NV_KMEM_CACHE_CREATE_FULL_USERCOPY(name, sizeof(type), 0, 0, 0, sizeof(type), NULL); \ ++ } ++#endif ++ + #define NV_KMEM_CACHE_DESTROY(kmem_cache) \ + { \ + kmem_cache_destroy(kmem_cache); \ diff --git a/PKGBUILD b/PKGBUILD index f0099bd..061ec50 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -6,7 +6,7 @@ pkgbase=nvidia-340xx pkgname=(nvidia-340xx nvidia-340xx-dkms) pkgver=340.108 -pkgrel=5 +pkgrel=6 pkgdesc="NVIDIA drivers for linux, 340xx legacy branch" arch=('x86_64') url="https://www.nvidia.com/" @@ -17,14 +17,16 @@ options=(!strip) # seems manjaro is keeping this current # https://gitlab.manjaro.org/packages?utf8=%E2%9C%93&filter=nvidia-340xx source=("https://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Linux-x86_64-${pkgver}-no-compat32.run" - 01-unfuck-for-340.108-build-fix.patch - 02-unfuck-for-5.5.x.patch - fix_multi_core_build.patch + 01-fix_multi_core_build.patch + 02-unfuck-for-340.108-build-fix.patch + 03-unfuck-for-5.5.x.patch + 04-fix_message_in_dmesg.patch ) sha256sums=('995d44fef587ff5284497a47a95d71adbee0c13020d615e940ac928f180f5b77' + '82d14e9e6ec47c345d225d9f398238b7254cd5ae581c70e8521b9157ec747890' '2b7e3ef24846a40f4492e749be946e4f7f70ebed054bc2c9079f6cbdcbfabe57' 'c28d65854dd03e6a9e00d79fa0ca3521c11b2c198882bbd50870c8e71d18d765' - '82d14e9e6ec47c345d225d9f398238b7254cd5ae581c70e8521b9157ec747890') + '7f90e80be6338f6fc902d257d8ceb09e89b40d008f7a3ad9fe82833cd5b89316') _pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32" # default is 'linux' substitute custom name here