Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 15 Nov 2014 16:45:11 +0000 (UTC)
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r372606 - head/x11/nvidia-driver
Message-ID:  <201411151645.sAFGjBau008941@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: danfe
Date: Sat Nov 15 16:45:10 2014
New Revision: 372606
URL: https://svnweb.freebsd.org/changeset/ports/372606
QAT: https://qat.redports.org/buildarchive/r372606/

Log:
  - Stop trying to adopt cap_rights_t type change in FreeBSD src SVN r255219
    as recent driver versions are already account for it; this unbreaks the
    build for 304.xx branch [*]
  - Simplify patching for stack buffer overflow in nvidia_sysctl_bus_type():
    NVidia really screwed up fixing it since it was reported.  Originally,
    they were sprintf(bus_type, "PCI-E")ing to a 4-character buffer allocated
    on stack (304.88 and earlier); later they've replaced the buffer with a
    char * pointer, but left one sprintf() into it (304.108 and above, up to
    304.121); then finally fixed it for real in 304.123.  Given versions are
    only for 304.xx branch; others retained the same bugs during this time
    frame.  Fix it across the gang by simply extending bus_type[4] (if found)
    to eight bytes instead of employing complex NVVERSION checks: this should
    now be no-op for newer versions, but good enough for older ones (e.g. for
    173.14.35, 96.xx, and 71.xx)
  
  PR:	194866, 194958 [*]

Modified:
  head/x11/nvidia-driver/Makefile

Modified: head/x11/nvidia-driver/Makefile
==============================================================================
--- head/x11/nvidia-driver/Makefile	Sat Nov 15 16:26:32 2014	(r372605)
+++ head/x11/nvidia-driver/Makefile	Sat Nov 15 16:45:10 2014	(r372606)
@@ -180,12 +180,6 @@ post-patch: .SILENT
 	${REINPLACE_CMD} -e '/kmem_/s/kernel_map/kernel_arena/' \
 		${WRKSRC}/src/nvidia_subr.c
 .endif
-# Adopt to cap_rights_t type change in FreeBSD src SVN r255219
-.if ${OSVERSION} > 1000052 && ${NVVERSION} < 331.067
-	${REINPLACE_CMD} -e 's/u_long cmd;/& cap_rights_t rights;/ ; \
-		s/CAP_IOCTL/cap_rights_init(\&rights, &)/' \
-			${WRKSRC}/src/nvidia_linux.c
-.endif
 # Argument count of vm_map_find() changed in FreeBSD src SVN r255426
 .if ${OSVERSION} > 1000054 && ${NVVERSION} < 304.123 # < 331.067
 	${REINPLACE_CMD} -e 's/virtual_address, size,/& 0,/' \
@@ -198,12 +192,8 @@ post-patch: .SILENT
 			${WRKSRC}/src/nvidia_sysctl.c
 .endif
 # Fix stack buffer overflow in nvidia_sysctl_bus_type()
-.if ${NVVERSION} < 304.123 # < 319.023
-	${REINPLACE_CMD} -E '/bus_type\[4\]/d ; \
-		s/sprintf\(bus_type, (".+")/return SYSCTL_OUT(req, \1, sizeof(\1)/ ; \
-		/return SYSCTL_OUT\(req, bus_type/d' \
-			${WRKSRC}/src/nvidia_sysctl.c
-.endif
+	${REINPLACE_CMD} -e 's/8 bus_type\[4\]/8 bus_type[8]/' \
+		${WRKSRC}/src/nvidia_sysctl.c
 # Unbreak the build of 173.14.xx legacy series on recent -CURRENT
 .if ${NVVERSION} < 195.022 && ${NVVERSION} >= 169.004
 	${REINPLACE_CMD} -E 's/os_(alloc|free)_contig_pages/NV_API_CALL &/' \



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411151645.sAFGjBau008941>