From 3748bba1268f7fa2f518e4ba452dd868bc17d5ad Mon Sep 17 00:00:00 2001 From: Evgeny Egorochkin Date: Tue, 26 Oct 2010 00:35:38 +0000 Subject: [PATCH] =?UTF-8?q?ati-drivers:=20version=20bump=20and=20fix=20nam?= =?UTF-8?q?e/version.=20Patch=20by=20Cillian=20de=20R=C3=B3iste.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/nixpkgs/trunk/; revision=24479 --- pkgs/os-specific/linux/ati-drivers/builder.sh | 46 ++++++++++++++++++- .../os-specific/linux/ati-drivers/default.nix | 9 ++-- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/pkgs/os-specific/linux/ati-drivers/builder.sh b/pkgs/os-specific/linux/ati-drivers/builder.sh index f830e1e066f..1fd6234b48e 100644 --- a/pkgs/os-specific/linux/ati-drivers/builder.sh +++ b/pkgs/os-specific/linux/ati-drivers/builder.sh @@ -13,6 +13,7 @@ sh archive --extract . kernelVersion=$(cd ${kernel}/lib/modules && ls) kernelBuild=$(echo ${kernel}/lib/modules/$kernelVersion/build) +linuxsources=$(echo ${kernel}/lib/modules/$kernelVersion/source) # note: maybe the .config file should be used to determine this ? @@ -28,7 +29,15 @@ setSMP(){ # 3 # linux/autoconf.h may contain this: #define CONFIG_SMP 1 - src_file=$linuxincludes/linux/autoconf.h + # Before 2.6.33 autoconf.h is under linux/. + # For 2.6.33 and later autoconf.h is under generated/. + if [ -f $linuxincludes/generated/autoconf.h ]; then + autoconf_h=$linuxincludes/generated/autoconf.h + else + autoconf_h=$linuxincludes/linux/autoconf.h + fi + src_file=$autoconf_h + [ -e $src_file ] || die "$src_file not found" if [ `cat $src_file | grep "#undef" | grep "CONFIG_SMP" -c` = 0 ]; then @@ -54,6 +63,39 @@ setModVersions(){ # make.sh contains much more code to determine this whether its enabled } +# ============================================================== +# resolve if we are building for a kernel with a fix for CVE-2010-3081 +# On kernels with the fix, use arch_compat_alloc_user_space instead +# of compat_alloc_user_space since the latter is GPL-only + +COMPAT_ALLOC_USER_SPACE=compat_alloc_user_space + +for src_file in \ + $kernelBuild/arch/x86/include/asm/compat.h \ + $linuxsources/arch/x86/include/asm/compat.h \ + $kernelBuild/include/asm-x86_64/compat.h \ + $linuxsources/include/asm-x86_64/compat.h \ + $kernelBuild/include/asm/compat.h; +do + if [ -e $src_file ]; + then + break + fi +done +if [ ! -e $src_file ]; +then + echo "Warning: x86 compat.h not found in kernel headers" + echo "neither arch/x86/include/asm/compat.h nor include/asm-x86_64/compat.h" + echo "could be found in $kernelBuild or $linuxsources" + echo "" +else + if [ `cat $src_file | grep -c arch_compat_alloc_user_space` -gt 0 ] + then + COMPAT_ALLOC_USER_SPACE=arch_compat_alloc_user_space + fi + echo "file $src_file says: COMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE" +fi + # make.sh contains some code figuring out whether to use these or not.. PAGE_ATTR_FIX=0 @@ -83,7 +125,7 @@ GCC_MAJOR="`gcc --version | grep -o -e ") ." | head -1 | cut -d " " -f 2`" make CC=${CC} \ LIBIP_PREFIX=$(echo "$LIBIP_PREFIX" | sed -e 's|^\([^/]\)|../\1|') \ - MODFLAGS="-DMODULE -DATI -DFGL -DPAGE_ATTR_FIX=$PAGE_ATTR_FIX $def_smp $def_modversions" \ + MODFLAGS="-DMODULE -DATI -DFGL -DPAGE_ATTR_FIX=$PAGE_ATTR_FIX -DCOMPAT_ALLOC_USER_SPACE=$COMPAT_ALLOC_USER_SPACE $def_smp $def_modversions" \ KVER=$kernelVersion \ KDIR=$kernelBuild \ PAGE_ATTR_FIX=$PAGE_ATTR_FIX \ diff --git a/pkgs/os-specific/linux/ati-drivers/default.nix b/pkgs/os-specific/linux/ati-drivers/default.nix index 65c42e09039..db25bebb06c 100644 --- a/pkgs/os-specific/linux/ati-drivers/default.nix +++ b/pkgs/os-specific/linux/ati-drivers/default.nix @@ -19,8 +19,9 @@ let lib = stdenv.lib; in # http://wiki.cchtml.com/index.php/Main_Page -stdenv.mkDerivation { - name = "ati-drivers"; +stdenv.mkDerivation rec { + name = "ati-drivers-${version}"; + version = "10-10-x86"; builder = ./builder.sh; @@ -29,8 +30,8 @@ stdenv.mkDerivation { src = assert stdenv.system == "x86_64-linux"; fetchurl { - url = https://a248.e.akamai.net/f/674/9206/0/www2.ati.com/drivers/linux/ati-driver-installer-10-4-x86.x86_64.run; - sha256 = "1rlqbfv729lray1c72ga4528kj7v4a5nmdznbgx7izwaxip2a45z"; + url = https://a248.e.akamai.net/f/674/9206/0/www2.ati.com/drivers/linux/ati-driver-installer-10-10-x86.x86_64.run; + sha256 = "1g71sj8qbarshw3hfds2v6y9q7lma3d36d0x79c7vvgllcd5c76x"; }; buildInputs = [xlibs.libXext xlibs.libX11