public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/1] BaseTools: disable stack protector (gcc, AARCH64)
@ 2022-04-19 14:46 Oliver Steffen
  2022-04-19 14:46 ` [PATCH 1/1] " Oliver Steffen
  0 siblings, 1 reply; 4+ messages in thread
From: Oliver Steffen @ 2022-04-19 14:46 UTC (permalink / raw)
  To: devel; +Cc: bob.c.feng, gaoliming, yuwei.chen, Oliver Steffen

PR: https://github.com/tianocore/edk2/pull/2795

Explicity disable the stack protection with
-fno-stack-protection for builds using GCC on
AARCH64.

The gcc on Ubuntu enables -fstack-protector-strong
by default starting with Ubuntu 21.10.

GenFw fails if stack protection is enabled.

Oliver Steffen (1):
  BaseTools: disable stack protector (gcc, AARCH64)

 BaseTools/Conf/tools_def.template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] BaseTools: disable stack protector (gcc, AARCH64)
  2022-04-19 14:46 [PATCH 0/1] BaseTools: disable stack protector (gcc, AARCH64) Oliver Steffen
@ 2022-04-19 14:46 ` Oliver Steffen
  2022-04-19 23:36   ` 回复: [edk2-devel] " gaoliming
  0 siblings, 1 reply; 4+ messages in thread
From: Oliver Steffen @ 2022-04-19 14:46 UTC (permalink / raw)
  To: devel; +Cc: bob.c.feng, gaoliming, yuwei.chen, Oliver Steffen

Explicity disable the stack protection with
-fno-stack-protection for builds using GCC on
AARCH64.

The gcc on Ubuntu enables -fstack-protector-strong
by default starting with Ubuntu 21.10.

GenFw fails if stack protection is enabled.

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
---
 BaseTools/Conf/tools_def.template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index 9c310cf23d25..bd3edf0d219b 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -1872,7 +1872,7 @@ DEFINE GCC_IA32_CC_FLAGS           = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -
 DEFINE GCC_X64_CC_FLAGS            = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address -mno-stack-arg-probe
 DEFINE GCC_ARM_CC_FLAGS            = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=soft -fno-pic -fno-pie
 DEFINE GCC_ARM_CC_XIPFLAGS         = -mno-unaligned-access
-DEFINE GCC_AARCH64_CC_FLAGS        = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char  -ffunction-sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie -ffixed-x18
+DEFINE GCC_AARCH64_CC_FLAGS        = DEF(GCC_ALL_CC_FLAGS) -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char  -ffunction-sections -fdata-sections -Wno-address -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie -ffixed-x18 -fno-stack-protector
 DEFINE GCC_AARCH64_CC_XIPFLAGS     = -mstrict-align -mgeneral-regs-only
 DEFINE GCC_DLINK_FLAGS_COMMON      = -nostdlib --pie
 DEFINE GCC_DLINK2_FLAGS_COMMON     = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* 回复: [edk2-devel] [PATCH 1/1] BaseTools: disable stack protector (gcc, AARCH64)
  2022-04-19 14:46 ` [PATCH 1/1] " Oliver Steffen
@ 2022-04-19 23:36   ` gaoliming
  2022-04-20  7:39     ` Oliver Steffen
  0 siblings, 1 reply; 4+ messages in thread
From: gaoliming @ 2022-04-19 23:36 UTC (permalink / raw)
  To: devel, osteffen; +Cc: bob.c.feng, yuwei.chen

GCC Stack Protector options come from GCC4.9.3. But, there is GCC48 in
tools_def. I am not sure whether GCC48 is still used.

Thanks
Liming

> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Oliver Steffen
> 发送时间: 2022年4月19日 22:47
> 收件人: devel@edk2.groups.io
> 抄送: bob.c.feng@intel.com; gaoliming@byosoft.com.cn;
> yuwei.chen@intel.com; Oliver Steffen <osteffen@redhat.com>
> 主题: [edk2-devel] [PATCH 1/1] BaseTools: disable stack protector (gcc,
> AARCH64)
> 
> Explicity disable the stack protection with
> -fno-stack-protection for builds using GCC on
> AARCH64.
> 
> The gcc on Ubuntu enables -fstack-protector-strong
> by default starting with Ubuntu 21.10.
> 
> GenFw fails if stack protection is enabled.
> 
> Signed-off-by: Oliver Steffen <osteffen@redhat.com>
> ---
>  BaseTools/Conf/tools_def.template | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Conf/tools_def.template
> b/BaseTools/Conf/tools_def.template
> index 9c310cf23d25..bd3edf0d219b 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -1872,7 +1872,7 @@ DEFINE GCC_IA32_CC_FLAGS           =
> DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -
>  DEFINE GCC_X64_CC_FLAGS            = DEF(GCC_ALL_CC_FLAGS)
> -mno-red-zone -Wno-address -mno-stack-arg-probe
>  DEFINE GCC_ARM_CC_FLAGS            = DEF(GCC_ALL_CC_FLAGS)
> -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char
> -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address
> -mthumb -mfloat-abi=soft -fno-pic -fno-pie
>  DEFINE GCC_ARM_CC_XIPFLAGS         = -mno-unaligned-access
> -DEFINE GCC_AARCH64_CC_FLAGS        = DEF(GCC_ALL_CC_FLAGS)
> -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char
> -ffunction-sections -fdata-sections -Wno-address
> -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie
> -ffixed-x18
> +DEFINE GCC_AARCH64_CC_FLAGS        = DEF(GCC_ALL_CC_FLAGS)
> -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char
> -ffunction-sections -fdata-sections -Wno-address
> -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie
> -ffixed-x18 -fno-stack-protector
>  DEFINE GCC_AARCH64_CC_XIPFLAGS     = -mstrict-align
> -mgeneral-regs-only
>  DEFINE GCC_DLINK_FLAGS_COMMON      = -nostdlib --pie
>  DEFINE GCC_DLINK2_FLAGS_COMMON     =
> -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
> --
> 2.35.1
> 
> 
> 
> 
> 




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 回复: [edk2-devel] [PATCH 1/1] BaseTools: disable stack protector (gcc, AARCH64)
  2022-04-19 23:36   ` 回复: [edk2-devel] " gaoliming
@ 2022-04-20  7:39     ` Oliver Steffen
  0 siblings, 0 replies; 4+ messages in thread
