# [using nouveau = success FIX]nVidia + grsec = invalid module

## judepereira

Yes, I know that nvidia is an issue with grsec and pax, but I want to try it out myself.

I've compiled the latest version of nvidia-drivers, and done a reboot, yet it fails. modprobe nvidia returns this:

```
# modprobe nvidia

FATAL: Error inserting nvidia (/lib/modules/2.6.37-hardened-r7/video/nvidia.ko): Invalid module format

```

Further strace insmod to nvidia module says:

```
# strace insmod /lib/modules/2.6.37-hardened-r7/video/nvidia.ko

execve("/sbin/insmod", ["insmod", "/lib/modules/2.6.37-hardened-r7/"...], [/* 22 vars */]) = 0

brk(0)                                  = 0x3a7fae20a0

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ceae5b5000

access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)

open("/etc/ld.so.cache", O_RDONLY)      = 3

fstat(3, {st_mode=S_IFREG|0644, st_size=147958, ...}) = 0

mmap(NULL, 147958, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2ceae590000

close(3)                                = 0

open("/lib64/libc.so.6", O_RDONLY)      = 3

read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\355\1\0\0\0\0\0"..., 832) = 832

fstat(3, {st_mode=S_IFREG|0755, st_size=1403944, ...}) = 0

mmap(NULL, 3513128, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x2ceae040000

mprotect(0x2ceae190000, 2097152, PROT_NONE) = 0

mmap(0x2ceae390000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x150000) = 0x2ceae390000

mmap(0x2ceae395000, 19240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x2ceae395000

close(3)                                = 0

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ceae58f000

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ceae58e000

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ceae58d000

arch_prctl(ARCH_SET_FS, 0x2ceae58e700)  = 0

mprotect(0x2ceae390000, 16384, PROT_READ) = 0

mprotect(0x3a7fad5000, 4096, PROT_READ) = 0

mprotect(0x2ceae5b7000, 4096, PROT_READ) = 0

munmap(0x2ceae590000, 147958)           = 0

brk(0)                                  = 0x3a7fae20a0

brk(0x3a7fb030a0)                       = 0x3a7fb030a0

brk(0x3a7fb04000)                       = 0x3a7fb04000

create_module(NULL, 0)                  = -1 ENOSYS (Function not implemented)

open("/lib/modules/2.6.37-hardened-r7/video/nvidia.ko", O_RDONLY) = 3

read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\1\0>\0\1\0\0\0\0\0\0\0\0\0\0\0"..., 16384) = 16384

read(3, "\213u$H\215}\10\350\0\0\0\0\211\303\205\300uc\213U$H\213}\10\276\0\0\0\0\350\0"..., 16384) = 16384

read(3, "\350\0\0\0\0\211\302\205\300uH\213u\4H\213{hE\211\360D\211\351D\211\342\350\0\0\0\0"..., 32768) = 32768

read(3, "\276\0\0\0\360H\307EP\0\0\0\0H\307E8\0\0\0\0H\307E0\0\0\0\0H\307E"..., 65536) = 65536

mmap(NULL, 266240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2ceae54c000

brk(0x3a7fb03000)                       = 0x3a7fb03000

read(3, "u\n\272\377\377\377\377\351\231\0\0\0\276\354\0\0\0H\211\307\350\0\0\0\0A\211\306\301\350\20\17"..., 131072) = 131072

mremap(0x2ceae54c000, 266240, 528384, MREMAP_MAYMOVE) = 0x2ceae4cb000

read(3, "\0A\211\304\211\302\205\300\17\205q\2\0\0\213E,\211EpD\211}x\213U(\211Ut\307E"..., 262144) = 262144

mremap(0x2ceae4cb000, 528384, 1052672, MREMAP_MAYMOVE) = 0x2ceae3ca000

read(3, "\377P\20L\211\346H\211\337\350\362\375\377\377H\203\304\10[A\\\303H\203\354\10D\213\26A\201\372"..., 524288) = 524288

mremap(0x2ceae3ca000, 1052672, 2101248, MREMAP_MAYMOVE) = 0x2ceade3f000

read(3, "\323\4\0\0\307E8\377\377\377\377\351\307\4\0\0D\211\362H\215\4\325\0\0\0\0H)\320H\213"..., 1048576) = 1048576

mremap(0x2ceade3f000, 2101248, 4198400, MREMAP_MAYMOVE) = 0x2ceada3e000

read(3, "\0\0\0w\266\276\0\0\0\0A\203\275\20\1\0\0\0vYA\215F\24\211\307\203\347\37A\270\1"..., 2097152) = 2097152

mremap(0x2ceada3e000, 4198400, 8392704, MREMAP_MAYMOVE) = 0x2cead23d000

read(3, "f\203x\16\1A\17\225\204$S\1\0\0\271\0\0\0\0D\211\352L\211\346H\211\337\350\254\4\0"..., 4194304) = 4194304

mremap(0x2cead23d000, 8392704, 16781312, MREMAP_MAYMOVE) = 0x2ceac23c000

read(3, "\345\t\0\0\0\0\0\0\346\t\0\0\0\0\0\0\347\t\0\0\0\0\0\0\350\t\0\0\0\0\0\0"..., 8388608) = 5176622

read(3, "", 3211986)                    = 0

close(3)                                = 0

init_module(0x2ceac23c010, 13565230, "") = -1 ENOEXEC (Exec format error)

write(2, "insmod: error inserting '/lib/mo"..., 100insmod: error inserting '/lib/modules/2.6.37-hardened-r7/video/nvidia.ko': -1 Invalid module format

) = 100

exit_group(1)                           = ?

```

