rpms/kernel/F-10 kvm-make-efer-reads-safe-when-efer-does-not-exist.patch, NONE, 1.1.2.1 linux-2.6-dev-zero-avoid-oom-lockup.patch, NONE, 1.1.2.2 linux-2.6-parport-quickfix-the-proc-registration-bug.patch, NONE, 1.1.2.2 kernel.spec, 1.1206.2.70, 1.1206.2.71

Chuck Ebbert cebbert at fedoraproject.org
Sun Jun 21 21:08:39 UTC 2009


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv16257

Modified Files:
      Tag: private-fedora-10-2_6_27
	kernel.spec 
Added Files:
      Tag: private-fedora-10-2_6_27
	kvm-make-efer-reads-safe-when-efer-does-not-exist.patch 
	linux-2.6-dev-zero-avoid-oom-lockup.patch 
	linux-2.6-parport-quickfix-the-proc-registration-bug.patch 
Log Message:
Copy fixes from latest F-9:
    kvm-make-efer-reads-safe-when-efer-does-not-exist.patch
    linux-2.6-dev-zero-avoid-oom-lockup.patch
    linux-2.6-parport-quickfix-the-proc-registration-bug.patch

kvm-make-efer-reads-safe-when-efer-does-not-exist.patch:

--- NEW FILE kvm-make-efer-reads-safe-when-efer-does-not-exist.patch ---
>From e286e86e6d2042d67d09244aa0e05ffef75c9d54 Mon Sep 17 00:00:00 2001
From: Avi Kivity <avi at redhat.com>
Date: Sun, 3 May 2009 18:50:55 +0300
Subject: KVM: Make EFER reads safe when EFER does not exist

From: Avi Kivity <avi at redhat.com>

commit e286e86e6d2042d67d09244aa0e05ffef75c9d54 upstream.

Some processors don't have EFER; don't oops if userspace wants us to
read EFER when we check NX.

Signed-off-by: Avi Kivity <avi at redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>

---
 arch/x86/kvm/x86.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1075,9 +1075,9 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *
 
 static int is_efer_nx(void)
 {
-	u64 efer;
+	unsigned long long efer = 0;
 
-	rdmsrl(MSR_EFER, efer);
+	rdmsrl_safe(MSR_EFER, &efer);
 	return efer & EFER_NX;
 }
 

linux-2.6-dev-zero-avoid-oom-lockup.patch:

--- NEW FILE linux-2.6-dev-zero-avoid-oom-lockup.patch ---
From: Salman Qazi <sqazi at google.com>
Date: Thu, 4 Jun 2009 22:20:39 +0000 (-0700)
Subject: drivers/char/mem.c: avoid OOM lockup during large reads from /dev/zero
X-Git-Tag: v2.6.30~31
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=730c586ad5228c339949b2eb4e72b80ae167abc4

drivers/char/mem.c: avoid OOM lockup during large reads from /dev/zero

While running 20 parallel instances of dd as follows:

  #!/bin/bash
  for i in `seq 1 20`; do
           dd if=/dev/zero of=/export/hda3/dd_$i bs=1073741824 count=1 &
  done
  wait

on a 16G machine, we noticed that rather than just killing the processes,
the entire kernel went down.  Stracing dd reveals that it first does an
mmap2, which makes 1GB worth of zero page mappings.  Then it performs a
read on those pages from /dev/zero, and finally it performs a write.

The machine died during the reads.  Looking at the code, it was noticed
that /dev/zero's read operation had been changed by
557ed1fa2620dc119adb86b34c614e152a629a80 ("remove ZERO_PAGE") from giving
zero page mappings to actually zeroing the page.

The zeroing of the pages causes physical pages to be allocated to the
process.  But, when the process exhausts all the memory that it can, the
kernel cannot kill it, as it is still in the kernel mode allocating more
memory.  Consequently, the kernel eventually crashes.

To fix this, I propose that when a fatal signal is pending during
/dev/zero read operation, we simply return and let the user process die.

