Skip to contentSkip to conversation

Fix lguest oops when guest dies while receiving I/O

PATCH New Rusty Russell 1 participant 3 messages Apr 26, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix lguest oops when guest dies while receiving I/O

lguest needs to hold a reference to its task in case it exits while another Guest is sending it I/O. Otherwise we can oops in access_process_vm->get_task_mm->task_lock().

---
 drivers/lguest/lguest_user.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

===================================================================

drivers/lguest/lguest_user.c +3 -1
@@ -107,7 +107,8 @@ static int initialize(struct file *file,
 	setup_regs(lg->regs, args[2]);
 	setup_guest_gdt(lg);
 	lg->tsk = current;
-	lg->mm = get_task_mm(current);
+	get_task_struct(lg->tsk);
+	lg->mm = get_task_mm(lg->tsk);
 	lg->last_pages = NULL;
 	mutex_unlock(&lguest_lock);
 
@@ -160,6 +161,7 @@ static int close(struct inode *inode, st
 	mutex_lock(&lguest_lock);
 	release_all_dma(lg);
 	free_guest_pagetable(lg);
+	put_task_struct(lg->tsk);
 	mmput(lg->mm);
 	if (!IS_ERR(lg->dead))
 		kfree(lg->dead);
#1 lore raw

PATCH 1/1 Fix lguest documentation error

[ How embarrassing, I got the iptables command wrong! --RR ]

From: James Morris <[email protected]>

Fix up nat example in documentation.

---
 Documentation/lguest/lguest.txt |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

===================================================================

Documentation/lguest/lguest.txt +1 -1
@@ -69,7 +69,7 @@ Running Lguest:
        kernel boot parameters.
 
 - Configuring networking.  I usually have the host masquerade, using
-  "iptables -t nat -o eth0 -j MASQUERADE" and "echo 1 >
+  "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE" and "echo 1 >
   /proc/sys/net/ipv4/ip_forward".  In this example, I would configure
   eth0 inside the guest at 192.168.19.2.
#2 lore raw

PATCH 1/1 Fix lguest documentation error

In reply to Rusty Russell

[ How embarrassing, I got the iptables command wrong! --RR ]

From: James Morris <[email protected]>

Fix up nat example in documentation.

---
 Documentation/lguest/lguest.txt |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

===================================================================

Documentation/lguest/lguest.txt +1 -1
@@ -69,7 +69,7 @@ Running Lguest:
        kernel boot parameters.
 
 - Configuring networking.  I usually have the host masquerade, using
-  "iptables -t nat -o eth0 -j MASQUERADE" and "echo 1 >
+  "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE" and "echo 1 >
   /proc/sys/net/ipv4/ip_forward".  In this example, I would configure
   eth0 inside the guest at 192.168.19.2.