What I have tried:

made sure that the gcc versions are same for both kernel and nvidia-drivers 

ran the same kernel when compiling the nvidia-drivers

different versions, 270.41.03 and 260.19.36

Anyone any ideas?

----------

## Jacekalex

Hi

In my Gentoo grsec & nvidia working fine  :Smile: 

Architecture: x86 Intel Core 2, Nvidia GF8600GT

My kernel config: http://pastebin.com/SmZYAYTw

Vanilla-sources 2.6.37+grsec-patch+tuxonice+others patch.

Nvidia driver: 270.41.06 (from Nvidia Website).

My Gentoo version: http://forum.dug.net.pl/viewtopic.php?pid=167719#p167719

```
gcc version 4.5.1 (Gentoo Hardened 4.5.1-r1 p1.4, pie-0.4.5)
```

```
 glxinfo | grep string

server glx vendor string: NVIDIA Corporation

server glx version string: 1.4

client glx vendor string: NVIDIA Corporation

client glx version string: 1.4

OpenGL vendor string: NVIDIA Corporation

OpenGL renderer string: GeForce 8600 GT/PCI/SSE2

OpenGL version string: 3.3.0 NVIDIA 270.41.06

OpenGL shading language version string: 3.30 NVIDIA via Cg compiler
```

modinfo & vdpauinfo: http://pastebin.com/b1qApAiB

Yours

 :Cool: 

----------

## judepereira

Ah, never mind that, I got nouveau + grsec + compiz working perfectly well, also splash, with the nvidia drivers, I'd have to disable PaX support for apps using libGLcore.so , making my system a little vulnerable. Give nouveau a shot.

----------

## Jacekalex

Do hawe Nouveau support for vaapi?

```
vainfo

libva: libva version 0.32.0-sds2

Xlib:  extension "XFree86-DRI" missing on display ":0.0".

libva: va_getDriverName() returns 0

libva: Trying to open /usr/lib/va/drivers/nvidia_drv_video.so

libva: va_openDriver() returns 0

vainfo: VA API version: 0.32

vainfo: Driver version: Splitted-Desktop Systems VDPAU backend for VA-API - 0.7.3

vainfo: Supported profile and entrypoints

      VAProfileMPEG2Simple            :   VAEntrypointVLD

      VAProfileMPEG2Main              :   VAEntrypointVLD

      VAProfileH264Main               :   VAEntrypointVLD

      VAProfileH264High               :   VAEntrypointVLD

      VAProfileVC1Simple              :   VAEntrypointVLD

      VAProfileVC1Main                :   VAEntrypointVLD

      VAProfileVC1Advanced            :   VAEntrypointVLD

```

Useful for mplayer and vlc.

My native language is Polish, sorry for bad English.

----------

## judepereira

VLC is fine for me, HD Video plays very well, you should try out nouveau, its still not as good as nvidia-drivers, but good enough for daily use.

----------

