Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: [patch] ASAN attach crash - 7.9 regression  [Re: [PATCH 4/4] PR gdb/17471: Repeating a background command makes it foreground]
Date: Mon, 03 Aug 2015 21:02:00 -0000	[thread overview]
Message-ID: <20150803210205.GA2019@host1.jankratochvil.net> (raw)
In-Reply-To: <1412877629-12052-5-git-send-email-palves@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 806 bytes --]

On Thu, 09 Oct 2014 20:00:29 +0200, Pedro Alves wrote:
> Tested on x86_64 Fedora 20, native and gdbserver.

-fsanitize=address
gdb.base/attach-pie-noexec.exp

==32586==ERROR: AddressSanitizer: heap-use-after-free on address 0x60200004ed90 at pc 0x48ad50 bp 0x7ffceb3aef50 sp 0x7ffceb3aef20
READ of size 2 at 0x60200004ed90 thread T0
    #0 0x48ad4f in __interceptor_strlen (/home/jkratoch/redhat/gdb-test-asan/gdb/gdb+0x48ad4f)
    #1 0xeafe5c in xstrdup xstrdup.c:33
    #2 0x85e024 in attach_command /home/jkratoch/redhat/gdb-test-asan/gdb/infcmd.c:2680

regressed by:

commit 6c4486e63f7583ed85a0c72841f6ccceebbf858e
Author: Pedro Alves <palves@redhat.com>
Date:   Fri Oct 17 13:31:26 2014 +0100
    PR gdb/17471: Repeating a background command makes it foreground


OK for check-in and for 7.10?


Jan

[-- Attachment #2: 1 --]
[-- Type: text/plain, Size: 1042 bytes --]

2015-08-03  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR gdb/18767
	* infcmd.c (attach_command): Move ARGS_CHAIN cleanup after last ARGS
	use.

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 4948d27..5cd8dd7 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -2617,9 +2617,6 @@ attach_command (char *args, int from_tty)
      shouldn't refer to attach_target again.  */
   attach_target = NULL;
 
-  /* Done with ARGS.  */
-  do_cleanups (args_chain);
-
   /* Set up the "saved terminal modes" of the inferior
      based on what modes we are starting it with.  */
   target_terminal_init ();
@@ -2684,12 +2681,19 @@ attach_command (char *args, int from_tty)
 	  a->async_exec = async_exec;
 	  add_inferior_continuation (attach_command_continuation, a,
 				     attach_command_continuation_free_args);
+
+	  /* Done with ARGS.  */
+	  do_cleanups (args_chain);
+
 	  return;
 	}
 
       wait_for_inferior ();
     }
 
+  /* Done with ARGS.  */
+  do_cleanups (args_chain);
+
   attach_command_post_wait (args, from_tty, async_exec);
 }
 

  reply	other threads:[~2015-08-03 21:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-09 18:00 [PATCH 0/4] Fix a set of terminal/readline handling bugs/crashes Pedro Alves
2014-10-09 18:00 ` [PATCH 3/4] PR gdb/17300: Input after "c -a" crashes readline/GDB Pedro Alves
2014-10-09 18:00 ` [PATCH 1/4] Make common code handle target_terminal_* idempotency Pedro Alves
2014-10-09 18:00 ` [PATCH 2/4] PR gdb/17472: With annotations, input while executing in the foreground crashes readline/GDB Pedro Alves
2014-10-09 18:00 ` [PATCH 4/4] PR gdb/17471: Repeating a background command makes it foreground Pedro Alves
2015-08-03 21:02   ` Jan Kratochvil [this message]
2015-08-04  8:35     ` [patch] ASAN attach crash - 7.9 regression [Re: [PATCH 4/4] PR gdb/17471: Repeating a background command makes it foreground] Pedro Alves
2015-08-04 11:48       ` [commit+7.10] " Jan Kratochvil
2015-08-25 15:47         ` Jan Kratochvil
2015-08-04  8:28   ` [patch] signal_command: Leftover cleanup chain " Jan Kratochvil
2015-08-04  8:37     ` Pedro Alves
2015-08-04 11:49       ` [commit+7.10] " Jan Kratochvil
2015-08-25 15:48         ` Jan Kratochvil
2014-10-17 13:39 ` [pushed] Re: [PATCH 0/4] Fix a set of terminal/readline handling bugs/crashes Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150803210205.GA2019@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox