linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Evgenii Stepanov <eugenis@google.com>
To: Mark Brown <broonie@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,  Joey Gouly <joey.gouly@arm.com>,
	Branislav Rankov <branislav.rankov@arm.com>,
	 Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v1 4/4] arm64/mte: Add userspace interface for enabling asymmetric mode
Date: Wed, 2 Mar 2022 12:58:48 -0800	[thread overview]
Message-ID: <CAFKCwrgqDp1POGvnJHBkbab=1hQWGn=4u3kE62NX1GGntbwQmQ@mail.gmail.com> (raw)
In-Reply-To: <Yh/GeD9LzjMF/F0o@sirena.org.uk>

On Wed, Mar 2, 2022 at 11:33 AM Mark Brown <broonie@kernel.org> wrote:
>
> On Wed, Mar 02, 2022 at 10:44:31AM -0800, Evgenii Stepanov wrote:
> > On Wed, Mar 2, 2022 at 5:10 AM Mark Brown <broonie@kernel.org> wrote:
> > > On Wed, Mar 02, 2022 at 11:44:53AM +0000, Catalin Marinas wrote:
> > > > On Tue, Mar 01, 2022 at 04:52:01PM -0800, Evgenii Stepanov wrote:
>
> > > > > Extending PR_MTE_TCF_MASK seems bad for backward compatibility. User
> > > > > code may do "flags =& ~PR_MTE_TCF_MASK" to disable MTE; when compiled
> > > > > against an old version of the header this would fail to remove the ASYMM
> > > > > bit.
>
> > > > But if the app is compiled against an old version, it wouldn't set
> > > > MTE_CTRL_TCF_ASYMM either as it doesn't have the definition.
>
> > Libraries within a single process can be built against different
> > header versions. In our case, this is libc vs the app: we expect to
> > set all 3 mode bits when an app asks for "async" to enable the
> > mte_tcf_preferred logic. Even if the app is built against an older NDK
> > and unaware of the Asymm mode existence!
>
> I can't see how we can resolve that case in the kernel except by adding
> a specific call to disable all MTE modes which would obviously only be
> useful for future proofing given that no existing applications would
> support it.

One option would be to introduce a new, future-proofed prctl with a
wider mask, and throw in a few extra reserved bits just in case. Then
have the legacy prctl always clear MTE_CTRL_TCF_ASYMM.

> We would have been fine if we'd kept the original ABI that
> only allowed applications to request one mode at once but that ship
> sailed.  libc could arrange to know if the application was built against
> a new enough NDK to have the new flag and not enable asymmetric mode if
> it wasn't though.

Yes, that's a valid option, as well. But now that I think about it,
this is not the only pitfall with using the raw prctl in an Android
app. I'm inclined to just declare this case unsupported and have the
apps go through mallopt.

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

  reply	other threads:[~2022-03-02 21:00 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 19:57 [PATCH v1 0/4] arm64/mte: Asymmetric MTE support in userspace Mark Brown
2022-01-27 19:57 ` [PATCH v1 1/4] arm64/mte: Document ABI for asymmetric mode Mark Brown
2022-01-28 16:43   ` Catalin Marinas
2022-01-28 17:23     ` Mark Brown
2022-01-28 16:55   ` Vincenzo Frascino
2022-02-15 18:14   ` Will Deacon
2022-02-16 16:36     ` Mark Brown
2022-02-16 17:06       ` Will Deacon
2022-01-27 19:57 ` [PATCH v1 2/4] arm64/mte: Add a little bit of documentation for mte_update_sctlr_user() Mark Brown
2022-01-28 16:45   ` Catalin Marinas
2022-01-28 16:57   ` Vincenzo Frascino
2022-01-27 19:57 ` [PATCH v1 3/4] arm64/mte: Add hwcap for asymmetric mode Mark Brown
2022-01-28 16:51   ` Catalin Marinas
2022-01-28 17:00   ` Vincenzo Frascino
2022-01-27 19:57 ` [PATCH v1 4/4] arm64/mte: Add userspace interface for enabling " Mark Brown
2022-01-28 17:12   ` Vincenzo Frascino
2022-01-28 17:15   ` Catalin Marinas
2022-03-02  0:52   ` Evgenii Stepanov
2022-03-02 11:44     ` Catalin Marinas
2022-03-02 13:10       ` Mark Brown
2022-03-02 18:44         ` Evgenii Stepanov
2022-03-02 19:33           ` Mark Brown
2022-03-02 20:58             ` Evgenii Stepanov [this message]
2022-03-03 10:34               ` Catalin Marinas
2022-03-03 15:44                 ` Mark Brown
2022-03-03 22:47                   ` Evgenii Stepanov
2022-03-04 21:09                 ` Peter Collingbourne
2022-03-07 15:36                   ` Catalin Marinas
2022-03-07 19:10                     ` Mark Brown
2022-03-07 20:55                       ` Peter Collingbourne
2022-03-08 13:34                         ` Mark Brown
2022-03-07 20:55                     ` Peter Collingbourne
2022-03-08 18:26                       ` Catalin Marinas
2022-02-10 21:43 ` [PATCH v1 0/4] arm64/mte: Asymmetric MTE support in userspace Branislav Rankov

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='CAFKCwrgqDp1POGvnJHBkbab=1hQWGn=4u3kE62NX1GGntbwQmQ@mail.gmail.com' \
    --to=eugenis@google.com \
    --cc=branislav.rankov@arm.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).