Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 385837 - >=x11-drivers/nvidia-drivers-260 with >= sys-kernel/hardened-sources-3.0.4 - .../work/kernel/nv-procfs.c:710:5: error: assignment of read-only variable 'nv_procfs_registry_fops'
Summary: >=x11-drivers/nvidia-drivers-260 with >= sys-kernel/hardened-sources-3.0.4 - ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Hardened (show other bugs)
Hardware: AMD64 Linux
: Low enhancement (vote)
Assignee: Doug Goldstein (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-06 08:07 UTC by Stefan Reimer
Modified: 2014-10-03 08:12 UTC (History)
7 users (show)

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


Attachments
Additional patch for nvidia-drivers (x11-drivers_nvidia-drivers_files_nvidia-drivers-275.19-pax-const.patch,833 bytes, text/plain)
2011-10-06 08:09 UTC, Stefan Reimer
Details
Patch for the 173.* series (nvidia-drivers-grsecurity.patch,1.66 KB, patch)
2012-08-29 16:53 UTC, Martin Väth
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Reimer 2011-10-06 08:07:51 UTC
/tmp/portage/x11-drivers/nvidia-drivers-275.09.07/work/kernel/nv-procfs.c: In function 'nv_register_procfs':
/tmp/portage/x11-drivers/nvidia-drivers-275.09.07/work/kernel/nv-procfs.c:710:5: error: assignment of read-only variable 'nv_procfs_registry_fops'
/tmp/portage/x11-drivers/nvidia-drivers-275.09.07/work/kernel/nv-procfs.c:711:5: error: assignment of read-only variable 'nv_procfs_registry_fops'


Reproducible: Always




Also see this thread http://forums.grsecurity.net/viewtopic.php?f=3&t=2716&start=30#p11305

Proposed ebuild patch:
   3 @@ -19,7 +19,7 @@
   4  LICENSE="NVIDIA"
   5  SLOT="0"
   6  KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
   7 -IUSE="acpi custom-cflags gtk multilib kernel_linux"
   8 +IUSE="acpi custom-cflags gtk multilib kernel_linux hardened"
   9  RESTRICT="strip"
  10  EMULTILIB_PKG="true"
  11  
  12 @@ -288,6 +288,11 @@
  13                 # If greater than 2.6.5 use M= instead of SUBDIR=
  14                 convert_to_m "${NV_SRC}"/Makefile.kbuild
  15         fi
  16 +
  17 +       if use hardened; then
  18 +           epatch "${FILESDIR}"/nvidia-drivers-275.19-pax-const.patch
  19 +           # epatch "${FILESDIR}"/nvidia-drivers-285.03-pax-usercopy.patch
  20 +       fi
  21  }
  22  
  23  src_compile() {
Comment 1 Stefan Reimer 2011-10-06 08:09:40 UTC
Created attachment 288939 [details]
Additional patch for nvidia-drivers
Comment 2 Anthony Basile gentoo-dev 2011-10-09 20:36:18 UTC
Three points here:

1) We have been supporting nouveau for a while, nvidia + hardened have had problems.

2) This is a fix against the nvidia drivers, not the hardened kernel.  If the x11 team wishes to include it.

3) If they do, they should not use "hardened" use flags since "hardened" refers to hardened tool chain and not hardened kernel.  We've been recommending another use flags "pax_kernel".
Comment 3 Stefan Reimer 2011-10-09 20:46:01 UTC
Hi,
I agree with all three points Anthony mentioned.

I already changed the USE flag to pax_kernel in my overlay.

Will also try to get the usercopy patch working with latest driver.
Comment 4 Chí-Thanh Christopher Nguyễn gentoo-dev 2011-10-10 01:58:14 UTC
x11-drivers/nvidia drivers is not maintained by x11
Comment 5 Michael Palimaka (kensington) gentoo-dev 2011-11-24 08:23:28 UTC
Patch working nicely here against 290.10
Comment 6 Stefan Reimer 2011-11-24 11:39:35 UTC
- I rebased the patch against 290.06.
- version bumped to 290.10 in my overlay
  http://www.startux.de/gitweb/quarks.git

so please test so this patch can be included.

Stefan

--- ../../../../portage/x11-drivers/nvidia-drivers/nvidia-drivers-290.06.ebuild 2011-11-04 11:11:42.000000000 -0700
+++ nvidia-drivers-290.10.ebuild        2011-11-24 03:28:04.027569344 -0800
@@ -19,7 +19,7 @@
 LICENSE="NVIDIA"
 SLOT="0"
 KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
-IUSE="acpi custom-cflags gtk multilib kernel_linux"
+IUSE="acpi custom-cflags gtk multilib kernel_linux pax_kernel"
 RESTRICT="strip"
 EMULTILIB_PKG="true"
 
