fix race condition in signal in kernel posix driver
authorFilippos Giannakos <philipgian@grnet.gr>
Wed, 26 Sep 2012 16:22:24 +0000 (19:22 +0300)
committerFilippos Giannakos <philipgian@grnet.gr>
Wed, 26 Sep 2012 16:22:24 +0000 (19:22 +0300)
xseg/drivers/kernel/xseg_posix.c

index 9766ecb..e35dd89 100644 (file)
@@ -74,12 +74,13 @@ static int posix_signal(struct xseg *xseg, uint32_t portno)
 
        rcu_read_lock();
        /* XXX Security: xseg peers can kill anyone */
-       if (!port->waitcue) {
+       pid_t p = *(volatile unsigned uint64_t *)&port->waitcue;
+       if (!p) {
                ret = 0;
                goto out;
        }
 
-       pid = find_vpid((pid_t)port->waitcue);
+       pid = find_vpid((p);
        if (!pid)
                goto out;
        task = pid_task(pid, PIDTYPE_PID);