unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>
To: Szabolcs Nagy <szabolcs.nagy@arm.com>
Cc: Florian Weimer <fweimer@redhat.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	Joseph Myers <joseph@codesourcery.com>
Subject: Re: [PATCH v5 1/1] <sys/tagged-address.h>: An API for tagged address
Date: Tue, 17 Aug 2021 05:53:32 -0700	[thread overview]
Message-ID: <CAMe9rOrX9rVv3BnMoMoLNu92PeaPRbzk4J=7qPZ9DgfbJR_DgQ@mail.gmail.com> (raw)
In-Reply-To: <20210817123258.GF25257@arm.com>

On Tue, Aug 17, 2021 at 5:33 AM Szabolcs Nagy via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> The 08/12/2021 13:01, Szabolcs Nagy via Libc-alpha wrote:
> > The 08/12/2021 10:36, Florian Weimer wrote:
> > > I still don't see a way how we can split tag address bits used by the
> > > implementation (glibc, sanitizers) and the application.
> ...
> > so one approach is to just disallow user tags, only sanitizer
> > and similar tools can tag (and i think hwasan can coordinate
> > with glibc via less formal api/abi that we can change later)
>
> to expand on this: i think we should just focus on the hwasan
> use-case. there may be other use-cases for tagged addresses,
> but we need more experience before we can design a generic api.
> hwasan can just poke at implementation internals and have
> target specific logic for now.

Agreed.  My motivation is hwasan.

> allowing application code to use the tag bits can break c
> semantics and compiler assumptions too easily.
>
> and we should not require hwasan to use libc apis to work
> with tagged addresses, that would slow it down.

There is no reason why a libc API should be slow.   Currently,
LAM enabled libsanitizer/hwasan has

#include <sys/tagged-address.h>

bool lam_failed = set_tagged_address_mask (TAGGED_ADDRESS_MASK (57))

We only need this function to enable LAM in libsanitizer/hwasan
and inform glibc that LAM is enabled.  The rest of functions in
<sys/tagged-address.h> are used to make memmove and memmove
tests LAM compatible.  We can move them to internal header files.

> so i think we don't need the tagged address representation
> related apis. we may need something __hwasan_init can call
> to set up os support. on aarch64 that's a prctl now, but a
> libc api would allow us to disable hwasan from glibc (e.g.
> if there are elf markings for incompatible dsos), i don't

set_tagged_address_mask can be used to enable and disable
LAM/TBI.  memmove needs to know if LAM/TBI is enabled or not
to work correctly.

> know if that makes sense (does hwasan have a fall back if
> there is no os support?).
>

It is a hard error for hwasan if LAM/TBI isn't available.

Thanks.

-- 
H.J.

  reply	other threads:[~2021-08-17 12:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05 13:13 [PATCH v5 0/1] RFC: Add <sys/tagged-address.h> H.J. Lu via Libc-alpha
2021-08-05 13:13 ` [PATCH v5 1/1] <sys/tagged-address.h>: An API for tagged address H.J. Lu via Libc-alpha
2021-08-05 17:26   ` Joseph Myers
2021-08-05 17:41     ` H.J. Lu via Libc-alpha
2021-08-05 17:54       ` Joseph Myers
2021-08-05 19:33         ` H.J. Lu via Libc-alpha
2021-08-12  8:36   ` Florian Weimer via Libc-alpha
2021-08-12 12:01     ` Szabolcs Nagy via Libc-alpha
2021-08-17 12:32       ` Szabolcs Nagy via Libc-alpha
2021-08-17 12:53         ` H.J. Lu via Libc-alpha [this message]
2021-08-17 14:59           ` Szabolcs Nagy via Libc-alpha
2021-08-17 15:37             ` H.J. Lu via Libc-alpha
2021-08-20 16:14       ` H.J. Lu via Libc-alpha
2021-08-20 16:25         ` Florian Weimer via Libc-alpha
2021-08-20 16:30           ` H.J. Lu via Libc-alpha
2021-08-20 23:26     ` H.J. Lu via Libc-alpha
2021-08-21 16:10       ` Sunil Pandey via Libc-alpha
2021-08-21 16:37         ` H.J. Lu via Libc-alpha
2021-08-21 21:20           ` Sunil Pandey via Libc-alpha

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

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMe9rOrX9rVv3BnMoMoLNu92PeaPRbzk4J=7qPZ9DgfbJR_DgQ@mail.gmail.com' \
    --to=libc-alpha@sourceware.org \
    --cc=fweimer@redhat.com \
    --cc=hjl.tools@gmail.com \
    --cc=joseph@codesourcery.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=szabolcs.nagy@arm.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).