public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2] [gdb/testsuite] Handle ptrace operation not permitted in can_spawn_for_attach
Date: Wed, 24 Apr 2024 20:40:49 +0100	[thread overview]
Message-ID: <cda05bd4-134c-405b-86b3-70a2235488d4@palves.net> (raw)
In-Reply-To: <20240418063237.1545-1-tdevries@suse.de>

On 2024-04-18 07:32, Tom de Vries wrote:
> When running the testsuite on a system with kernel.yama.ptrace_scope set to 1,
> we run into attach failures.
> 
> Fix this by recognizing "ptrace: Operation not permitted" in
> can_spawn_for_attach.
> 
> Tested on aarch64-linux.

I really don't like relying on "attach" 's behavior to decide whether to test attach.
It's an inversion of responsibilities.

can_spawn_for_attach means "can I spawn a process, such that I will attach to it later", a
simple atomic thing.

Also, with this change, it means, "can I spawn a process and does attaching to it work?"
So it ends up misnamed.

Someone tried to add something very much like this a while ago, and I objected then:

  https://inbox.sourceware.org/gdb-patches/e5f08136-fa4d-2f21-ff83-8adf4d3a158e@palves.net/

We ended up with gdb_attach, added in a7e6a19e87f3, which handles the "ptrace: Operation not permitted"
scenarios too.  Some testcases have meanwhile been converted to use gdb_attach, but there are more,
of course.  IMO we should continue that direction.  gdb_attach is not unlike "gdb_run_cmd" for example.

See also:

  https://inbox.sourceware.org/gdb-patches/3b845985-cbd4-4996-145e-14191338b095@polymtl.ca/

Pedro Alves


  reply	other threads:[~2024-04-24 19:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18  6:32 Tom de Vries
2024-04-24 19:40 ` Pedro Alves [this message]
2024-04-24 21:35   ` Tom de Vries
2024-04-26 18:50     ` Pedro Alves
2024-05-01  8:42       ` Tom de Vries
2024-05-01  8:34 Tom de Vries
2024-05-01  9:08 ` Tom de Vries
2024-05-06 11:33 ` Pedro Alves
2024-05-17  3:42 ` Simon Marchi
2024-05-17  9:54   ` Tom de Vries

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=cda05bd4-134c-405b-86b3-70a2235488d4@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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).