Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 490232 - x11-drivers/nvidia-drivers-331.17 USE=pax_kernel - new patch
Summary: x11-drivers/nvidia-drivers-331.17 USE=pax_kernel - new patch
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Hardened (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2013-11-03 08:42 UTC by Martin Väth
Modified: 2014-10-17 17:49 UTC (History)
5 users (show)

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


Attachments
new pax-const.patch, *not* obsoleting nvidia-drivers331.13-pax-usercopy.patch) (nvidia-drivers-331.17-pax-const.patch,2.61 KB, patch)
2013-11-03 08:42 UTC, Martin Väth
Details | Diff
Trivial patch for the nvidia-drivers-331.17.ebuild to include both patches correctly (nvidia-drivers-331.17.ebuild.patch,524 bytes, patch)
2013-11-03 08:43 UTC, Martin Väth
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Väth 2013-11-03 08:42:14 UTC
Created attachment 362468 [details, diff]
new pax-const.patch, *not* obsoleting nvidia-drivers331.13-pax-usercopy.patch)

The newest nvidia-drivers-331.17 does not emerge when USE=pax_kernel is set.

There are two reasons for this:

(1) A trivial reason is that the patchname ${P}-pax-usercopy.patch is used instead of ${PN}-331.13-pax-usercopy.patch.

(2) However, even with (1) being fixed, nvidia-drivers-331.17 does not emerge when the kernel sources are from a hardened kernel (with compiler plugins enabled), because the new driver initializes similarly to earlier nvidia drivers: It is necessary to use a patch similar to nvidia-drivers-pax-const.patch (in addition to the pax-usercopy patch).

I attach a patch nvidia-drivers-331.17-pax-const.patch for the second issue, and a trivial patch nvidia-drivers-331.17.ebuild.patch for the ebuild which fixes (1) and additionally (2). (The latter patch uses the name ${PN}-331.17-pax-const.patch to refer to the patch so that a problem like (1) does not occur again with the next bump of nvidia-drivers.)
Comment 1 Martin Väth 2013-11-03 08:43:16 UTC
Created attachment 362470 [details, diff]
Trivial patch for the nvidia-drivers-331.17.ebuild to include both patches correctly
Comment 2 Martin Väth 2013-11-03 10:14:00 UTC
I forgot to mention that I tested the patches with amd64 and x86.
Comment 3 Martin Väth 2013-11-07 21:57:46 UTC
x11-drivers/nvidia-drivers-331.20 has the same issue(s), and the same patches work (tested on x86 and amd65).
Comment 4 Stefan Reimer 2013-11-08 04:43:52 UTC
Martin's patches work like charm +1

FYI: wrapped up in http://www.startux.de/gitweb/quarks.git/commit/2abec1f330d5504cb4eb5eb45b6fd70b52a0a369
Comment 5 Alex Efros 2013-11-23 01:02:38 UTC
x11-drivers/nvidia-drivers-331.20 compiles without these patches (strange, previous versions usually fail to compile without them), kernel module loads without errors, but it hang console (black screen, dead keyboard/mouse - sysrq doesn't work) when Xorg start (Xorg.0.log is empty after reboot).

With these two patches (one copied from /usr/portage/x11-drivers/nvidia-drivers/files/, second is from attach to this issue):
  # ls -1 /etc/portage/patches/x11-drivers/nvidia-drivers/
  nvidia-drivers-331.13-pax-usercopy.patch
  nvidia-drivers-331.17-pax-const.patch
Xorg start and works ok.
Comment 6 PaX Team 2013-11-26 21:21:11 UTC
as explained in https://bugs.gentoo.org/show_bug.cgi?id=482784#c8 this patch is incomplete and i suggest that you use my patch instead.
Comment 7 Martin Väth 2013-11-27 08:35:16 UTC
(In reply to PaX Team from comment #6)
> i suggest that you use my patch instead.

I agree with the no_const attribute, especially because nobody knows
what happens in the binary part of the driver.
However, I am surprised that you make now such a suggestion,
because the "historical" patch (I guess also suggested by you)
followed a different road and, moreover, you complained when I used
the no_const attribute approach for the (also partially binary)
martian-modem driver.
Comment 8 PaX Team 2013-11-27 12:16:34 UTC
if you look at the code handling struct UvmGpuProvider you'll see that it's not at all clear that the open source wrapper has all its instances and management code because nvUvmInterfaceRegisterUvmOps is exported and the address of g_nvKernelProvider 'escapes' to the outside world. as UvmGpuProvider is not one of the kernel's own ops structures (unlike file_operations previously) we can't really assume what happens to it inside the binary parts.

also for proper constification of g_nvKernelProvider you should move the runtime initializers into a compile time initializer and then also not bother with clearing it in nvUvmInterfaceDeRegisterUvmOps. but that again raises the possibility of changing some deeper logic we know nothing about.

last but not least, UvmGpuProviderTracking would also need constification then since it too contains function pointers in addition to a pointer to struct UvmGpuProvider (again at the risk of upsetting some logic that does rely on this clearing).

so all in all, not touching these ops structures is the safer (and much cheaper to maintain) way i think for now. if/when nvidia changes this code we can get automatic constification.
Comment 9 Anthony Basile gentoo-dev 2014-10-17 17:49:13 UTC
Looks like this patch didn't go anywhere.  Reopen if there's more owrk on it.