@@ -288,6 +288,11 @@
                # If greater than 2.6.5 use M= instead of SUBDIR=
                convert_to_m "${NV_SRC}"/Makefile.kbuild
        fi
+
+       if use pax_kernel; then
+           epatch "${FILESDIR}"/nvidia-drivers-pax-const.patch
+           epatch "${FILESDIR}"/nvidia-drivers-pax-usercopy.patch
+       fi
 }
Comment 7 Stefan Reimer 2012-01-27 07:29:47 UTC
I updated the PAX_USERCOPY patches using new versions provided by the Pax team of Grsecurity forum.

These patches allow using the SLUB allocator now too!
Also rebased my overlay against latest upstream 290.10
Comment 8 Michael Palimaka (kensington) gentoo-dev 2012-06-15 11:39:10 UTC
I've been using the attached patch without issue for quite some time. Please consider it for inclusion.
Comment 9 Doug Goldstein (RETIRED) gentoo-dev 2012-06-15 18:56:07 UTC
Use a newer version of nvidia-drivers since the versions you are referencing are no longer in the tree.
Comment 10 Stefan Reimer 2012-06-15 19:11:58 UTC
I still maintain nvidia-drivers incl. these patches in my overlay btw. so you can always check out the latest version:
http://www.startux.de/gitweb/quarks.git/tree/HEAD:/x11-drivers/nvidia-drivers

Ready to be included upstream :)
Comment 11 Doug Goldstein (RETIRED) gentoo-dev 2012-06-15 20:13:35 UTC
ok. Well these ebuilds aren't in the tree. Only newer ones... so these patches won't be going into the tree.
Comment 13 Michael Palimaka (kensington) gentoo-dev 2012-06-16 14:20:14 UTC
I agree, I am using this with 295.59 currently.
Comment 14 Doug Goldstein (RETIRED) gentoo-dev 2012-06-16 19:44:49 UTC
Are we competing for how many times this ticket can be opened?

It's a crap patch. It's a double cast to get ride of a const. It's not going in the tree no matter what version it's against. Fix it right.
Comment 15 Stefan Reimer 2012-06-17 06:25:19 UTC
The "crap" patch is from Brad Spengler the author of Grsecurity himself.
I just picked it up and tried to help out people who want to use the nvidia blob.

I still think a "non perfect" patch is far better than completely unusable, but I rather spent my time somewhere else than arguing about "code quality"... :(
Comment 16 Rick Farina (Zero_Chaos) gentoo-dev 2012-08-07 03:44:02 UTC
We know this is an issue, and are reopening it to start trying to work out issues like this with upstream. Please do not take reopening this bug as an endorsement of any specific fix, but we will be starting with the fix provided in this bug and taking it to nvidia.
Comment 17 Doug Goldstein (RETIRED) gentoo-dev 2012-08-29 03:42:32 UTC
Rejoice and be merry, the patches are carried in the tree for 304.43 and newer.
Comment 18 Michael Palimaka (kensington) gentoo-dev 2012-08-29 14:43:05 UTC
(In reply to comment #17)
> Rejoice and be merry, the patches are carried in the tree for 304.43 and
> newer.

Thank-you very much!
Comment 19 Martin Väth 2012-08-29 16:53:06 UTC
Created attachment 322513 [details, diff]
Patch for the 173.* series

I am very glad that finally the new nvidia drivers work with hardened
kernel without local patches. (nouveau crashes so often that it is not
an option on my machines.)

Since I have one machine which needs the 173 series of drivers
(for which the patch does not work), I use since ages another
patch for this series which I attach now.

It is more agressive than the patch for the newer series, because it just
removes the const attribute globally, but otherwise the patch would
be huge and would probably have to be rewritten for every upgrade
(while the attached patch works since ages for all versions of the
173 series).

It should not be a problem if the patch is applied also with a
non-hardened kernel (although I have not really tested this).
Comment 20 Doug Goldstein (RETIRED) gentoo-dev 2012-08-29 17:42:24 UTC
(In reply to comment #19)
> Created attachment 322513 [details, diff] [details, diff]
> Patch for the 173.* series
> 
> I am very glad that finally the new nvidia drivers work with hardened
> kernel without local patches. (nouveau crashes so often that it is not
> an option on my machines.)
> 
> Since I have one machine which needs the 173 series of drivers
> (for which the patch does not work), I use since ages another
> patch for this series which I attach now.
> 
> It is more agressive than the patch for the newer series, because it just
> removes the const attribute globally, but otherwise the patch would
> be huge and would probably have to be rewritten for every upgrade
> (while the attached patch works since ages for all versions of the
> 173 series).
> 
> It should not be a problem if the patch is applied also with a
> non-hardened kernel (although I have not really tested this).

Please create a new bug.