diff mbox series

Config.in: disable Fortify Source for microblaze

Message ID 20210820225341.1131147-1-romain.naour@gmail.com
State Accepted
Headers show
Series Config.in: disable Fortify Source for microblaze | expand

Commit Message

Romain Naour Aug. 20, 2021, 10:53 p.m. UTC
As reported by Toolchain-builder project [1], the system doesn't
boot when Fortify Source is enabled for glibc based toolchain
(the init process hang).

Also, hardening features may not be wanted or possible for such
slow soft-core cpus [2].

[1] https://gitlab.com/bootlin/toolchains-builder/-/jobs/1467624500
[2] http://lists.busybox.net/pipermail/buildroot/2021-June/312416.html

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
With BR2_RELRO_PARTIAL enabled, the system boot.
---
 Config.in | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Giulio Benetti Aug. 20, 2021, 10:59 p.m. UTC | #1
Hi Romain, All,

On 8/21/21 12:53 AM, Romain Naour wrote:
> As reported by Toolchain-builder project [1], the system doesn't
> boot when Fortify Source is enabled for glibc based toolchain
> (the init process hang).
> 
> Also, hardening features may not be wanted or possible for such
> slow soft-core cpus [2].
> 
> [1] https://gitlab.com/bootlin/toolchains-builder/-/jobs/1467624500
> [2] http://lists.busybox.net/pipermail/buildroot/2021-June/312416.html
> 
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
> With BR2_RELRO_PARTIAL enabled, the system boot.
> ---
>   Config.in | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/Config.in b/Config.in
> index 2ef5d407e4..84f7fa6e8d 100644
> --- a/Config.in
> +++ b/Config.in
> @@ -853,9 +853,16 @@ endchoice
>   comment "RELocation Read Only (RELRO) needs shared libraries"
>   	depends on !BR2_SHARED_LIBS
>   
> +config BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
> +	bool
> +	default y
> +	# Microblaze glibc toolchains don't work with Fortify Source enabled > +	depends on !BR2_microblaze

here you say it doesn't work with glibc toolchains, so you could add 
'&& !BR2_TOOLCHAIN_USES_GLIBC'. I think it's worth if it works with 
uclibc and musl.

What do you think about it?

Best regards
Giulio Benetti Aug. 20, 2021, 11:09 p.m. UTC | #2
On 8/21/21 12:59 AM, Giulio Benetti wrote:
> Hi Romain, All,
> 
> On 8/21/21 12:53 AM, Romain Naour wrote:
>> As reported by Toolchain-builder project [1], the system doesn't
>> boot when Fortify Source is enabled for glibc based toolchain
>> (the init process hang).
>>
>> Also, hardening features may not be wanted or possible for such
>> slow soft-core cpus [2].
>>
>> [1] https://gitlab.com/bootlin/toolchains-builder/-/jobs/1467624500
>> [2] http://lists.busybox.net/pipermail/buildroot/2021-June/312416.html
>>
>> Signed-off-by: Romain Naour <romain.naour@gmail.com>
>> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
>> Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> ---
>> With BR2_RELRO_PARTIAL enabled, the system boot.
>> ---
>>    Config.in | 7 +++++++
>>    1 file changed, 7 insertions(+)
>>
>> diff --git a/Config.in b/Config.in
>> index 2ef5d407e4..84f7fa6e8d 100644
>> --- a/Config.in
>> +++ b/Config.in
>> @@ -853,9 +853,16 @@ endchoice
>>    comment "RELocation Read Only (RELRO) needs shared libraries"
>>    	depends on !BR2_SHARED_LIBS
>>    
>> +config BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
>> +	bool
>> +	default y
>> +	# Microblaze glibc toolchains don't work with Fortify Source enabled > +	depends on !BR2_microblaze
> 
> here you say it doesn't work with glibc toolchains, so you could add
> '&& !BR2_TOOLCHAIN_USES_GLIBC'. I think it's worth if it works with
> uclibc and musl.

Of course between parenthesis like:
```
depends on (!BR2_microblaze && !BR2_TOOLCHAIN_USES_GLIBC)
```
otherwise every toolchain which uses glibc doesn't use Fortify anymore.

> What do you think about it?
> 
> Best regards
>
Romain Naour Aug. 21, 2021, 12:46 p.m. UTC | #3
Hello Giulio,

