Page 1 of 1

nvidia pax patch reject 367.57

PostPosted: Sat Oct 15, 2016 9:57 am
by alan.d
Hi,

I got the following problem using https://www.grsecurity.net/~paxguy1/nvi ... -pax.patch

Code: Select all
patch -p1 < /tmp/build/grsec-nvidia-201610151158/nvidia-graphics-drivers-367-367.57/debian/pax.patch
patching file kernel/common/inc/nv-linux.h
Hunk #1 succeeded at 1309 (offset 1 line).
patching file kernel/common/inc/nv-modeset-interface.h
patching file kernel/common/inc/nv-register-module.h
patching file kernel/nvidia/nv.c
Hunk #1 succeeded at 658 (offset 4 lines).
patching file kernel/nvidia/nv-chrdev.c
patching file kernel/nvidia/nv-instance.c
patching file kernel/nvidia/nv-mmap.c
Hunk #1 succeeded at 102 (offset -11 lines).
patching file kernel/nvidia/nv-modeset-interface.c
patching file kernel/nvidia-drm/nvidia-drm-drv.c
Hunk #1 succeeded at 596 (offset 4 lines).
Hunk #2 succeeded at 653 (offset 4 lines).
Hunk #3 succeeded at 662 (offset 4 lines).
patching file kernel/nvidia-modeset/nvidia-modeset-linux.c
Hunk #1 succeeded at 322 (offset 5 lines).
Hunk #2 succeeded at 354 (offset 5 lines).
Hunk #3 succeeded at 689 (offset 5 lines).
Hunk #4 succeeded at 704 (offset 5 lines).
patching file kernel/nvidia-uvm/uvm8_global.c
patching file kernel/nvidia-uvm/uvm8_gpu_semaphore.c
patching file kernel/nvidia-uvm/uvm8_hal.h
Hunk #1 succeeded at 316 (offset 6 lines).
patching file kernel/nvidia-uvm/uvm8_mmu.h
patching file kernel/nvidia-uvm/uvm_common.c
Hunk #1 succeeded at 42 (offset -9 lines).
Hunk #2 FAILED at 174.
1 out of 2 hunks FAILED -- saving rejects to file kernel/nvidia-uvm/uvm_common.c.rej
patching file kernel/nvidia-uvm/uvm_full_fault_buffer.h
patching file kernel/nvidia-uvm/uvm_linux.h
Hunk #1 succeeded at 420 (offset -88 lines).


The kernel/nvidia-uvm/uvm_common.c.rej file:

