Re: [PATCH v6 05/11] arm64: elf: Enable BTI at exec based on ELF program properties

Mark Brown
2020-02-25T17:27:27Z

[-- Attachment #1: Type: text/plain, Size: 1105 bytes --]

On Tue, Feb 25, 2020 at 06:58:50PM +0530, Amit Kachhap wrote:
> On 2/13/20 12:59 AM, Mark Brown wrote:

> > +static inline int arch_parse_elf_property(u32 type, const void *data,
> > + size_t datasz, bool compat,
> > + struct arch_elf_state *arch)
> > +{

> Does this check here make sense to skip running extra code?
> if (!system_supports_bti())
> return 0;

This specifically is the wrong place for such a test since we didn't
even figure out if we're looking at the BTI property yet so it'd need to
be moved if any further properties are added.

> Although this check is there in arch_validate_prot.

And more importantly in arch_calc_vm_prot_bits() so we never actually
create guarded pages on a system that doesn't support BTI. That said I
do agree that it seems reasonable to add an explicit check in the
parsing of the actual BTI property for robustness and clarity, I'll do a
patch for that and roll it into any future versions or send it
incrementally if this one is applied but it doesn't seem sensible to
spin the whole series with the very broad CC list it has.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]