public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Lancelot SIX <Lancelot.Six@amd.com>
To: Andrew Burgess <aburgess@redhat.com>,
	Lancelot SIX via Gdb-patches <gdb-patches@sourceware.org>
Cc: lsix@lancelotsix.com
Subject: Re: [PATCH 2/3] gdb/varobj: Fix use after free in varobj
Date: Fri, 17 Jun 2022 17:38:23 +0100	[thread overview]
Message-ID: <c88b4a8e-7fe9-3ed0-4ae9-869f3eef6ac7@amd.com> (raw)
In-Reply-To: <87v8szclvu.fsf@redhat.com>

Hi,

Thanks for the feedbacks and spot-on comments.  I'll integrate them in a 
V2 shortly.

>> +gdb_exit
>> +if { [mi_gdb_start] } {
>> +    return 0
>> +}
> 
> Could/should the gdb_exit and mi_gdb_start calls be replaced with:
> 
>    if { [mi_clean_restart] } {
>      # Should we have an unsupported call in here maybe?
>      return
>    }
> 

Yes, it should probably.  I'll change this in the V2.

This is what happens when we create a new test by copying an existing one…

>> +    # Floating varobj should still be valid, but out of scope at the moment.
>> +    mi_gdb_test "-var-update floating_local" \
>> +     "\\^done,changelist=\\\[{name=\"floating_local\",in_scope=\"false\",type_changed=\"false\",has_more=\"0\"}\\\]" \
>> +     "floating_local still valid but not in scope"
> 
> For me, this test is failing, the output looks like:
> 
>    -var-update floating_local
>    ^done,changelist=[{name="floating_local",in_scope="invalid",has_more="0"}]
>    (gdb)
>    FAIL: gdb.mi/mi-var-invalidate-shlib.exp: in new process: floating_local still valid but not in scope (unexpected output)
> 
> But, once the next patch is applied, the test starts to pass.  So maybe
> this test just needs moving into the next patch?

Indeed, this part of the test should really be in the patch #2.  Thanks 
for spotting this.


> 
> I notice that non of the tests in either this patch, or the next one,
> exercise this condition.
> 
> Is it possible to create a test for this case?

Will do.  Issuing a "-var-update" after the dlclose call in the test 
should exercise this.  I did that manually, but forgot to include it in 
the testcaes.

Best,
Lancelot.

  reply	other threads:[~2022-06-17 16:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-17 10:10 [PATCH 0/3] Fix some use-after-free errors in varobj code Lancelot SIX
2022-06-17 10:10 ` [PATCH 1/3] MI: mi_runto -pending Lancelot SIX
2022-06-17 10:10 ` [PATCH 2/3] gdb/varobj: Fix use after free in varobj Lancelot SIX
2022-06-17 16:09   ` Andrew Burgess
2022-06-17 16:38     ` Lancelot SIX [this message]
2022-06-20 15:52       ` Lancelot SIX
2022-06-30 18:43     ` Formatting/indentation of lambdas (Re: [PATCH 2/3] gdb/varobj: Fix use after free in varobj) Pedro Alves
2022-07-05 13:33       ` Lancelot SIX
2022-06-17 10:10 ` [PATCH 3/3] gdb/varobj: Fix varobj_invalidate_iter Lancelot SIX

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=c88b4a8e-7fe9-3ed0-4ae9-869f3eef6ac7@amd.com \
    --to=lancelot.six@amd.com \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lsix@lancelotsix.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).