public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Mark Brown <broonie@kernel.org>
Cc: Will Deacon <will@kernel.org>,
	Szabolcs Nagy <szabolcs.nagy@arm.com>,
	Jeremy Linton <jeremy.linton@arm.com>,
	"H . J . Lu" <hjl.tools@gmail.com>,
	Yu-cheng Yu <yu-cheng.yu@intel.com>,
	linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	libc-alpha@sourceware.org, Dave Martin <Dave.Martin@arm.com>
Subject: Re: [PATCH v8 2/4] arm64: Enable BTI for main executable as well as the interpreter
Date: Fri, 4 Feb 2022 13:11:52 +0000	[thread overview]
Message-ID: <Yf0mGI8ucW6gKXMo@arm.com> (raw)
In-Reply-To: <20220124150704.2559523-3-broonie@kernel.org>

On Mon, Jan 24, 2022 at 03:07:02PM +0000, Mark Brown wrote:
> Currently for dynamically linked ELF executables we only enable BTI for
> the interpreter, expecting the interpreter to do this for the main
> executable. This is a bit inconsistent since we do map main executable and
> is causing issues with systemd's MemoryDenyWriteExecute feature which is
> implemented using a seccomp filter which prevents setting PROT_EXEC on
> already mapped memory and lacks the context to be able to detect that
> memory is already mapped with PROT_EXEC.
> 
> Resolve this by checking the BTI property for the main executable and
> enabling BTI if it is present when doing the initial mapping. This does
> mean that we may get more code with BTI enabled if running on a system
> without BTI support in the dynamic linker, this is expected to be a safe
> configuration and testing seems to confirm that.

Alternatively we could only enable BTI on the main executable if the
interpreter is also compiled with the BTI attributes. But it still feels
a bit inconsistent as a BTI-capable interpreter doesn't necessarily mean
it had to be compiled with BTI support.

> It also reduces the
> flexibility userspace has to disable BTI but it is expected that for cases
> where there are problems which require BTI to be disabled it is more likely
> that it will need to be disabled on a system level.

That's my expectation as well. I'm not aware of any plans to make a
dynamic loader choose BTI based on some environment variable (not sure
about Android zygote, I haven't heard anything either).

> Signed-off-by: Mark Brown <broonie@kernel.org>
> Reviewed-by: Dave Martin <Dave.Martin@arm.com>
> Tested-by: Jeremy Linton <jeremy.linton@arm.com>

For this patch:

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>

  reply	other threads:[~2022-02-04 13:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24 15:07 [PATCH v8 0/4] arm64: Enable BTI for the " Mark Brown
2022-01-24 15:07 ` [PATCH v8 1/4] elf: Allow architectures to parse properties on the main executable Mark Brown
2022-02-04 13:00   ` Catalin Marinas
2022-01-24 15:07 ` [PATCH v8 2/4] arm64: Enable BTI for main executable as well as the interpreter Mark Brown
2022-02-04 13:11   ` Catalin Marinas [this message]
2022-01-24 15:07 ` [PATCH v8 3/4] elf: Remove has_interp property from arch_adjust_elf_prot() Mark Brown
2022-02-04 14:53   ` Catalin Marinas
2022-01-24 15:07 ` [PATCH v8 4/4] elf: Remove has_interp property from arch_parse_elf_property() Mark Brown
2022-02-04 14:54   ` Catalin Marinas
2022-02-15 18:34 ` [PATCH v8 0/4] arm64: Enable BTI for the executable as well as the interpreter Will Deacon
2022-02-16 13:34   ` Catalin Marinas
2022-02-16 16:49     ` Szabolcs Nagy
2022-02-16 17:01       ` Mark Brown
2022-02-17  8:17         ` Szabolcs Nagy
2022-02-22 14:15     ` Mark Brown
2022-02-25 13:53     ` Will Deacon
2022-02-25 15:11       ` Mark Brown
2022-02-25 15:54         ` Will Deacon

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=Yf0mGI8ucW6gKXMo@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=Dave.Martin@arm.com \
    --cc=broonie@kernel.org \
    --cc=hjl.tools@gmail.com \
    --cc=jeremy.linton@arm.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=szabolcs.nagy@arm.com \
    --cc=will@kernel.org \
    --cc=yu-cheng.yu@intel.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).