All of lore.kernel.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Szabolcs Nagy <szabolcs.nagy@arm.com>
Cc: Peter Collingbourne <pcc@google.com>,
	Will Deacon <will@kernel.org>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Evgenii Stepanov <eugenis@google.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Tejas Belagod <Tejas.Belagod@arm.com>
Subject: Re: [PATCH v5] arm64: mte: allow async MTE to be upgraded to sync on a per-CPU basis
Date: Thu, 24 Jun 2021 17:52:28 +0100	[thread overview]
Message-ID: <20210624165228.GB25097@arm.com> (raw)
In-Reply-To: <20210623085530.GF13058@arm.com>

On Wed, Jun 23, 2021 at 09:55:30AM +0100, Szabolcs Nagy wrote:
> The 06/22/2021 11:37, Peter Collingbourne wrote:
> > On Mon, Jun 21, 2021 at 11:50 AM Catalin Marinas
> > <catalin.marinas@arm.com> wrote:
> > > On Mon, Jun 21, 2021 at 06:39:02PM +0100, Will Deacon wrote:
> > > > On Mon, Jun 21, 2021 at 04:18:59PM +0100, Catalin Marinas wrote:
> > > > > Given that there are no real users of MTE yet, we have some choice of
> > > > > tweaking the ABI, backporting to 5.10. The question: is the expectation
> > > > > that the sysfs forcing of TCF is limited to deployments where the user
> > > > > space is tightly controlled (e.g. Android with most apps starting from
> > > > > zygote) or we allow it to become more of a general hint of what's the
> > > > > fastest check on a CPU? If the former, I'm fine with forcing without any
> > > > > additional bit, though I'd still prefer the opt-in. For the latter, I'd
> > > > > like some wider discussion with non-Android folk on what they expect
> > > > > from the TCF setting. Otherwise simply using PROT_MTE would may lead to
> > > > > tag check faults.
> > > >
> > > > I don't think there's anything Android-specific here. The problem being
> > > > solved concerns big/little SoCs with MTE, and I think it's up to the
> > > > distribution how the sysfs stuff is used.
> > >
> > > But distros don't control what applications are running, so most likely
> > > they would disable the sysfs control entirely. At that point, the
> > > feature becomes primarily an Android play.
> > >
> > > Anyway, I'm not dead against forcing of the TCF mode regardless of the
> > > user choice but I'd like to ensure that we don't miss other use-cases or
> > > that we don't make the sysfs control an expert-only feature.
> > >
> > > Adding Szabolcs to get a view from the glibc perspective.
> 
> Adding Tejas as he will look at memory tagging in glibc.

Thanks. Is there any MTE support in mainline glibc? If not, we may have
another chance of adjusting the ABI.

> > Given these diverging opinions my view is that we should choose
> > whichever option leaves our options open for the future. For example,
> > imagine that we make the ABI change now such that upgrades may happen
> > for all applications and we don't have PR_MTE_DYNAMIC_TCF. This means
> > that applications no longer have a guarantee of their TCF mode which
> > may preclude some use cases (if we add an opt out later, applications
> > will be affected when running on the kernel versions between when we
> > changed the ABI and when we added the opt out). On the other hand, if
> > we introduce PR_MTE_DYNAMIC_TCF, we can always make the ABI change
> > later and start ignoring the PR_MTE_DYNAMIC_TCF flag at that point.
> > 
> > Maybe the best compromise would be to change the ABI and at the same
> > time add the opt out, but I don't have a strong opinion.
> 
> so the observable difference between async mode and async mode
> upgraded to sync mode is that async mode allows to ignoring the fault
> and things can continue, while in sync mode the program cannot move
> forward in case of a fault since the pc is still at the faulting
> instruction?

Yes. Would an application find the async mode useful or it can be freely
overridden by the kernel (well, a user via sysfs)?

> may be we can have a mode where the cpu is in sync mode checks but the
> kernel steps over the faulting instruction before reporting it? so
> emulating async semantics (in a slow and complicated way..), but
> guaranteeing (almost) immediate faults for better debugging/security.

It's a pretty complex step over (or emulate), so I wouldn't go there.
The user signal handler could disable tag checking altogether
(PSTATE.TCO) and continue.

> personally i don't see a big issue with a mode that says "either sync
> or async check behaviour" and user code has to deal with it, however..

The question is more about whether we still want to keep the current
user program choice of sync vs async (vs the new asymmetric mode in
8.7). If the user wouldn't care, we just override it from the kernel
without any additional PR_ flag for opting in (or out).

> the per cpu setting is a bit nasty: can the kernel decide which cpu
> should use sync and which async? or a privileged user will have to
> fiddle with sysfs settings on every system to make this useful?

The proposed interface is sysfs. I think that's not relevant to the user
application since it wouldn't have control over it anyway. What's
visible is that it cannot rely on the mode it requested, not even for
the lifetime of a thread (as it may migrate between CPUs). Do you see
any issues with this? For Android, it's probably fine but if other
programs cannot cope (or need the specific mode requested), we'd need a
new control (for opt-in or opt-out).

-- 
Catalin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-06-24 16:54 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15 20:38 [PATCH v5] arm64: mte: allow async MTE to be upgraded to sync on a per-CPU basis Peter Collingbourne
2021-06-17 21:58 ` Will Deacon
2021-06-17 22:13   ` Peter Collingbourne
2021-06-18 15:09   ` Catalin Marinas
2021-06-19  0:45     ` Peter Collingbourne
2021-06-21 12:39     ` Will Deacon
2021-06-21 15:18       ` Catalin Marinas
2021-06-21 17:39         ` Will Deacon
2021-06-21 18:50           ` Catalin Marinas
2021-06-22 18:37             ` Peter Collingbourne
2021-06-23  8:55               ` Szabolcs Nagy
2021-06-23 17:15                 ` Peter Collingbourne
2021-06-24 16:52                 ` Catalin Marinas [this message]
2021-06-25  9:22                   ` Szabolcs Nagy
2021-06-25 12:01                     ` Catalin Marinas
2021-06-25 12:39                       ` Will Deacon
2021-06-25 13:53                         ` Catalin Marinas
2021-06-28 10:14                           ` Will Deacon
2021-06-28 15:20                             ` Catalin Marinas
2021-06-29 10:46                               ` Will Deacon
2021-06-29 13:58                                 ` Szabolcs Nagy
2021-06-29 14:31                                   ` Tejas Belagod
2021-06-29 15:54                                     ` Catalin Marinas
2021-06-29 19:11                                 ` Peter Collingbourne
2021-06-30 15:19                                   ` Catalin Marinas
2021-06-30 23:39                                     ` Peter Collingbourne
2021-07-07 10:30                                       ` Will Deacon
2021-07-07 12:55                                         ` Catalin Marinas
2021-07-07 14:11                                           ` Will Deacon
2021-06-25 14:14                         ` Szabolcs Nagy
2021-06-25 16:21                           ` Tejas Belagod
2021-06-28 10:17                           ` Will Deacon
2021-06-28 17:21                             ` Szabolcs Nagy
2021-06-25 16:52                       ` Peter Collingbourne

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=20210624165228.GB25097@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=Tejas.Belagod@arm.com \
    --cc=eugenis@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=pcc@google.com \
    --cc=szabolcs.nagy@arm.com \
    --cc=vincenzo.frascino@arm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.