[libvirt] [PATCH 1/4] lxc: validate tty pid before kill()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch adds a check of the tty forwarding process pid before kill()'ing it
when destroying a domain.  If the pid value stored in the the vm structure is
invalid, sending a SIGKILL may be very bad if the value in question is something
like -1 (which just happens to be it's initial value).

-- 
Best Regards,
Dave Leskovec
IBM Linux Technology Center
Open Virtualization

---
 src/lxc_driver.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: b/src/lxc_driver.c
===================================================================
--- a/src/lxc_driver.c	2008-05-12 23:30:58.000000000 -0700
+++ b/src/lxc_driver.c	2008-05-29 14:34:27.000000000 -0700
@@ -958,6 +958,11 @@
     }
 
 kill_tty:
+    if (2 > vm->pid) {
+        DEBUG("not killing tty process with pid %d", vm->pid);
+        goto tty_error_out;
+    }
+
     if (0 > (kill(vm->pid, SIGKILL))) {
         if (ESRCH != errno) {
             lxcError(NULL, NULL, VIR_ERR_INTERNAL_ERROR,

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]