Signed-off-by: Salman Qazi <sqazi at google.com>
Cc: Nick Piggin <nickpiggin at yahoo.com.au>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
[ Modified error return and comment trivially.  - Linus]
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 8f05c38..65e12bc 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -694,6 +694,9 @@ static ssize_t read_zero(struct file * file, char __user * buf,
 		written += chunk - unwritten;
 		if (unwritten)
 			break;
+		/* Consider changing this to just 'signal_pending()' with lots of testing */
+		if (fatal_signal_pending(current))
+			return written ? written : -EINTR;
 		buf += chunk;
 		count -= chunk;
 		cond_resched();

linux-2.6-parport-quickfix-the-proc-registration-bug.patch:

--- NEW FILE linux-2.6-parport-quickfix-the-proc-registration-bug.patch ---
From: Alan Cox <alan at etchedpixels.co.uk>
Date: Tue, 2 Jun 2009 15:58:10 +0000 (+0100)
Subject: parport: quickfix the proc registration bug
X-Git-Tag: v2.6.30-rc8~2
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=05ad709d04799125ed85dd816fdb558258102172

parport: quickfix the proc registration bug

Ideally we should have a directory of drivers and a link to the 'active'
driver. For now just show the first device which is effectively the existing
semantics without a warning.

This is an update on the original buggy patch that I then forgot to
resubmit. Confusingly it was proposed by Red Hat, written by Etched Pixels
fixed and submitted by Intel ...

Resolves-Bug: http://bugzilla.kernel.org/show_bug.cgi?id=9749
Signed-off-by: Alan Cox <alan at linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 0ebca45..dffa5d4 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -614,7 +614,10 @@ parport_register_device(struct parport *port, const char *name,
 	 * pardevice fields. -arca
 	 */
 	port->ops->init_state(tmp, tmp->state);
-	parport_device_proc_register(tmp);
+	if (!test_and_set_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags)) {
+		port->proc_device = tmp;
+		parport_device_proc_register(tmp);
+	}
 	return tmp;
 
  out_free_all:
@@ -646,10 +649,14 @@ void parport_unregister_device(struct pardevice *dev)
 	}
 #endif
 
-	parport_device_proc_unregister(dev);
-
 	port = dev->port->physport;
 
+	if (port->proc_device == dev) {
+		port->proc_device = NULL;
+		clear_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags);
+		parport_device_proc_unregister(dev);
+	}
+
 	if (port->cad == dev) {
 		printk(KERN_DEBUG "%s: %s forgot to release port\n",
 		       port->name, dev->name);
diff --git a/include/linux/parport.h b/include/linux/parport.h
index e1f83c5..38a423e 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -324,6 +324,10 @@ struct parport {
 	int spintime;
 	atomic_t ref_count;
 
+	unsigned long devflags;
+#define PARPORT_DEVPROC_REGISTERED	0
+	struct pardevice *proc_device;	/* Currently register proc device */
+
 	struct list_head full_list;
 	struct parport *slaves[3];
 };


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-10/kernel.spec,v
retrieving revision 1.1206.2.70
retrieving revision 1.1206.2.71
diff -u -p -r1.1206.2.70 -r1.1206.2.71
--- kernel.spec	20 Jun 2009 12:13:12 -0000	1.1206.2.70
+++ kernel.spec	21 Jun 2009 21:08:36 -0000	1.1206.2.71
@@ -777,6 +777,10 @@ Patch3130: disable-p4-cpufreq-ui.patch
 Patch3140: linux-2.6.27-fix-video_open.patch
 
 Patch4000: kvm-vmx-don-t-allow-uninhibited-access-to-efer-on-i386.patch
+Patch4010: kvm-make-efer-reads-safe-when-efer-does-not-exist.patch
+
+Patch11000: linux-2.6-parport-quickfix-the-proc-registration-bug.patch
+Patch11010: linux-2.6-dev-zero-avoid-oom-lockup.patch
 
 %endif
 
@@ -1407,7 +1411,12 @@ ApplyPatch disable-p4-cpufreq-ui.patch
 ApplyPatch linux-2.6.27-fix-video_open.patch
 
 ApplyPatch kvm-vmx-don-t-allow-uninhibited-access-to-efer-on-i386.patch
+ApplyPatch kvm-make-efer-reads-safe-when-efer-does-not-exist.patch
+
+# finally fix the proc registration bug (F11#503773 and others)
+ApplyPatch linux-2.6-parport-quickfix-the-proc-registration-bug.patch
 
+ApplyPatch linux-2.6-dev-zero-avoid-oom-lockup.patch
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -1983,6 +1992,12 @@ fi
 %kernel_variant_files -k vmlinux %{with_kdump} kdump
 
 %changelog
+* Sat Jun 20 2009  Chuck Ebbert <cebbert at redhat.com>  2.6.27.25-170.2.71
+- Copy fixes from latest F-9:
+    kvm-make-efer-reads-safe-when-efer-does-not-exist.patch
+    linux-2.6-dev-zero-avoid-oom-lockup.patch
+    linux-2.6-parport-quickfix-the-proc-registration-bug.patch
+
 * Sat Jun 20 2009  Chuck Ebbert <cebbert at redhat.com>  2.6.27.25-170.2.70
 - Update r8169 network driver to the version in Fedora 9:
   the 2.6.30 version + fixes from 2.6.31




More information about the fedora-extras-commits mailing list