Code: Select all
--- kernel/nvidia-uvm/uvm_common.c   2016-07-12 06:52:17.000000000 +0200
+++ kernel/nvidia-uvm/uvm_common.c   2016-07-16 22:45:59.878812524 +0200
@@ -174,8 +173,10 @@ static NV_STATUS uvmSetupGpuProvider(voi
 {
     NV_STATUS status = NV_OK;
 
-    g_exportedUvmOps.startDevice = uvm_gpu_event_start_device;
-    g_exportedUvmOps.stopDevice  = uvm_gpu_event_stop_device;
+    static struct UvmOpsUvmEvents g_exportedUvmOps = {
+        .startDevice = uvm_gpu_event_start_device,
+        .stopDevice  = uvm_gpu_event_stop_device,
+    };
 
     // call RM to exchange the function pointers.
     status = nvUvmInterfaceRegisterUvmCallbacks(&g_exportedUvmOps);



I compiled the driver ignoring the reject and modprobing failed, I could not get it to work :-(

I would be very happy if you could help me out!

Thanks for the hard work!

Re: nvidia pax patch reject 367.57

PostPosted: Sat Oct 15, 2016 1:12 pm
by jacekalex
If you can, try Nvidia driver 370.28:

Gentoo LInux - kernel 4.7.6-grsec & Nvidia-370.28:
Code: Select all
gcc (Gentoo Hardened 4.9.3 p1.3, pie-0.6.3) 4.9.3


Build log:
Code: Select all
 * Package:    x11-drivers/nvidia-drivers-370.28
 * Repository: lokalny
 * Maintainer: [email protected] [email protected]
 * USE:        X abi_x86_64 acpi amd64 compat driver elibc_glibc gtk3 kernel_linux kms multilib pax_kernel tools userland_GNU uvm wayland
 * FEATURES:   preserve-libs splitdebug
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found sources for kernel version:
 *     4.7.6-gr1
>>> Unpacking NVIDIA-Linux-x86_64-370.28.run to /var/tmp/portage/x11-drivers/nvidia-drivers-370.28/work
>>> Unpacking nvidia-settings-370.28.tar.bz2 to /var/tmp/portage/x11-drivers/nvidia-drivers-370.28/work
 * Applying nvidia-drivers-370.28-profiles-rc.patch ...
 [ ok ]
 * Using PAX patches is not supported. You will be asked to
 * use a standard kernel should you have issues. Should you
 * need support with these patches, contact the PaX team.
 * Applying nvidia-drivers-367.35-pax.patch ...
 [ ok ]
 * Preparing nvidia module
....
{build log}
...
make: Leaving directory '/var/tmp/portage/x11-drivers/nvidia-drivers-370.28/work/nvidia-settings-370.28/src'
 * Installing nvidia module
 * Installing nvidia-uvm module
 * Installing nvidia-modeset module
 * Installing nvidia-drm module
make: Entering directory '/var/tmp/portage/x11-drivers/nvidia-drivers-370.28/work/nvidia-settings-370.28/src'
make[1]: Entering directory '/var/tmp/portage/x11-drivers/nvidia-drivers-370.28/work/nvidia-settings-370.28/src/libXNVCtrl'
make[1]: Nothing to be done for 'default'.
make[1]: Leaving directory '/var/tmp/portage/x11-drivers/nvidia-drivers-370.28/work/nvidia-settings-370.28/src/libXNVCtrl'
mkdir -p /var/tmp/portage/x11-drivers/nvidia-drivers-370.28/image//usr/lib64
install -m 644 _out/Linux_x86_64/libnvidia-gtk2.so \
    /var/tmp/portage/x11-drivers/nvidia-drivers-370.28/image//usr/lib64/libnvidia-gtk2.so.370.28
install -m 644 _out/Linux_x86_64/libnvidia-gtk3.so \
    /var/tmp/portage/x11-drivers/nvidia-drivers-370.28/image//usr/lib64/libnvidia-gtk3.so.370.28
mkdir -p /var/tmp/portage/x11-drivers/nvidia-drivers-370.28/image//usr/bin
install -m 755 _out/Linux_x86_64/nvidia-settings /var/tmp/portage/x11-drivers/nvidia-drivers-370.28/image//usr/bin/nvidia-settings
make: Leaving directory '/var/tmp/portage/x11-drivers/nvidia-drivers-370.28/work/nvidia-settings-370.28/src'
 * Final size of build directory: 400928 KiB
 * Final size of installed tree: 325616 KiB
 * >>> SetUID: [chmod go-r] /opt/bin/nvidia-modprobe ...
 [ ok ]
 * Updating module dependencies for 4.7.6-gr1 ...
 [ ok ]
 * Adding module to moduledb.
Switching to xorg-x11 OpenGL interface... done
Switching to nvidia OpenCL interface... done


Cheers
8)

Re: nvidia pax patch reject 367.57

PostPosted: Mon Oct 17, 2016 6:05 am
by PaX Team
alan.d wrote:The kernel/nvidia-uvm/uvm_common.c.rej file:

Code: Select all
--- kernel/nvidia-uvm/uvm_common.c   2016-07-12 06:52:17.000000000 +0200
+++ kernel/nvidia-uvm/uvm_common.c   2016-07-16 22:45:59.878812524 +0200
@@ -174,8 +173,10 @@ static NV_STATUS uvmSetupGpuProvider(voi
 {
     NV_STATUS status = NV_OK;
 
-    g_exportedUvmOps.startDevice = uvm_gpu_event_start_device;
-    g_exportedUvmOps.stopDevice  = uvm_gpu_event_stop_device;
+    static struct UvmOpsUvmEvents g_exportedUvmOps = {
+        .startDevice = uvm_gpu_event_start_device,
+        .stopDevice  = uvm_gpu_event_stop_device,
+    };
 
     // call RM to exchange the function pointers.
     status = nvUvmInterfaceRegisterUvmCallbacks(&g_exportedUvmOps);
this hunk is no longer needed apparently, so you can just ignore it.
I compiled the driver ignoring the reject and modprobing failed, I could not get it to work :-(
what's the error you get? anything in dmesg?