From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: Pedro Alves <pedro@palves.net>, gdb-patches@sourceware.org
Subject: Re: [PATCH 3/8] gdb: replace inferior::waiting_for_vfork_done with inferior::thread_waiting_for_vfork_done
Date: Fri, 1 Apr 2022 10:25:15 -0400 [thread overview]
Message-ID: <d52874e4-058f-5e72-56e7-6de199fd07c5@polymtl.ca> (raw)
In-Reply-To: <866792ef-2f13-c6d5-2d2e-555f5f0d4695@palves.net>
On 2022-03-31 14:17, Pedro Alves wrote:
> On 2022-01-17 16:27, Simon Marchi via Gdb-patches wrote:
>> The inferior::waiting_for_vfork_done flag indicates that some thread in
>> that inferior is waiting for a vfork-done event. Subsequent patches
>> will need to know which thread is waiting for that event.
>>
>> I think there is a latent buglet in that waiting_for_vfork_done is
>> currently not reset on inferior exec or exit. I could imagine that if a
>> thread in the parent process calls exec or exit while another thread of
>> the parent process is waiting for its vfork child to exec or exit, we
>> could end up with inferior::waiting_for_vfork_done without a thread
>> actually waiting for a vfork-done event anymore. And since that flag is
>> checked in resume_1, things could misbehave there.
>>
>> Since the new field points to a thread_info object, and those are
>> destroyed on exec or exit, it could be worse now since we could try to
>> access freed memory, if thread_waiting_for_vfork_done were to point to a
>> stale thread_info. To avoid this, clear the field in
>> infrun_inferior_exit and infrun_inferior_execd.
>
> This is OK, please mention explicitly in the body of the commit log that this
> is replacing the boolean with a thread_info pointer. Not having that
> actually gave me pause.
Ok, done locally.
Simon
next prev parent reply other threads:[~2022-04-01 14:25 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-17 16:27 [PATCH 0/8] Some fixes for handling vfork by multi-threaded programs Simon Marchi via Gdb-patches
2022-01-17 16:27 ` [PATCH 1/8] gdb/infrun: add reason parameter to stop_all_threads Simon Marchi via Gdb-patches
2022-03-31 15:05 ` Pedro Alves
2022-03-31 15:35 ` Simon Marchi via Gdb-patches
2022-01-17 16:27 ` [PATCH 2/8] gdb/linux-nat: remove check based on current_inferior in linux_handle_extended_wait Simon Marchi via Gdb-patches
2022-03-31 16:12 ` Pedro Alves
2022-03-31 17:06 ` Simon Marchi via Gdb-patches
2022-01-17 16:27 ` [PATCH 3/8] gdb: replace inferior::waiting_for_vfork_done with inferior::thread_waiting_for_vfork_done Simon Marchi via Gdb-patches
2022-03-31 18:17 ` Pedro Alves
2022-04-01 14:25 ` Simon Marchi via Gdb-patches [this message]
2022-01-17 16:27 ` [PATCH 4/8] gdb/infrun: add inferior parameters to stop_all_threads and restart_threads Simon Marchi via Gdb-patches
2022-03-31 18:17 ` Pedro Alves
2022-01-17 16:27 ` [PATCH 5/8] gdb/infrun: add logging statement to do_target_resume Simon Marchi via Gdb-patches
2022-03-31 18:18 ` Pedro Alves
2022-01-17 16:27 ` [PATCH 6/8] gdb: fix handling of vfork by multi-threaded program (follow-fork-mode=parent, detach-on-fork=on) Simon Marchi via Gdb-patches
2022-03-31 18:21 ` Pedro Alves
2022-04-01 17:28 ` Simon Marchi via Gdb-patches
2022-01-17 16:27 ` [PATCH 7/8] gdbserver: report correct status in thread stop race condition Simon Marchi via Gdb-patches
2022-03-31 18:21 ` Pedro Alves
2022-01-17 16:27 ` [PATCH 8/8] gdb: resume ongoing step after handling fork or vfork Simon Marchi via Gdb-patches
2022-03-31 18:22 ` Pedro Alves
2022-03-31 18:28 ` Pedro Alves
2022-04-01 18:42 ` Simon Marchi via Gdb-patches
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=d52874e4-058f-5e72-56e7-6de199fd07c5@polymtl.ca \
--to=gdb-patches@sourceware.org \
--cc=pedro@palves.net \
--cc=simon.marchi@polymtl.ca \
/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