public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Szabolcs Nagy <szabolcs.nagy@arm.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH 03/12] aarch64: Add BTI landing pads to assembly code
Date: Mon, 11 May 2020 16:13:47 -0300	[thread overview]
Message-ID: <e15591f9-c32f-eeec-b818-b33354f9b275@linaro.org> (raw)
In-Reply-To: <20200511113807.GG7649@arm.com>



On 11/05/2020 08:38, Szabolcs Nagy wrote:
> The 05/07/2020 13:55, Adhemerval Zanella via Libc-alpha wrote:
>> On 30/04/2020 14:39, Szabolcs Nagy wrote:
>>> From 550fe66ed93e13c0f063955e81bfcb8db386413c Mon Sep 17 00:00:00 2001
>>> From: Sudakshina Das <sudi.das@arm.com>
>>> Date: Tue, 17 Mar 2020 15:44:18 +0000
>>> Subject: [PATCH 03/12] aarch64: Add BTI landing pads to assembly code
>>>
>>> Adding the landing pads and the ELF markings are required if
>>> glibc is built with branch protection. For the handful of asm
>>> files this is done unconditionally, this simplifies maintenance
>>> and avoids complications where code layout is carefully aligned
>>> such that conditionally turning BTI off may cause performance
>>> regression (e.g. string functions).
>>
>> I am seeing the warning the cover letter warned on old binutils:
>>
>>   unsupported GNU_PROPERTY_TYPE (5) type: 0xc0000000
>>
>> In this case, how exactly binutils handles it? Does it still emit
>> the expected correct notes, and if so, is the expected layout?
> 
> ok, v2 takes care of this (with config checks).

Ack.

> 
> (linkers that don't handle the bti property will either
> emit a note that is not valid so ignored at runtime or
> not emit any note, so the warnings don't mean broken
> behaviour just turned off security feature)
> 
>>> +/* Branch Target Identitication support.  */
>>> +#define BTI_C		hint	34
>>> +#define BTI_J		hint	36
>>> +
>>> +#define FEATURE_1_BTI 1
>>> +#define FEATURE_1_PAC 2
>>
>> There are GNU_PROPERTY_AARCH64_FEATURE_1_BTI and GNU_PROPERTY_AARCH64_FEATURE_1_PAC,
>> why not use them?
> 
> i need definitions suitable for inclusion
> into assembly code.
> (i shortened the name so it does not go
> off the screen, but i can use the same
> name as in elf.h if that's less confusing)

Ack.

> 
>>> +#define END_FILE GNU_PROPERTY(FEATURE_1_BTI)
>>
>> END_FILE name does not really give much information.  Would be better
>> to use ADD_GNU_PROPERTIES or something?
> 
> the assumption was that we may need to
> add other things to asm files and don't
> want to touch all asm files when that
> happens, just reuse the END_FILE hook.
> 
> on the other hand i'm not sure how much
> value this hook adds: i can do what arm
> does for attributes: add them in sysdep.h
> at the top of asm files that include it.
> 
> the sysdep.h solution means less changes
> but may be easier to miss when new asm
> files are added: we need to ensure that
> all newly added asm code is compatible
> with the added properties, including asm
> like syscall-template.S that is shared
> across targets. Explicitly adding END_FILE
> implies the person who added it verified
> the necessary properties, but it's not a
> strong assurance and you could say the
> same for adding 'include <sysdep.h>'.
> 

I was referring to the define name in fact. But now that you brought
the different ways of define it, maybe setting it as arm attributes
might be a better alternative.

Although not required, current practice is to use sysdep.h macros
to define function entrypoints. So I think it should be feasible
to enforce its inclusion for all assembly implementations.

But I don't have a strong opinion here which mechanism is better.
What I think it would be useful is a way at build time to certify 
that if BTI is enabled, the linker warns if a object has a missing
property.

  reply	other threads:[~2020-05-11 19:13 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 17:34 [PATCH 00/12] aarch64: branch protection support Szabolcs Nagy
2020-04-30 17:37 ` [PATCH 01/12] elf.h: Add PT_GNU_PROPERTY Szabolcs Nagy
2020-05-07 14:49   ` Adhemerval Zanella
2020-04-30 17:37 ` [PATCH 02/12] elf.h: add aarch64 property definitions Szabolcs Nagy
2020-05-07 14:50   ` Adhemerval Zanella
2020-04-30 17:39 ` [PATCH 03/12] aarch64: Add BTI landing pads to assembly code Szabolcs Nagy
2020-05-07 16:55   ` Adhemerval Zanella
2020-05-11 11:38     ` Szabolcs Nagy
2020-05-11 19:13       ` Adhemerval Zanella [this message]
2020-04-30 17:40 ` [PATCH 04/12] aarch64: Rename place holder .S files to .c Szabolcs Nagy
2020-05-07 18:29   ` Adhemerval Zanella
2020-04-30 17:41 ` [PATCH 05/12] aarch64: fix swapcontext for BTI Szabolcs Nagy
2020-05-07 18:42   ` Adhemerval Zanella
2020-04-30 17:42 ` [PATCH 06/12] aarch64: fix RTLD_START " Szabolcs Nagy
2020-05-07 18:49   ` Adhemerval Zanella
2020-05-07 19:24     ` Szabolcs Nagy
2020-05-07 19:55       ` Adhemerval Zanella
2020-05-07 20:14         ` Szabolcs Nagy
2020-05-07 20:20           ` Adhemerval Zanella
2020-04-30 17:42 ` [PATCH 07/12] aarch64: fix syscalls " Szabolcs Nagy
2020-05-07 19:40   ` Adhemerval Zanella
2020-05-11 11:46     ` Szabolcs Nagy
2020-04-30 17:43 ` [PATCH 08/12] Rewrite abi-note.S in C Szabolcs Nagy
2020-04-30 20:07   ` Zack Weinberg
2020-05-01  9:23     ` Szabolcs Nagy
2020-05-01 14:07       ` Zack Weinberg
2020-04-30 17:44 ` [PATCH 09/12] aarch64: support BTI enabled binaries Szabolcs Nagy
2020-05-07 21:07   ` Adhemerval Zanella
2020-05-11 11:04     ` Szabolcs Nagy
2020-05-11 18:38       ` Adhemerval Zanella
2020-04-30 17:44 ` [PATCH 10/12] aarch64: Add pac-ret support to asm files Szabolcs Nagy
2020-05-08 16:59   ` Adhemerval Zanella
2020-05-11  8:27     ` Szabolcs Nagy
2020-05-11 18:39       ` Adhemerval Zanella
2020-04-30 17:45 ` [PATCH 11/12] aarch64: redefine RETURN_ADDRESS to strip PAC Szabolcs Nagy
2020-05-08 17:44   ` Adhemerval Zanella
2020-05-11 12:38     ` Szabolcs Nagy
2020-05-11 19:15       ` Adhemerval Zanella
2020-05-11 19:21         ` Florian Weimer
2020-05-11 20:13           ` Adhemerval Zanella
2020-05-11 20:18             ` Florian Weimer
2020-05-11 19:22   ` Florian Weimer
2020-05-11 20:45     ` Adhemerval Zanella
2020-05-12  8:42     ` Szabolcs Nagy
2020-04-30 17:45 ` [PATCH 12/12] aarch64: Configure option to build glibc with branch protection Szabolcs Nagy
2020-04-30 19:02   ` Joseph Myers
2020-05-08 17:53   ` Adhemerval Zanella
2020-05-04 11:27 ` [PATCH 00/12] aarch64: branch protection support Szabolcs Nagy

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=e15591f9-c32f-eeec-b818-b33354f9b275@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --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).