Le 21/08/2021 à 01:09, Giulio Benetti a écrit :
> On 8/21/21 12:59 AM, Giulio Benetti wrote:
>> Hi Romain, All,
>>
>> On 8/21/21 12:53 AM, Romain Naour wrote:
>>> As reported by Toolchain-builder project [1], the system doesn't
>>> boot when Fortify Source is enabled for glibc based toolchain
>>> (the init process hang).
>>>
>>> Also, hardening features may not be wanted or possible for such
>>> slow soft-core cpus [2].
>>>
>>> [1] https://gitlab.com/bootlin/toolchains-builder/-/jobs/1467624500
>>> [2] http://lists.busybox.net/pipermail/buildroot/2021-June/312416.html
>>>
>>> Signed-off-by: Romain Naour <romain.naour@gmail.com>
>>> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
>>> Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
>>> ---
>>> With BR2_RELRO_PARTIAL enabled, the system boot.
>>> ---
>>>    Config.in | 7 +++++++
>>>    1 file changed, 7 insertions(+)
>>>
>>> diff --git a/Config.in b/Config.in
>>> index 2ef5d407e4..84f7fa6e8d 100644
>>> --- a/Config.in
>>> +++ b/Config.in
>>> @@ -853,9 +853,16 @@ endchoice
>>>    comment "RELocation Read Only (RELRO) needs shared libraries"
>>>        depends on !BR2_SHARED_LIBS
>>>    +config BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
>>> +    bool
>>> +    default y
>>> +    # Microblaze glibc toolchains don't work with Fortify Source enabled >
>>> +    depends on !BR2_microblaze
>>
>> here you say it doesn't work with glibc toolchains, so you could add
>> '&& !BR2_TOOLCHAIN_USES_GLIBC'. I think it's worth if it works with
>> uclibc and musl.
> 
> Of course between parenthesis like:
> ```
> depends on (!BR2_microblaze && !BR2_TOOLCHAIN_USES_GLIBC)
> ```
> otherwise every toolchain which uses glibc doesn't use Fortify anymore.
> 
>> What do you think about it?

Fortify Source is disabled for the same reason as for PIC/PIE even for uClibc-ng
or musl:

https://git.buildroot.net/buildroot/commit/?id=d120f844604da2295bb7bd8fc6c1f4efbe8b5792

I want to avoid the maintenance burden on such platform.

Best regards,
Romain

>>
>> Best regards
>>
>
Giulio Benetti Aug. 21, 2021, 1:42 p.m. UTC | #4
> Il giorno 21 ago 2021, alle ore 14:47, Romain Naour <romain.naour@gmail.com> ha scritto:
> 
> Hello Giulio,
> 
>> Le 21/08/2021 à 01:09, Giulio Benetti a écrit :
>>> On 8/21/21 12:59 AM, Giulio Benetti wrote:
>>> Hi Romain, All,
>>> 
>>> On 8/21/21 12:53 AM, Romain Naour wrote:
>>>> As reported by Toolchain-builder project [1], the system doesn't
>>>> boot when Fortify Source is enabled for glibc based toolchain
>>>> (the init process hang).
>>>> 
>>>> Also, hardening features may not be wanted or possible for such
>>>> slow soft-core cpus [2].
>>>> 
>>>> [1] https://gitlab.com/bootlin/toolchains-builder/-/jobs/1467624500
>>>> [2] http://lists.busybox.net/pipermail/buildroot/2021-June/312416.html
>>>> 
>>>> Signed-off-by: Romain Naour <romain.naour@gmail.com>
>>>> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
>>>> Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
>>>> ---
>>>> With BR2_RELRO_PARTIAL enabled, the system boot.
>>>> ---
>>>>    Config.in | 7 +++++++
>>>>    1 file changed, 7 insertions(+)
>>>> 
>>>> diff --git a/Config.in b/Config.in
>>>> index 2ef5d407e4..84f7fa6e8d 100644
>>>> --- a/Config.in
>>>> +++ b/Config.in
>>>> @@ -853,9 +853,16 @@ endchoice
>>>>    comment "RELocation Read Only (RELRO) needs shared libraries"
>>>>        depends on !BR2_SHARED_LIBS
>>>>    +config BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
>>>> +    bool
>>>> +    default y
>>>> +    # Microblaze glibc toolchains don't work with Fortify Source enabled >
>>>> +    depends on !BR2_microblaze
>>> 
>>> here you say it doesn't work with glibc toolchains, so you could add
>>> '&& !BR2_TOOLCHAIN_USES_GLIBC'. I think it's worth if it works with
>>> uclibc and musl.
>> 
>> Of course between parenthesis like:
>> ```
>> depends on (!BR2_microblaze && !BR2_TOOLCHAIN_USES_GLIBC)
>> ```
>> otherwise every toolchain which uses glibc doesn't use Fortify anymore.
>> 
>>> What do you think about it?
> 
> Fortify Source is disabled for the same reason as for PIC/PIE even for uClibc-ng
> or musl:
> 
> https://git.buildroot.net/buildroot/commit/?id=d120f844604da2295bb7bd8fc6c1f4efbe8b5792
> 
> I want to avoid the maintenance burden on such platform.

