unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu via Libc-alpha" <libc-alpha@sourceware.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: GNU C Library <libc-alpha@sourceware.org>,
	Szabolcs Nagy <szabolcs.nagy@arm.com>,
	Joseph Myers <joseph@codesourcery.com>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH v6 1/1] <sys/tagged-address.h>: An API for tagged address
Date: Mon, 23 Aug 2021 07:15:35 -0700	[thread overview]
Message-ID: <CAMe9rOoLwn54Q9VYcZb-S4WT7n03Ze9995haBxTu2LXy_wAkNQ@mail.gmail.com> (raw)
In-Reply-To: <874kbgp8y6.fsf@oldenburg.str.redhat.com>

On Mon, Aug 23, 2021 at 6:49 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu:
>
> > On Mon, Aug 23, 2021 at 2:28 AM Florian Weimer <fweimer@redhat.com> wrote:
> >>
> >> * H. J. Lu:
> >>
> >> > By default, the number of the address bits used in address translation
> >> > is the number of address bits.  But it can be changed by ARM Top-byte
> >> > Ignore (TBI) or Intel Linear Address Masking (LAM).
> >>
> >> I think the fundamental concern is that we don't really know today how
> >> this API would be used.  Szabolcs has said that Arm doesn't need this
> >> API for HWSAN.  TBI has already other (incompatible) users, I think.
> >> (Although OpenJDK's ZGC garbage collector has moved off it.)
> >>
> >> My concern is that this interface essentialyl sets in stone a certain
> >> programming model for LAM, and we really don't know today if that's the
> >> right approach.
> >
> > My current API has only set_translated_address_mask to enable LAM.
> > It doesn't specify/know how LAM is used.  I don't see there is an issue
> > here.
>
> It's still unclear who owns the tag bits, and if the behavior is
> expected to be like the kernel (e.g., glibc masks all tag bits in
> dladdr so that they are ignored not just at the hardware level).

We don't have to decide now.  We will learn more with HWASAN.
With set_translated_address_mask, glibc can control/change how
tag bits should be used.  With kernel API, glibc is out of the picture.

> >> I also expect that HWSAN needs to poke at glibc internals, like the
> >> other sanitizers, so I don't see why calling a kernel API behind glibc's
> >> back would be problematic.
> >
> > The LAM enabled glibc should support all LAM usages.   memmove
> > needs to know the LAM bits to work properly.
>
> Only if it is permitted to change the tag on subobjects, which I don't
> think is the case.  Otherwise overlaps necessarily have the same tag,
> and the existing pointer comparison works as expected.

It is not about overlap.  I am concerned about copy direction, like
if (dest > src), will it be a problem?

> >> As a side effect of the libpthread merge, we freed DF_1_INITFIRST for
> >> other uses, so you should be able to work around initialization ordering
> >> issues, too.
> >
> > The issue here is that LAM should only be enabled ONCE before main
> > and thread creation.  Neither DF_1_INITFIRST nor kernel API can properly
> > enforce it.
>
> How does AArch64 solve this?  Different kernel API?

I don't think that AArch64 has addressed this issue at all.

-- 
H.J.

  reply	other threads:[~2021-08-23 14:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-22 12:45 [PATCH v6 0/1] RFC: Add <sys/tagged-address.h> H.J. Lu via Libc-alpha
2021-08-22 12:45 ` [PATCH v6 1/1] <sys/tagged-address.h>: An API for tagged address H.J. Lu via Libc-alpha
2021-08-23  9:28   ` Florian Weimer via Libc-alpha
2021-08-23 13:40     ` H.J. Lu via Libc-alpha
2021-08-23 13:49       ` Florian Weimer via Libc-alpha
2021-08-23 14:15         ` H.J. Lu via Libc-alpha [this message]
2021-09-03  9:12           ` Szabolcs Nagy via Libc-alpha
2021-09-03 13:58             ` H.J. Lu via Libc-alpha
2021-09-06  8:52               ` Florian Weimer via Libc-alpha
2021-09-06 13:34                 ` H.J. Lu via Libc-alpha
2021-09-17 10:19                   ` Florian Weimer 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=CAMe9rOoLwn54Q9VYcZb-S4WT7n03Ze9995haBxTu2LXy_wAkNQ@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).