From: Oliver Steffen @ 2022-04-20  7:39 UTC (permalink / raw)
  To: devel, gaoliming; +Cc: bob.c.feng, yuwei.chen

On 20.04.2022 07:36, gaoliming wrote:
>GCC Stack Protector options come from GCC4.9.3. But, there is GCC48 in
>tools_def. I am not sure whether GCC48 is still used.

A valid point.

GCC 4.8 accepts -fno-stack-protector.
For IA32 and X64 this option is set in GCC48_$ARCH_CC_FLAGS.
Setting it for AARCH64 starting with GCC4.8 would be more consistent
than setting it for all versions by default.

Cheers,
  Oliver

>
>Thanks
>Liming
>
>> -----邮件原件-----
>> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Oliver Steffen
>> 发送时间: 2022年4月19日 22:47
>> 收件人: devel@edk2.groups.io
>> 抄送: bob.c.feng@intel.com; gaoliming@byosoft.com.cn;
>> yuwei.chen@intel.com; Oliver Steffen <osteffen@redhat.com>
>> 主题: [edk2-devel] [PATCH 1/1] BaseTools: disable stack protector (gcc,
>> AARCH64)
>>
>> Explicity disable the stack protection with
>> -fno-stack-protection for builds using GCC on
>> AARCH64.
>>
>> The gcc on Ubuntu enables -fstack-protector-strong
>> by default starting with Ubuntu 21.10.
>>
>> GenFw fails if stack protection is enabled.
>>
>> Signed-off-by: Oliver Steffen <osteffen@redhat.com>
>> ---
>>  BaseTools/Conf/tools_def.template | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/BaseTools/Conf/tools_def.template
>> b/BaseTools/Conf/tools_def.template
>> index 9c310cf23d25..bd3edf0d219b 100755
>> --- a/BaseTools/Conf/tools_def.template
>> +++ b/BaseTools/Conf/tools_def.template
>> @@ -1872,7 +1872,7 @@ DEFINE GCC_IA32_CC_FLAGS           =
>> DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -
>>  DEFINE GCC_X64_CC_FLAGS            = DEF(GCC_ALL_CC_FLAGS)
>> -mno-red-zone -Wno-address -mno-stack-arg-probe
>>  DEFINE GCC_ARM_CC_FLAGS            = DEF(GCC_ALL_CC_FLAGS)
>> -mlittle-endian -mabi=aapcs -fno-short-enums -funsigned-char
>> -ffunction-sections -fdata-sections -fomit-frame-pointer -Wno-address
>> -mthumb -mfloat-abi=soft -fno-pic -fno-pie
>>  DEFINE GCC_ARM_CC_XIPFLAGS         = -mno-unaligned-access
>> -DEFINE GCC_AARCH64_CC_FLAGS        = DEF(GCC_ALL_CC_FLAGS)
>> -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char
>> -ffunction-sections -fdata-sections -Wno-address
>> -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie
>> -ffixed-x18
>> +DEFINE GCC_AARCH64_CC_FLAGS        = DEF(GCC_ALL_CC_FLAGS)
>> -mlittle-endian -fno-short-enums -fverbose-asm -funsigned-char
>> -ffunction-sections -fdata-sections -Wno-address
>> -fno-asynchronous-unwind-tables -fno-unwind-tables -fno-pic -fno-pie
>> -ffixed-x18 -fno-stack-protector
>>  DEFINE GCC_AARCH64_CC_XIPFLAGS     = -mstrict-align
>> -mgeneral-regs-only
>>  DEFINE GCC_DLINK_FLAGS_COMMON      = -nostdlib --pie
>>  DEFINE GCC_DLINK2_FLAGS_COMMON     =
>> -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/GccBase.lds
>> --
>> 2.35.1
>>
>>
>>
>>
>>
>
>
>
>
>
>
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-20  7:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-19 14:46 [PATCH 0/1] BaseTools: disable stack protector (gcc, AARCH64) Oliver Steffen
2022-04-19 14:46 ` [PATCH 1/1] " Oliver Steffen
2022-04-19 23:36   ` 回复: [edk2-devel] " gaoliming
2022-04-20  7:39     ` Oliver Steffen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox