summary refs log tree commit diff
path: root/pkgs/os-specific
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2010-10-31 19:30:31 +0000
committerLluís Batlle i Rossell <viric@vicerveza.homeunix.net>2010-10-31 19:30:31 +0000
commitf4f84af4abf9fc2cbc8cbe1ace9ed12eb5e7d4b9 (patch)
treeb848c6eeae6f700fffe342fce3c1b3d90321d37e /pkgs/os-specific
parent0eb331fdc98013676bed6382a847248b244ed8c2 (diff)
parenta608761679df2b291dac0d8754d1fd6a94498205 (diff)
Updating from trunk. I only had to take away the usual stdenv2 in
all-packages.nix


svn path=/nixpkgs/branches/stdenv-updates/; revision=24553
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r--pkgs/os-specific/linux/ati-drivers/builder.sh46
-rw-r--r--pkgs/os-specific/linux/ati-drivers/default.nix9
-rw-r--r--pkgs/os-specific/linux/kernel/patches.nix13
-rw-r--r--pkgs/os-specific/linux/kernel/xen-pvclock-resume.patch51
-rw-r--r--pkgs/os-specific/linux/psmisc/default.nix20
5 files changed, 129 insertions, 10 deletions
diff --git a/pkgs/os-specific/linux/ati-drivers/builder.sh b/pkgs/os-specific/linux/ati-drivers/builder.sh
index f830e1e066f80..1fd6234b48e2b 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 65c42e09039a9..db25bebb06c91 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
diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix
index 327b16bd20232..cdaa9da57d933 100644
--- a/pkgs/os-specific/linux/kernel/patches.nix
+++ b/pkgs/os-specific/linux/kernel/patches.nix
@@ -204,20 +204,25 @@ in
     };
 
   guruplug_defconfig =
-    {
-      # Default configuration for the GuruPlug.  From
+    { # Default configuration for the GuruPlug.  From
       # <http://www.openplug.org/plugwiki/images/c/c6/Guruplug-patchset-2.6.33.2.tar.bz2>.
       name = "guruplug-defconfig";
       patch = ./guruplug-defconfig.patch;
     };
 
   guruplug_arch_number =
-    {
-      # Hack to match the `arch_number' of the U-Boot that ships with the
+    { # Hack to match the `arch_number' of the U-Boot that ships with the
       # GuruPlug.  This is only needed when using this specific U-Boot
       # binary.  See
       # <http://www.plugcomputer.org/plugwiki/index.php/Compiling_Linux_Kernel_for_the_Plug_Computer>.
       name = "guruplug-arch-number";
       patch = ./guruplug-mach-type.patch;
     };
+
+  xen_pvclock_resume =
+    { # Fix the clock after a DomU restore following a Dom0 reboot or migration.
+      name = "xen-pvclock-resume";
+      patch = ./xen-pvclock-resume.patch;
+    };
+  
 }
diff --git a/pkgs/os-specific/linux/kernel/xen-pvclock-resume.patch b/pkgs/os-specific/linux/kernel/xen-pvclock-resume.patch
new file mode 100644
index 0000000000000..b92bb74d30b45
--- /dev/null
+++ b/pkgs/os-specific/linux/kernel/xen-pvclock-resume.patch
@@ -0,0 +1,51 @@
+From: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
+Date: Mon, 25 Oct 2010 16:53:46 -0700
+Subject: [PATCH] x86/pvclock: zero last_value on resume
+
+If the guest domain has been suspend/resumed or migrated, then the
+system clock backing the pvclock clocksource may revert to a smaller
+value (ie, can be non-monotonic across the migration/save-restore).
+Make sure we zero last_value in that case so that the domain
+continues to see clock updates.
+
+Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
+
+diff --git a/arch/x86/include/asm/pvclock.h b/arch/x86/include/asm/pvclock.h
+index cd02f32..6226870 100644
+--- a/arch/x86/include/asm/pvclock.h
++++ b/arch/x86/include/asm/pvclock.h
+@@ -11,5 +11,6 @@ unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src);
+ void pvclock_read_wallclock(struct pvclock_wall_clock *wall,
+ 			    struct pvclock_vcpu_time_info *vcpu,
+ 			    struct timespec *ts);
++void pvclock_resume(void);
+ 
+ #endif /* _ASM_X86_PVCLOCK_H */
+diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
+index 239427c..a4f07c1 100644
+--- a/arch/x86/kernel/pvclock.c
++++ b/arch/x86/kernel/pvclock.c
+@@ -120,6 +120,11 @@ unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src)
+ 
+ static atomic64_t last_value = ATOMIC64_INIT(0);
+ 
++void pvclock_resume(void)
++{
++	atomic64_set(&last_value, 0);
++}
++
+ cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src)
+ {
+ 	struct pvclock_shadow_time shadow;
+diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
+index b2bb5aa..5da5e53 100644
+--- a/arch/x86/xen/time.c
++++ b/arch/x86/xen/time.c
+@@ -426,6 +426,8 @@ void xen_timer_resume(void)
+ {
+ 	int cpu;
+ 
++	pvclock_resume();
++
+ 	if (xen_clockevent != &xen_vcpuop_clockevent)
+ 		return;
diff --git a/pkgs/os-specific/linux/psmisc/default.nix b/pkgs/os-specific/linux/psmisc/default.nix
new file mode 100644
index 0000000000000..71ab69b9f2169
--- /dev/null
+++ b/pkgs/os-specific/linux/psmisc/default.nix
@@ -0,0 +1,20 @@
+{stdenv, fetchurl, ncurses}:
+
+assert stdenv.isLinux;
+
+stdenv.mkDerivation rec {
+  name = "psmisc-22.13";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/psmisc/${name}.tar.gz";
+    sha256 = "06d25e8ebb4722dbcede98a787c39a9ed341f8e58fde10c0b2d6b35990b35daa";
+  };
+
+  buildInputs = [ncurses];
+
+  meta = {
+    homepage = http://psmisc.sourceforge.net/;
+    description = "A set of small useful utilities that use the proc filesystem (such as fuser, killall and pstree)";
+    platforms = stdenv.lib.platforms.linux;
+  };
+}