Ah ok, I’ve understood wrongly by the comment mentioning glibc only.

No problem then.

Best regards
Giulio Benetti

> 
> Best regards,
> Romain
> 
>>> 
>>> Best regards
>>> 
>> 
>
Arnout Vandecappelle Aug. 23, 2021, 9:09 p.m. UTC | #5
On 21/08/2021 00:53, Romain Naour wrote:
> As reported by Toolchain-builder project [1], the system doesn't
> boot when Fortify Source is enabled for glibc based toolchain
> (the init process hang).
> 
> Also, hardening features may not be wanted or possible for such
> slow soft-core cpus [2].
> 
> [1] https://gitlab.com/bootlin/toolchains-builder/-/jobs/1467624500
> [2] http://lists.busybox.net/pipermail/buildroot/2021-June/312416.html
> 
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>

 Applied to master, thanks. I reworded the commit message to avoid Giulio's
confusion.

 Also, I added a dependency on BR2_FORTIFY_SOURCE_ARCH_SUPPORTS in the comment
that glibc and optimisation are needed.

 Regards,
 Arnout

> ---
> With BR2_RELRO_PARTIAL enabled, the system boot.
> ---
>  Config.in | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/Config.in b/Config.in
> index 2ef5d407e4..84f7fa6e8d 100644
> --- a/Config.in
> +++ b/Config.in
> @@ -853,9 +853,16 @@ endchoice
>  comment "RELocation Read Only (RELRO) needs shared libraries"
>  	depends on !BR2_SHARED_LIBS
>  
> +config BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
> +	bool
> +	default y
> +	# Microblaze glibc toolchains don't work with Fortify Source enabled
> +	depends on !BR2_microblaze
> +
>  choice
>  	bool "Buffer-overflow Detection (FORTIFY_SOURCE)"
>  	default BR2_FORTIFY_SOURCE_1
> +	depends on BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
>  	depends on BR2_TOOLCHAIN_USES_GLIBC
>  	depends on !BR2_OPTIMIZE_0
>  	help
>
Peter Korsgaard Sept. 6, 2021, 3:36 p.m. UTC | #6
>>>>> "Romain" == Romain Naour <romain.naour@gmail.com> writes:

 > As reported by Toolchain-builder project [1], the system doesn't
 > boot when Fortify Source is enabled for glibc based toolchain
 > (the init process hang).

 > Also, hardening features may not be wanted or possible for such
 > slow soft-core cpus [2].

 > [1] https://gitlab.com/bootlin/toolchains-builder/-/jobs/1467624500
 > [2] http://lists.busybox.net/pipermail/buildroot/2021-June/312416.html

 > Signed-off-by: Romain Naour <romain.naour@gmail.com>
 > Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 > Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>

Committed to 2021.02.x and 2021.05.x, thanks.
diff mbox series

Patch

diff --git a/Config.in b/Config.in
index 2ef5d407e4..84f7fa6e8d 100644
--- a/Config.in
+++ b/Config.in
@@ -853,9 +853,16 @@  endchoice
 comment "RELocation Read Only (RELRO) needs shared libraries"
 	depends on !BR2_SHARED_LIBS
 
+config BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
+	bool
+	default y
+	# Microblaze glibc toolchains don't work with Fortify Source enabled
+	depends on !BR2_microblaze
+
 choice
 	bool "Buffer-overflow Detection (FORTIFY_SOURCE)"
 	default BR2_FORTIFY_SOURCE_1
+	depends on BR2_FORTIFY_SOURCE_ARCH_SUPPORTS
 	depends on BR2_TOOLCHAIN_USES_GLIBC
 	depends on !BR2_OPTIMIZE_0
 	help