Fix read after xfree in linux-nat.c:linux_nat_detach
authorPhilipp Rudo <prudo@linux.vnet.ibm.com>
Tue, 11 Apr 2017 13:28:51 +0000 (14:28 +0100)
committerPedro Alves <palves@redhat.com>
Tue, 11 Apr 2017 13:28:51 +0000 (14:28 +0100)
At the end of linux_nat_detach the main_lwp is deleted (delete_lwp).
This is problematic as during detach (detach_one_lwp and
linux_fork_detach) main_lwp already gets freed.  Thus calling
delete_lwp causes a read after free.  Fix it by removing the
unnecessary delete_lwp.

gdb/ChangeLog:
2017-04-11  Philipp Rudo  <prudo@linux.vnet.ibm.com>

* linux-nat.c (linux_nat_detach): Remove delete_lwp call.

gdb/ChangeLog
gdb/linux-nat.c

index dc3393a27f6af6f0020b4ad590ef708788eca00b..60e03e76198c029e164c0e4f5b5f288291fd7afd 100644 (file)
@@ -1,3 +1,7 @@
+2017-04-11  Philipp Rudo  <prudo@linux.vnet.ibm.com>
+
+       * linux-nat.c (linux_nat_detach): Remove delete_lwp call.
+
 2017-04-11  Alan Hayward  <alan.hayward@arm.com>
 
        * arm-tdep.c (arm_store_return_value): Use FP_REGISTER_SIZE
index b06e400fdc21d63d055dec3bf2378970ca70b2bd..8dececf2c52d206867c26cb08af4ee356bb3d593 100644 (file)
@@ -1549,7 +1549,6 @@ linux_nat_detach (struct target_ops *ops, const char *args, int from_tty)
 
       inf_ptrace_detach_success (ops);
     }
-  delete_lwp (main_lwp->ptid);
 }
 
 /* Resume execution of the inferior process.  If STEP is nonzero,
This page took 0.029037 seconds and 4 git commands to generate.