All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christoph Müllner" <christoph.muellner@theobroma-systems.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1] boot/arm-trusted-firmware: Forward stack protection configuration
Date: Sat, 21 Nov 2020 18:28:16 +0100	[thread overview]
Message-ID: <d2e4f4d0-c3b1-71de-dbfd-b80ba5235ca2@theobroma-systems.com> (raw)
In-Reply-To: <87eekmy7as.fsf@tarshish>

On 11/21/20 5:59 PM, Baruch Siach wrote:
> Hi Christoph,
> 
> On Fri, Nov 20 2020, Christoph M?llner wrote:
>> TF-A supports stack smashing protection (-fstack-protector-*).
>> Since we already forward the required compiler flag, let's
>> also tell TF-A that we actually want the required symbols
>> (e.g. __stack_chk_guard) to be available.
>>
>> Signed-off-by: Christoph M?llner <christoph.muellner@theobroma-systems.com>
>> ---
>>  boot/arm-trusted-firmware/arm-trusted-firmware.mk | 12 ++++++++++++
>>  1 file changed, 12 insertions(+)
>>
>> diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
>> index a3553e36cf..f5be39100e 100644
>> --- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk
>> +++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk
>> @@ -100,6 +100,18 @@ ARM_TRUSTED_FIRMWARE_MAKE_OPTS += MV_DDR_PATH=$(MV_DDR_MARVELL_DIR)
>>  ARM_TRUSTED_FIRMWARE_DEPENDENCIES += mv-ddr-marvell
>>  endif
>>  
>> +ifeq ($(BR2_SSP_REGULAR),y)
>> +ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ENABLE_STACK_PROTECTOR=default
>> +endif
>> +
>> +ifeq ($(BR2_SSP_STRONG),y)
>> +ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ENABLE_STACK_PROTECTOR=strong
>> +endif
>> +
>> +ifeq ($(BR2_SSP_ALL),y)
>> +ARM_TRUSTED_FIRMWARE_MAKE_OPTS += ENABLE_STACK_PROTECTOR=all
>> +endif
> 
> It looks like the toolchain wrapper does that already. See
> toolchain/toolchain-wrapper.mk. Are you sure this is needed?

Hi Baruch,

I don't see this functionality there.

Note, that you need two things for getting the stack protector working:

1) Toolchain to emit additional code requiring external symbols
2) Runtime that provides the required external symbols

The toolchain wrapper correctly addresses 1) by providing "-fstack-protector*" flags
and your libc will then provide the required symbols for 2).
However, TF-A does not link against libc and requires these build flags
(ENABLE_STACK_PROTECTOR=x) in order to emit the required symbols.

BR
Christoph

  reply	other threads:[~2020-11-21 17:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20 21:29 [Buildroot] [PATCH 1/1] boot/arm-trusted-firmware: Forward stack protection configuration Christoph Müllner
2020-11-21 16:59 ` Baruch Siach
2020-11-21 17:28   ` Christoph Müllner [this message]
2020-11-21 17:49     ` Baruch Siach
2020-11-20 21:35 Christoph Müllner
2020-11-22 14:37 Christoph Müllner

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=d2e4f4d0-c3b1-71de-dbfd-b80ba5235ca2@theobroma-systems.com \
    --to=christoph.muellner@theobroma-systems.com \
    --cc=buildroot@busybox.net \
    /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.