Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Luis Machado via Gdb-patches <gdb-patches@sourceware.org>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH] [AArch64] Sanitize the address before working with allocation tags
Date: Tue, 18 May 2021 18:20:11 -0300	[thread overview]
Message-ID: <d47560f0-6a88-9074-0811-d752d40892f2@linaro.org> (raw)
In-Reply-To: <ca788ada-89af-29b2-857a-9f89c7e8c133@polymtl.ca>

On 5/18/21 5:33 PM, Simon Marchi wrote:
> On 2021-05-18 4:19 p.m., Luis Machado via Gdb-patches wrote:
>> Remove the logical tag/top byte from the address whenever we have to work with
>> allocation tags.
> 
> Can you explain a bit more why this is needed?  What down the line
> doesn't like to receive an address with a logical tag?

We shouldn't be passing an address with a non-zero top byte (or tag) to 
a ptrace request, for example. It may work (in fact, it works) but we 
are not supposed to rely on it. So we sanitize the pointer before it 
gets to fetch_memtags/store_memtags.

This is clarified in the AArch64 Tagged Address ABI document 
(https://www.kernel.org/doc/html/latest/arm64/tagged-address-abi.html).

In an upcoming patch to support memory tags in core files 
(https://sourceware.org/pipermail/gdb-patches/2021-May/178973.html), 
this address also gets passed down to the core target's fetch_memtags 
implementation. It needs to compare addresses, so it doesn't make sense 
to let through an address with a non-zero top byte, or else we risk not 
having a match due to differences in the upper byte.


  reply	other threads:[~2021-05-18 21:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 20:19 Luis Machado via Gdb-patches
2021-05-18 20:33 ` Simon Marchi via Gdb-patches
2021-05-18 21:20   ` Luis Machado via Gdb-patches [this message]
2021-05-20  8:38     ` Alan Hayward via Gdb-patches
2021-05-20 10:59       ` Luis Machado via Gdb-patches
2021-05-20 12:22         ` Alan Hayward 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=d47560f0-6a88-9074-0811-d752d40892f2@linaro.org \
    --to=gdb-patches@sourceware.org \
    --cc=luis.machado@linaro.org \
    --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