[PATCH] meson: Use -fno-sanitize=function when available

Akihiko Odaki posted 1 patch 5 months, 2 weeks ago
meson.build                | 1 +
.gitlab-ci.d/buildtest.yml | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
[PATCH] meson: Use -fno-sanitize=function when available
Posted by Akihiko Odaki 5 months, 2 weeks ago
Commit 23ef50ae2d0c (".gitlab-ci.d/buildtest.yml: Use
-fno-sanitize=function in the clang-system job") adds
-fno-sanitize=function for the CI but doesn't add the flag in the
other context. Move it to meson.build.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 meson.build                | 1 +
 .gitlab-ci.d/buildtest.yml | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 6a93da48e1b5..80447833f07a 100644
--- a/meson.build
+++ b/meson.build
@@ -609,6 +609,7 @@ if host_os != 'openbsd' and \
 endif
 
 qemu_common_flags += cc.get_supported_arguments(hardening_flags)
+qemu_common_flags += cc.get_supported_arguments('-fno-sanitize=function')
 
 add_global_arguments(qemu_common_flags, native: false, language: all_languages)
 add_global_link_arguments(qemu_ldflags, native: false, language: all_languages)
diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
index e3a0758bd9e5..a57822d65182 100644
--- a/.gitlab-ci.d/buildtest.yml
+++ b/.gitlab-ci.d/buildtest.yml
@@ -430,7 +430,6 @@ clang-system:
     IMAGE: fedora
     CONFIGURE_ARGS: --cc=clang --cxx=clang++
       --extra-cflags=-fsanitize=undefined --extra-cflags=-fno-sanitize-recover=undefined
-      --extra-cflags=-fno-sanitize=function
     TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu s390x-softmmu
     MAKE_CHECK_ARGS: check-qtest check-tcg
 

---
base-commit: f2cb4026fccfe073f84a4b440e41d3ed0c3134f6
change-id: 20240714-function-7d32c723abbc

Best regards,
-- 
Akihiko Odaki <akihiko.odaki@daynix.com>
Re: [PATCH] meson: Use -fno-sanitize=function when available
Posted by Paolo Bonzini 5 months, 2 weeks ago
Queued, thanks.

Paolo
Re: [PATCH] meson: Use -fno-sanitize=function when available
Posted by Alex Bennée 5 months, 2 weeks ago
Akihiko Odaki <akihiko.odaki@daynix.com> writes:

> Commit 23ef50ae2d0c (".gitlab-ci.d/buildtest.yml: Use
> -fno-sanitize=function in the clang-system job") adds
> -fno-sanitize=function for the CI but doesn't add the flag in the
> other context. Move it to meson.build.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
>  meson.build                | 1 +
>  .gitlab-ci.d/buildtest.yml | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meson.build b/meson.build
> index 6a93da48e1b5..80447833f07a 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -609,6 +609,7 @@ if host_os != 'openbsd' and \
>  endif
>  
>  qemu_common_flags += cc.get_supported_arguments(hardening_flags)
> +qemu_common_flags +=
>  cc.get_supported_arguments('-fno-sanitize=function')

What about checking the other hardening flags?

>  
>  add_global_arguments(qemu_common_flags, native: false, language: all_languages)
>  add_global_link_arguments(qemu_ldflags, native: false, language: all_languages)
> diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
> index e3a0758bd9e5..a57822d65182 100644
> --- a/.gitlab-ci.d/buildtest.yml
> +++ b/.gitlab-ci.d/buildtest.yml
> @@ -430,7 +430,6 @@ clang-system:
>      IMAGE: fedora
>      CONFIGURE_ARGS: --cc=clang --cxx=clang++
>        --extra-cflags=-fsanitize=undefined --extra-cflags=-fno-sanitize-recover=undefined
> -      --extra-cflags=-fno-sanitize=function
>      TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu s390x-softmmu
>      MAKE_CHECK_ARGS: check-qtest check-tcg
>  
>
> ---
> base-commit: f2cb4026fccfe073f84a4b440e41d3ed0c3134f6
> change-id: 20240714-function-7d32c723abbc
>
> Best regards,

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro
Re: [PATCH] meson: Use -fno-sanitize=function when available
Posted by Akihiko Odaki 5 months, 2 weeks ago
On 2024/07/15 16:10, Alex Bennée wrote:
> Akihiko Odaki <akihiko.odaki@daynix.com> writes:
> 
>> Commit 23ef50ae2d0c (".gitlab-ci.d/buildtest.yml: Use
>> -fno-sanitize=function in the clang-system job") adds
>> -fno-sanitize=function for the CI but doesn't add the flag in the
>> other context. Move it to meson.build.
>>
>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>> ---
>>   meson.build                | 1 +
>>   .gitlab-ci.d/buildtest.yml | 1 -
>>   2 files changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/meson.build b/meson.build
>> index 6a93da48e1b5..80447833f07a 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -609,6 +609,7 @@ if host_os != 'openbsd' and \
>>   endif
>>   
>>   qemu_common_flags += cc.get_supported_arguments(hardening_flags)
>> +qemu_common_flags +=
>>   cc.get_supported_arguments('-fno-sanitize=function')
> 
> What about checking the other hardening flags?

-fsanitize=function is the only hardening flag that we decided to 
disable for now. Context:
https://lore.kernel.org/qemu-devel/618857e6-dd88-4834-af1b-561228fd7dc1@redhat.com/