Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Luis Machado <luis.machado@arm.com>
Cc: Mark Brown <broonie@kernel.org>, Will Deacon <will@kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Shuah Khan <shuah@kernel.org>,
	Alan Hayward <alan.hayward@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v4 3/4] arm64/ptrace: Support access to TPIDR2_EL0
Date: Thu, 22 Sep 2022 14:57:56 +0100	[thread overview]
Message-ID: <Yyxp5BnxTp/N6hAa@arm.com> (raw)
In-Reply-To: <f87f6a6f-d137-9a81-fa44-5a6bda2991fd@arm.com>

On Thu, Sep 22, 2022 at 12:15:13PM +0100, Luis Machado wrote:
> On 9/19/22 13:43, Mark Brown wrote:
> > On Fri, Sep 16, 2022 at 01:01:31PM +0100, Catalin Marinas wrote:
> > > On Mon, Aug 29, 2022 at 04:49:20PM +0100, Mark Brown wrote:
> > > > @@ -1392,7 +1407,7 @@ static const struct user_regset aarch64_regsets[] = {
> > > >   	},
> > > >   	[REGSET_TLS] = {
> > > >   		.core_note_type = NT_ARM_TLS,
> > > > -		.n = 1,
> > > > +		.n = 2,
> > > >   		.size = sizeof(void *),
> > > >   		.align = sizeof(void *),
> > > >   		.regset_get = tls_get,
> > 
> > > Does this change confuse user-space? I presume an updated gdb would
> > > check the iov.len to figure out whether a new register is available but
> > > would existing debuggers complain of the new size of this regset?
> > 
> > gdb seems happy as far as I can see, it is possible something would be
> > reusing the read_iov for repeated TLS read calls in a context where it
> > was only pointing at a single u64 but I'm not sure how realistic that
> > is given the idiom.  I did do a search on sources.debian.net and didn't
> > turn up anything that'd have problems.
> > 
> > If using this as an extensiblility mechanism is a concern we need to
> > bear that in mind elsewhere, and for this it's either a case of
> > providing another single register regset or trying to do a generic
> > sysreg read/get (though that'd be another regset that's not idiomatic
> > for the regset API).
> 
> Older GDB's assume a single register for NT_ARM_TLS, so they will always
> fetch TPIDR. Newer GDB's will check the size and act accordingly.

That's fine. Looking at the ptrace_regset() implementation in Linux, it
updates the user iov_len to what was actually copied. In this case it
would be 1 (the minimum of the user iov_len and the regset n * size). So
from the old gdb ABI perspective, it shouldn't notice a difference. An
old gdb setting the TLS reg will also leave tpidr2_el0 unchanged.

An updated gdb running on an older kernel should be aware that even if
it asked for two u64, it may only get one back and the user iov_len
updated accordingly.

-- 
Catalin

  reply	other threads:[~2022-09-22 13:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29 15:49 [PATCH v4 0/4] arm64/sme: ptrace support for TPIDR2_EL0 Mark Brown
2022-08-29 15:49 ` [PATCH v4 1/4] kselftest/arm64: Add test coverage for NT_ARM_TLS Mark Brown
2022-08-29 15:49 ` [PATCH v4 2/4] arm64/ptrace: Document extension of NT_ARM_TLS to cover TPIDR2_EL0 Mark Brown
2022-08-29 15:49 ` [PATCH v4 3/4] arm64/ptrace: Support access to TPIDR2_EL0 Mark Brown
2022-09-16 12:01   ` Catalin Marinas
2022-09-19 12:43     ` Mark Brown
2022-09-22 11:15       ` Luis Machado
2022-09-22 13:57         ` Catalin Marinas [this message]
2022-08-29 15:49 ` [PATCH v4 4/4] kselftest/arm64: Add coverage of TPIDR2_EL0 ptrace interface Mark Brown
2022-09-21 17:19 ` [PATCH v4 0/4] arm64/sme: ptrace support for TPIDR2_EL0 Catalin Marinas

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=Yyxp5BnxTp/N6hAa@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=alan.hayward@arm.com \
    --cc=broonie@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=luis.machado@arm.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=will@kernel.org \
    /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