* [PATCH v3] meson: Use -fno-sanitize=function when available
@ 2024-08-16 6:22 Akihiko Odaki
2024-08-16 7:03 ` Thomas Huth
0 siblings, 1 reply; 13+ messages in thread
From: Akihiko Odaki @ 2024-08-16 6:22 UTC (permalink / raw)
To: Alex Bennée, Philippe Mathieu-Daudé, Thomas Huth,
Wainer dos Santos Moschetta, Beraldo Leal, Paolo Bonzini,
Marc-André Lureau, Daniel P. Berrangé
Cc: qemu-devel, Akihiko Odaki
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. Add it to meson.build for such. It is not removed from
.gitlab-ci.d/buildtest.yml because -fno-sanitize=function in meson.build
does not affect --extra-cflags due to argument ordering.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
Changes in v3:
- I was not properly dropping the change of .gitlab-ci.d/buildtest.yml
but only updated the message. v3 fixes this. (Thomas Huth)
- Link to v2: https://lore.kernel.org/r/20240729-function-v2-1-2401ab18b30b@daynix.com
Changes in v2:
- Dropped the change of: .gitlab-ci.d/buildtest.yml
- Link to v1: https://lore.kernel.org/r/20240714-function-v1-1-cc2acb4171ba@daynix.com
---
meson.build | 1 +
1 file changed, 1 insertion(+)
diff --git a/meson.build b/meson.build
index 5613b62a4f42..a4169c572ba9 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)
---
base-commit: 93b799fafd9170da3a79a533ea6f73a18de82e22
change-id: 20240714-function-7d32c723abbc
Best regards,
--
Akihiko Odaki <akihiko.odaki@daynix.com>
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v3] meson: Use -fno-sanitize=function when available
2024-08-16 6:22 [PATCH v3] meson: Use -fno-sanitize=function when available Akihiko Odaki
@ 2024-08-16 7:03 ` Thomas Huth
2024-08-16 7:12 ` Akihiko Odaki
0 siblings, 1 reply; 13+ messages in thread
From: Thomas Huth @ 2024-08-16 7:03 UTC (permalink / raw)
To: Akihiko Odaki, Alex Bennée, Philippe Mathieu-Daudé,
Wainer dos Santos Moschetta, Beraldo Leal, Paolo Bonzini,
Marc-André Lureau, Daniel P. Berrangé
Cc: qemu-devel
On 16/08/2024 08.22, Akihiko Odaki wrote:
> 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. Add it to meson.build for such. It is not removed from
> .gitlab-ci.d/buildtest.yml because -fno-sanitize=function in meson.build
> does not affect --extra-cflags due to argument ordering.
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> Changes in v3:
> - I was not properly dropping the change of .gitlab-ci.d/buildtest.yml
> but only updated the message. v3 fixes this. (Thomas Huth)
> - Link to v2: https://lore.kernel.org/r/20240729-function-v2-1-2401ab18b30b@daynix.com
>
> Changes in v2:
> - Dropped the change of: .gitlab-ci.d/buildtest.yml
> - Link to v1: https://lore.kernel.org/r/20240714-function-v1-1-cc2acb4171ba@daynix.com
> ---
> meson.build | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/meson.build b/meson.build
> index 5613b62a4f42..a4169c572ba9 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')
As I mentioned in my last mail: I think it would make sense to move this at
the end of the "if get_option('tsan')" block in meson.build, since this
apparently only fixes the use of "--enable-sanitizers", and cannot fix the
"--extra-cflags" that a user might have specified?
Thomas
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] meson: Use -fno-sanitize=function when available
2024-08-16 7:03 ` Thomas Huth
@ 2024-08-16 7:12 ` Akihiko Odaki
2024-08-16 7:27 ` Thomas Huth
0 siblings, 1 reply; 13+ messages in thread
From: Akihiko Odaki @ 2024-08-16 7:12 UTC (permalink / raw)
To: Thomas Huth, Alex Bennée, Philippe Mathieu-Daudé,
Wainer dos Santos Moschetta, Beraldo Leal, Paolo Bonzini,
Marc-André Lureau, Daniel P. Berrangé
Cc: qemu-devel
On 2024/08/16 16:03, Thomas Huth wrote:
> On 16/08/2024 08.22, Akihiko Odaki wrote:
>> 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. Add it to meson.build for such. It is not removed from
>> .gitlab-ci.d/buildtest.yml because -fno-sanitize=function in meson.build
>> does not affect --extra-cflags due to argument ordering.
>>
>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>> ---
>> Changes in v3:
>> - I was not properly dropping the change of .gitlab-ci.d/buildtest.yml
>> but only updated the message. v3 fixes this. (Thomas Huth)
>> - Link to v2:
>> https://lore.kernel.org/r/20240729-function-v2-1-2401ab18b30b@daynix.com
>>
>> Changes in v2:
>> - Dropped the change of: .gitlab-ci.d/buildtest.yml
>> - Link to v1:
>> https://lore.kernel.org/r/20240714-function-v1-1-cc2acb4171ba@daynix.com
>> ---
>> meson.build | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/meson.build b/meson.build
>> index 5613b62a4f42..a4169c572ba9 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')
>
> As I mentioned in my last mail: I think it would make sense to move this
> at the end of the "if get_option('tsan')" block in meson.build, since
> this apparently only fixes the use of "--enable-sanitizers", and cannot
> fix the "--extra-cflags" that a user might have specified?
Sorry, I missed it. It cannot fix --extra-cflags, but it should be able
to fix compiler flags specified by compiler distributor.
Regards,
Akihiko Odaki
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] meson: Use -fno-sanitize=function when available
2024-08-16 7:12 ` Akihiko Odaki
@ 2024-08-16 7:27 ` Thomas Huth
2024-08-16 7:30 ` Akihiko Odaki
2024-08-16 8:05 ` Richard Henderson
0 siblings, 2 replies; 13+ messages in thread
From: Thomas Huth @ 2024-08-16 7:27 UTC (permalink / raw)
To: Akihiko Odaki, Alex Bennée, Philippe Mathieu-Daudé,
Wainer dos Santos Moschetta, Beraldo Leal, Paolo Bonzini,
Marc-André Lureau, Daniel P. Berrangé
Cc: qemu-devel
On 16/08/2024 09.12, Akihiko Odaki wrote:
> On 2024/08/16 16:03, Thomas Huth wrote:
>> On 16/08/2024 08.22, Akihiko Odaki wrote:
>>> 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. Add it to meson.build for such. It is not removed from
>>> .gitlab-ci.d/buildtest.yml because -fno-sanitize=function in meson.build
>>> does not affect --extra-cflags due to argument ordering.
>>>
>>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>>> ---
>>> Changes in v3:
>>> - I was not properly dropping the change of .gitlab-ci.d/buildtest.yml
>>> but only updated the message. v3 fixes this. (Thomas Huth)
>>> - Link to v2:
>>> https://lore.kernel.org/r/20240729-function-v2-1-2401ab18b30b@daynix.com
>>>
>>> Changes in v2:
>>> - Dropped the change of: .gitlab-ci.d/buildtest.yml
>>> - Link to v1:
>>> https://lore.kernel.org/r/20240714-function-v1-1-cc2acb4171ba@daynix.com
>>> ---
>>> meson.build | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/meson.build b/meson.build
>>> index 5613b62a4f42..a4169c572ba9 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')
>>
>> As I mentioned in my last mail: I think it would make sense to move this
>> at the end of the "if get_option('tsan')" block in meson.build, since this
>> apparently only fixes the use of "--enable-sanitizers", and cannot fix the
>> "--extra-cflags" that a user might have specified?
>
> Sorry, I missed it. It cannot fix --extra-cflags, but it should be able to
> fix compiler flags specified by compiler distributor.
Oh, you mean that there are distros that enable -fsanitize=function by
default? Can you name one? If so, I think that information should go into
the patch description...?
Thomas
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] meson: Use -fno-sanitize=function when available
2024-08-16 7:27 ` Thomas Huth
@ 2024-08-16 7:30 ` Akihiko Odaki
2024-08-16 8:03 ` Thomas Huth
2024-08-16 8:05 ` Richard Henderson
1 sibling, 1 reply; 13+ messages in thread
From: Akihiko Odaki @ 2024-08-16 7:30 UTC (permalink / raw)
To: Thomas Huth, Alex Bennée, Philippe Mathieu-Daudé,
Wainer dos Santos Moschetta, Beraldo Leal, Paolo Bonzini,
Marc-André Lureau, Daniel P. Berrangé
Cc: qemu-devel
On 2024/08/16 16:27, Thomas Huth wrote:
> On 16/08/2024 09.12, Akihiko Odaki wrote:
>> On 2024/08/16 16:03, Thomas Huth wrote:
>>> On 16/08/2024 08.22, Akihiko Odaki wrote:
>>>> 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. Add it to meson.build for such. It is not removed from
>>>> .gitlab-ci.d/buildtest.yml because -fno-sanitize=function in
>>>> meson.build
>>>> does not affect --extra-cflags due to argument ordering.
>>>>
>>>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>>>> ---
>>>> Changes in v3:
>>>> - I was not properly dropping the change of .gitlab-ci.d/buildtest.yml
>>>> but only updated the message. v3 fixes this. (Thomas Huth)
>>>> - Link to v2:
>>>> https://lore.kernel.org/r/20240729-function-v2-1-2401ab18b30b@daynix.com
>>>>
>>>> Changes in v2:
>>>> - Dropped the change of: .gitlab-ci.d/buildtest.yml
>>>> - Link to v1:
>>>> https://lore.kernel.org/r/20240714-function-v1-1-cc2acb4171ba@daynix.com
>>>> ---
>>>> meson.build | 1 +
>>>> 1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/meson.build b/meson.build
>>>> index 5613b62a4f42..a4169c572ba9 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')
>>>
>>> As I mentioned in my last mail: I think it would make sense to move
>>> this at the end of the "if get_option('tsan')" block in meson.build,
>>> since this apparently only fixes the use of "--enable-sanitizers",
>>> and cannot fix the "--extra-cflags" that a user might have specified?
>>
>> Sorry, I missed it. It cannot fix --extra-cflags, but it should be
>> able to fix compiler flags specified by compiler distributor.
>
> Oh, you mean that there are distros that enable -fsanitize=function by
> default? Can you name one? If so, I think that information should go
> into the patch description...?
No, it is just a precaution.
Regards,
Akihiko Odaki
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] meson: Use -fno-sanitize=function when available
2024-08-16 7:30 ` Akihiko Odaki
@ 2024-08-16 8:03 ` Thomas Huth
2024-08-16 8:21 ` Akihiko Odaki
0 siblings, 1 reply; 13+ messages in thread
From: Thomas Huth @ 2024-08-16 8:03 UTC (permalink / raw)
To: Akihiko Odaki, Alex Bennée, Philippe Mathieu-Daudé,
Wainer dos Santos Moschetta, Beraldo Leal, Paolo Bonzini,
Marc-André Lureau, Daniel P. Berrangé
Cc: qemu-devel
On 16/08/2024 09.30, Akihiko Odaki wrote:
> On 2024/08/16 16:27, Thomas Huth wrote:
>> On 16/08/2024 09.12, Akihiko Odaki wrote:
>>> On 2024/08/16 16:03, Thomas Huth wrote:
>>>> On 16/08/2024 08.22, Akihiko Odaki wrote:
>>>>> 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. Add it to meson.build for such. It is not removed from
>>>>> .gitlab-ci.d/buildtest.yml because -fno-sanitize=function in meson.build
>>>>> does not affect --extra-cflags due to argument ordering.
>>>>>
>>>>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>>>>> ---
>>>>> Changes in v3:
>>>>> - I was not properly dropping the change of .gitlab-ci.d/buildtest.yml
>>>>> but only updated the message. v3 fixes this. (Thomas Huth)
>>>>> - Link to v2:
>>>>> https://lore.kernel.org/r/20240729-function-v2-1-2401ab18b30b@daynix.com
>>>>>
>>>>> Changes in v2:
>>>>> - Dropped the change of: .gitlab-ci.d/buildtest.yml
>>>>> - Link to v1:
>>>>> https://lore.kernel.org/r/20240714-function-v1-1-cc2acb4171ba@daynix.com
>>>>> ---
>>>>> meson.build | 1 +
>>>>> 1 file changed, 1 insertion(+)
>>>>>
>>>>> diff --git a/meson.build b/meson.build
>>>>> index 5613b62a4f42..a4169c572ba9 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')
>>>>
>>>> As I mentioned in my last mail: I think it would make sense to move this
>>>> at the end of the "if get_option('tsan')" block in meson.build, since
>>>> this apparently only fixes the use of "--enable-sanitizers", and cannot
>>>> fix the "--extra-cflags" that a user might have specified?
>>>
>>> Sorry, I missed it. It cannot fix --extra-cflags, but it should be able
>>> to fix compiler flags specified by compiler distributor.
>>
>> Oh, you mean that there are distros that enable -fsanitize=function by
>> default? Can you name one? If so, I think that information should go into
>> the patch description...?
>
> No, it is just a precaution.
Ok. I don't think any normal distro will enable this by default since this
impacts performance of the programs, so it's either the user specifying
--enable-sanitizers or the user specifying --extra-cflags="-fsanitize=...".
In the latter case, your patch does not help. In the former case, I think
this setting should go into the same code block as where we set
-fsanitize=undefined in our meson.build file, so that it is clear where it
belongs to.
Thomas
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] meson: Use -fno-sanitize=function when available
2024-08-16 7:27 ` Thomas Huth
2024-08-16 7:30 ` Akihiko Odaki
@ 2024-08-16 8:05 ` Richard Henderson
1 sibling, 0 replies; 13+ messages in thread
From: Richard Henderson @ 2024-08-16 8:05 UTC (permalink / raw)
To: qemu-devel
On 8/16/24 17:27, Thomas Huth wrote:
> On 16/08/2024 09.12, Akihiko Odaki wrote:
>> On 2024/08/16 16:03, Thomas Huth wrote:
>>> On 16/08/2024 08.22, Akihiko Odaki wrote:
>>>> 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. Add it to meson.build for such. It is not removed from
>>>> .gitlab-ci.d/buildtest.yml because -fno-sanitize=function in meson.build
>>>> does not affect --extra-cflags due to argument ordering.
>>>>
>>>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>>>> ---
>>>> Changes in v3:
>>>> - I was not properly dropping the change of .gitlab-ci.d/buildtest.yml
>>>> but only updated the message. v3 fixes this. (Thomas Huth)
>>>> - Link to v2: https://lore.kernel.org/r/20240729-function-v2-1-2401ab18b30b@daynix.com
>>>>
>>>> Changes in v2:
>>>> - Dropped the change of: .gitlab-ci.d/buildtest.yml
>>>> - Link to v1: https://lore.kernel.org/r/20240714-function-v1-1-cc2acb4171ba@daynix.com
>>>> ---
>>>> meson.build | 1 +
>>>> 1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/meson.build b/meson.build
>>>> index 5613b62a4f42..a4169c572ba9 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')
>>>
>>> As I mentioned in my last mail: I think it would make sense to move this at the end of
>>> the "if get_option('tsan')" block in meson.build, since this apparently only fixes the
>>> use of "--enable-sanitizers", and cannot fix the "--extra-cflags" that a user might
>>> have specified?
>>
>> Sorry, I missed it. It cannot fix --extra-cflags, but it should be able to fix compiler
>> flags specified by compiler distributor.
>
> Oh, you mean that there are distros that enable -fsanitize=function by default? Can you
> name one? If so, I think that information should go into the patch description...?
AFAICS, -fsanitize=function is enabled by -fsanitize=undefined.
Anyway, see also
https://lore.kernel.org/qemu-devel/20240813095216.306555-1-richard.henderson@linaro.org/
r~
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] meson: Use -fno-sanitize=function when available
2024-08-16 8:03 ` Thomas Huth
@ 2024-08-16 8:21 ` Akihiko Odaki
2024-08-16 8:24 ` Thomas Huth
0 siblings, 1 reply; 13+ messages in thread
From: Akihiko Odaki @ 2024-08-16 8:21 UTC (permalink / raw)
To: Thomas Huth, Alex Bennée, Philippe Mathieu-Daudé,
Wainer dos Santos Moschetta, Beraldo Leal, Paolo Bonzini,
Marc-André Lureau, Daniel P. Berrangé
Cc: qemu-devel
On 2024/08/16 17:03, Thomas Huth wrote:
> On 16/08/2024 09.30, Akihiko Odaki wrote:
>> On 2024/08/16 16:27, Thomas Huth wrote:
>>> On 16/08/2024 09.12, Akihiko Odaki wrote:
>>>> On 2024/08/16 16:03, Thomas Huth wrote:
>>>>> On 16/08/2024 08.22, Akihiko Odaki wrote:
>>>>>> 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. Add it to meson.build for such. It is not removed from
>>>>>> .gitlab-ci.d/buildtest.yml because -fno-sanitize=function in
>>>>>> meson.build
>>>>>> does not affect --extra-cflags due to argument ordering.
>>>>>>
>>>>>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>>>>>> ---
>>>>>> Changes in v3:
>>>>>> - I was not properly dropping the change of
>>>>>> .gitlab-ci.d/buildtest.yml
>>>>>> but only updated the message. v3 fixes this. (Thomas Huth)
>>>>>> - Link to v2:
>>>>>> https://lore.kernel.org/r/20240729-function-v2-1-2401ab18b30b@daynix.com
>>>>>>
>>>>>> Changes in v2:
>>>>>> - Dropped the change of: .gitlab-ci.d/buildtest.yml
>>>>>> - Link to v1:
>>>>>> https://lore.kernel.org/r/20240714-function-v1-1-cc2acb4171ba@daynix.com
>>>>>> ---
>>>>>> meson.build | 1 +
>>>>>> 1 file changed, 1 insertion(+)
>>>>>>
>>>>>> diff --git a/meson.build b/meson.build
>>>>>> index 5613b62a4f42..a4169c572ba9 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')
>>>>>
>>>>> As I mentioned in my last mail: I think it would make sense to move
>>>>> this at the end of the "if get_option('tsan')" block in
>>>>> meson.build, since this apparently only fixes the use of
>>>>> "--enable-sanitizers", and cannot fix the "--extra-cflags" that a
>>>>> user might have specified?
>>>>
>>>> Sorry, I missed it. It cannot fix --extra-cflags, but it should be
>>>> able to fix compiler flags specified by compiler distributor.
>>>
>>> Oh, you mean that there are distros that enable -fsanitize=function
>>> by default? Can you name one? If so, I think that information should
>>> go into the patch description...?
>>
>> No, it is just a precaution.
>
> Ok. I don't think any normal distro will enable this by default since
> this impacts performance of the programs, so it's either the user
> specifying --enable-sanitizers or the user specifying
> --extra-cflags="-fsanitize=...". In the latter case, your patch does not
> help. In the former case, I think this setting should go into the same
> code block as where we set -fsanitize=undefined in our meson.build file,
> so that it is clear where it belongs to.
It does not look like -fno-sanitize=function belongs to the code block
to me. Putting -fno-sanitize=function in the code block will make it
seem to say that we should disable function sanitizer because the user
requests to enable sanitizers, which makes little sense.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] meson: Use -fno-sanitize=function when available
2024-08-16 8:21 ` Akihiko Odaki
@ 2024-08-16 8:24 ` Thomas Huth
2024-08-16 8:27 ` Akihiko Odaki
0 siblings, 1 reply; 13+ messages in thread
From: Thomas Huth @ 2024-08-16 8:24 UTC (permalink / raw)
To: Akihiko Odaki, Alex Bennée, Philippe Mathieu-Daudé,
Wainer dos Santos Moschetta, Beraldo Leal, Paolo Bonzini,
Marc-André Lureau, Daniel P. Berrangé
Cc: qemu-devel
On 16/08/2024 10.21, Akihiko Odaki wrote:
> On 2024/08/16 17:03, Thomas Huth wrote:
>> On 16/08/2024 09.30, Akihiko Odaki wrote:
>>> On 2024/08/16 16:27, Thomas Huth wrote:
>>>> On 16/08/2024 09.12, Akihiko Odaki wrote:
>>>>> On 2024/08/16 16:03, Thomas Huth wrote:
>>>>>> On 16/08/2024 08.22, Akihiko Odaki wrote:
>>>>>>> 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. Add it to meson.build for such. It is not removed from
>>>>>>> .gitlab-ci.d/buildtest.yml because -fno-sanitize=function in meson.build
>>>>>>> does not affect --extra-cflags due to argument ordering.
>>>>>>>
>>>>>>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>>>>>>> ---
>>>>>>> Changes in v3:
>>>>>>> - I was not properly dropping the change of .gitlab-ci.d/buildtest.yml
>>>>>>> but only updated the message. v3 fixes this. (Thomas Huth)
>>>>>>> - Link to v2:
>>>>>>> https://lore.kernel.org/r/20240729-function-v2-1-2401ab18b30b@daynix.com
>>>>>>>
>>>>>>> Changes in v2:
>>>>>>> - Dropped the change of: .gitlab-ci.d/buildtest.yml
>>>>>>> - Link to v1:
>>>>>>> https://lore.kernel.org/r/20240714-function-v1-1-cc2acb4171ba@daynix.com
>>>>>>> ---
>>>>>>> meson.build | 1 +
>>>>>>> 1 file changed, 1 insertion(+)
>>>>>>>
>>>>>>> diff --git a/meson.build b/meson.build
>>>>>>> index 5613b62a4f42..a4169c572ba9 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')
>>>>>>
>>>>>> As I mentioned in my last mail: I think it would make sense to move
>>>>>> this at the end of the "if get_option('tsan')" block in meson.build,
>>>>>> since this apparently only fixes the use of "--enable-sanitizers", and
>>>>>> cannot fix the "--extra-cflags" that a user might have specified?
>>>>>
>>>>> Sorry, I missed it. It cannot fix --extra-cflags, but it should be able
>>>>> to fix compiler flags specified by compiler distributor.
>>>>
>>>> Oh, you mean that there are distros that enable -fsanitize=function by
>>>> default? Can you name one? If so, I think that information should go
>>>> into the patch description...?
>>>
>>> No, it is just a precaution.
>>
>> Ok. I don't think any normal distro will enable this by default since this
>> impacts performance of the programs, so it's either the user specifying
>> --enable-sanitizers or the user specifying
>> --extra-cflags="-fsanitize=...". In the latter case, your patch does not
>> help. In the former case, I think this setting should go into the same
>> code block as where we set -fsanitize=undefined in our meson.build file,
>> so that it is clear where it belongs to.
>
> It does not look like -fno-sanitize=function belongs to the code block to
> me. Putting -fno-sanitize=function in the code block will make it seem to
> say that we should disable function sanitizer because the user requests to
> enable sanitizers, which makes little sense.
As far as I understood, -fsanitize=undefine turns on -fsanitize=function,
too, or did I get that wrong?
If not, how did you run into this problem? How did you enable the function
sanitizer if not using --enable-sanitizers ?
Thomas
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] meson: Use -fno-sanitize=function when available
2024-08-16 8:24 ` Thomas Huth
@ 2024-08-16 8:27 ` Akihiko Odaki
2024-08-16 8:46 ` Richard Henderson
2024-08-16 8:51 ` Thomas Huth
0 siblings, 2 replies; 13+ messages in thread
From: Akihiko Odaki @ 2024-08-16 8:27 UTC (permalink / raw)
To: Thomas Huth, Alex Bennée, Philippe Mathieu-Daudé,
Wainer dos Santos Moschetta, Beraldo Leal, Paolo Bonzini,
Marc-André Lureau, Daniel P. Berrangé
Cc: qemu-devel
On 2024/08/16 17:24, Thomas Huth wrote:
> On 16/08/2024 10.21, Akihiko Odaki wrote:
>> On 2024/08/16 17:03, Thomas Huth wrote:
>>> On 16/08/2024 09.30, Akihiko Odaki wrote:
>>>> On 2024/08/16 16:27, Thomas Huth wrote:
>>>>> On 16/08/2024 09.12, Akihiko Odaki wrote:
>>>>>> On 2024/08/16 16:03, Thomas Huth wrote:
>>>>>>> On 16/08/2024 08.22, Akihiko Odaki wrote:
>>>>>>>> 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. Add it to meson.build for such. It is not removed
>>>>>>>> from
>>>>>>>> .gitlab-ci.d/buildtest.yml because -fno-sanitize=function in
>>>>>>>> meson.build
>>>>>>>> does not affect --extra-cflags due to argument ordering.
>>>>>>>>
>>>>>>>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>>>>>>>> ---
>>>>>>>> Changes in v3:
>>>>>>>> - I was not properly dropping the change of
>>>>>>>> .gitlab-ci.d/buildtest.yml
>>>>>>>> but only updated the message. v3 fixes this. (Thomas Huth)
>>>>>>>> - Link to v2:
>>>>>>>> https://lore.kernel.org/r/20240729-function-v2-1-2401ab18b30b@daynix.com
>>>>>>>>
>>>>>>>> Changes in v2:
>>>>>>>> - Dropped the change of: .gitlab-ci.d/buildtest.yml
>>>>>>>> - Link to v1:
>>>>>>>> https://lore.kernel.org/r/20240714-function-v1-1-cc2acb4171ba@daynix.com
>>>>>>>> ---
>>>>>>>> meson.build | 1 +
>>>>>>>> 1 file changed, 1 insertion(+)
>>>>>>>>
>>>>>>>> diff --git a/meson.build b/meson.build
>>>>>>>> index 5613b62a4f42..a4169c572ba9 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')
>>>>>>>
>>>>>>> As I mentioned in my last mail: I think it would make sense to
>>>>>>> move this at the end of the "if get_option('tsan')" block in
>>>>>>> meson.build, since this apparently only fixes the use of
>>>>>>> "--enable-sanitizers", and cannot fix the "--extra-cflags" that a
>>>>>>> user might have specified?
>>>>>>
>>>>>> Sorry, I missed it. It cannot fix --extra-cflags, but it should be
>>>>>> able to fix compiler flags specified by compiler distributor.
>>>>>
>>>>> Oh, you mean that there are distros that enable -fsanitize=function
>>>>> by default? Can you name one? If so, I think that information
>>>>> should go into the patch description...?
>>>>
>>>> No, it is just a precaution.
>>>
>>> Ok. I don't think any normal distro will enable this by default since
>>> this impacts performance of the programs, so it's either the user
>>> specifying --enable-sanitizers or the user specifying
>>> --extra-cflags="-fsanitize=...". In the latter case, your patch does
>>> not help. In the former case, I think this setting should go into the
>>> same code block as where we set -fsanitize=undefined in our
>>> meson.build file, so that it is clear where it belongs to.
>>
>> It does not look like -fno-sanitize=function belongs to the code block
>> to me. Putting -fno-sanitize=function in the code block will make it
>> seem to say that we should disable function sanitizer because the user
>> requests to enable sanitizers, which makes little sense.
>
> As far as I understood, -fsanitize=undefine turns on
> -fsanitize=function, too, or did I get that wrong?
> If not, how did you run into this problem? How did you enable the
> function sanitizer if not using --enable-sanitizers ?
The point is we don't care who enables sanitizers, and unconditonally
setting -fno-sanitize=function will clarify that.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] meson: Use -fno-sanitize=function when available
2024-08-16 8:27 ` Akihiko Odaki
@ 2024-08-16 8:46 ` Richard Henderson
2024-08-16 8:51 ` Akihiko Odaki
2024-08-16 8:51 ` Thomas Huth
1 sibling, 1 reply; 13+ messages in thread
From: Richard Henderson @ 2024-08-16 8:46 UTC (permalink / raw)
To: Akihiko Odaki, Thomas Huth, Alex Bennée,
Philippe Mathieu-Daudé, Wainer dos Santos Moschetta,
Beraldo Leal, Paolo Bonzini, Marc-André Lureau,
Daniel P. Berrangé
Cc: qemu-devel
On 8/16/24 18:27, Akihiko Odaki wrote:
> On 2024/08/16 17:24, Thomas Huth wrote:
>> On 16/08/2024 10.21, Akihiko Odaki wrote:
>>> On 2024/08/16 17:03, Thomas Huth wrote:
>>>> On 16/08/2024 09.30, Akihiko Odaki wrote:
>>>>> On 2024/08/16 16:27, Thomas Huth wrote:
>>>>>> On 16/08/2024 09.12, Akihiko Odaki wrote:
>>>>>>> On 2024/08/16 16:03, Thomas Huth wrote:
>>>>>>>> On 16/08/2024 08.22, Akihiko Odaki wrote:
>>>>>>>>> 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. Add it to meson.build for such. It is not removed from
>>>>>>>>> .gitlab-ci.d/buildtest.yml because -fno-sanitize=function in meson.build
>>>>>>>>> does not affect --extra-cflags due to argument ordering.
>>>>>>>>>
>>>>>>>>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>>>>>>>>> ---
>>>>>>>>> Changes in v3:
>>>>>>>>> - I was not properly dropping the change of .gitlab-ci.d/buildtest.yml
>>>>>>>>> but only updated the message. v3 fixes this. (Thomas Huth)
>>>>>>>>> - Link to v2: https://lore.kernel.org/r/20240729-function-
>>>>>>>>> v2-1-2401ab18b30b@daynix.com
>>>>>>>>>
>>>>>>>>> Changes in v2:
>>>>>>>>> - Dropped the change of: .gitlab-ci.d/buildtest.yml
>>>>>>>>> - Link to v1: https://lore.kernel.org/r/20240714-function-v1-1-
>>>>>>>>> cc2acb4171ba@daynix.com
>>>>>>>>> ---
>>>>>>>>> meson.build | 1 +
>>>>>>>>> 1 file changed, 1 insertion(+)
>>>>>>>>>
>>>>>>>>> diff --git a/meson.build b/meson.build
>>>>>>>>> index 5613b62a4f42..a4169c572ba9 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')
>>>>>>>>
>>>>>>>> As I mentioned in my last mail: I think it would make sense to move this at the
>>>>>>>> end of the "if get_option('tsan')" block in meson.build, since this apparently
>>>>>>>> only fixes the use of "--enable-sanitizers", and cannot fix the "--extra-cflags"
>>>>>>>> that a user might have specified?
>>>>>>>
>>>>>>> Sorry, I missed it. It cannot fix --extra-cflags, but it should be able to fix
>>>>>>> compiler flags specified by compiler distributor.
>>>>>>
>>>>>> Oh, you mean that there are distros that enable -fsanitize=function by default? Can
>>>>>> you name one? If so, I think that information should go into the patch description...?
>>>>>
>>>>> No, it is just a precaution.
>>>>
>>>> Ok. I don't think any normal distro will enable this by default since this impacts
>>>> performance of the programs, so it's either the user specifying --enable-sanitizers or
>>>> the user specifying --extra-cflags="-fsanitize=...". In the latter case, your patch
>>>> does not help. In the former case, I think this setting should go into the same code
>>>> block as where we set -fsanitize=undefined in our meson.build file, so that it is
>>>> clear where it belongs to.
>>>
>>> It does not look like -fno-sanitize=function belongs to the code block to me. Putting -
>>> fno-sanitize=function in the code block will make it seem to say that we should disable
>>> function sanitizer because the user requests to enable sanitizers, which makes little
>>> sense.
>>
>> As far as I understood, -fsanitize=undefine turns on -fsanitize=function, too, or did I
>> get that wrong?
>> If not, how did you run into this problem? How did you enable the function sanitizer if
>> not using --enable-sanitizers ?
>
> The point is we don't care who enables sanitizers, and unconditonally setting -fno-
> sanitize=function will clarify that.
>
Argument ordering is important. You cannot just drop this in the middle of meson.build
and expect anything reasonable to happen.
r~
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] meson: Use -fno-sanitize=function when available
2024-08-16 8:46 ` Richard Henderson
@ 2024-08-16 8:51 ` Akihiko Odaki
0 siblings, 0 replies; 13+ messages in thread
From: Akihiko Odaki @ 2024-08-16 8:51 UTC (permalink / raw)
To: Richard Henderson, Thomas Huth, Alex Bennée,
Philippe Mathieu-Daudé, Wainer dos Santos Moschetta,
Beraldo Leal, Paolo Bonzini, Marc-André Lureau,
Daniel P. Berrangé
Cc: qemu-devel
On 2024/08/16 17:46, Richard Henderson wrote:
> On 8/16/24 18:27, Akihiko Odaki wrote:
>> On 2024/08/16 17:24, Thomas Huth wrote:
>>> On 16/08/2024 10.21, Akihiko Odaki wrote:
>>>> On 2024/08/16 17:03, Thomas Huth wrote:
>>>>> On 16/08/2024 09.30, Akihiko Odaki wrote:
>>>>>> On 2024/08/16 16:27, Thomas Huth wrote:
>>>>>>> On 16/08/2024 09.12, Akihiko Odaki wrote:
>>>>>>>> On 2024/08/16 16:03, Thomas Huth wrote:
>>>>>>>>> On 16/08/2024 08.22, Akihiko Odaki wrote:
>>>>>>>>>> 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. Add it to meson.build for such. It is not
>>>>>>>>>> removed from
>>>>>>>>>> .gitlab-ci.d/buildtest.yml because -fno-sanitize=function in
>>>>>>>>>> meson.build
>>>>>>>>>> does not affect --extra-cflags due to argument ordering.
>>>>>>>>>>
>>>>>>>>>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>>>>>>>>>> ---
>>>>>>>>>> Changes in v3:
>>>>>>>>>> - I was not properly dropping the change of
>>>>>>>>>> .gitlab-ci.d/buildtest.yml
>>>>>>>>>> but only updated the message. v3 fixes this. (Thomas Huth)
>>>>>>>>>> - Link to v2: https://lore.kernel.org/r/20240729-function-
>>>>>>>>>> v2-1-2401ab18b30b@daynix.com
>>>>>>>>>>
>>>>>>>>>> Changes in v2:
>>>>>>>>>> - Dropped the change of: .gitlab-ci.d/buildtest.yml
>>>>>>>>>> - Link to v1:
>>>>>>>>>> https://lore.kernel.org/r/20240714-function-v1-1-
>>>>>>>>>> cc2acb4171ba@daynix.com
>>>>>>>>>> ---
>>>>>>>>>> meson.build | 1 +
>>>>>>>>>> 1 file changed, 1 insertion(+)
>>>>>>>>>>
>>>>>>>>>> diff --git a/meson.build b/meson.build
>>>>>>>>>> index 5613b62a4f42..a4169c572ba9 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')
>>>>>>>>>
>>>>>>>>> As I mentioned in my last mail: I think it would make sense to
>>>>>>>>> move this at the end of the "if get_option('tsan')" block in
>>>>>>>>> meson.build, since this apparently only fixes the use of
>>>>>>>>> "--enable-sanitizers", and cannot fix the "--extra-cflags" that
>>>>>>>>> a user might have specified?
>>>>>>>>
>>>>>>>> Sorry, I missed it. It cannot fix --extra-cflags, but it should
>>>>>>>> be able to fix compiler flags specified by compiler distributor.
>>>>>>>
>>>>>>> Oh, you mean that there are distros that enable
>>>>>>> -fsanitize=function by default? Can you name one? If so, I think
>>>>>>> that information should go into the patch description...?
>>>>>>
>>>>>> No, it is just a precaution.
>>>>>
>>>>> Ok. I don't think any normal distro will enable this by default
>>>>> since this impacts performance of the programs, so it's either the
>>>>> user specifying --enable-sanitizers or the user specifying
>>>>> --extra-cflags="-fsanitize=...". In the latter case, your patch
>>>>> does not help. In the former case, I think this setting should go
>>>>> into the same code block as where we set -fsanitize=undefined in
>>>>> our meson.build file, so that it is clear where it belongs to.
>>>>
>>>> It does not look like -fno-sanitize=function belongs to the code
>>>> block to me. Putting - fno-sanitize=function in the code block will
>>>> make it seem to say that we should disable function sanitizer
>>>> because the user requests to enable sanitizers, which makes little
>>>> sense.
>>>
>>> As far as I understood, -fsanitize=undefine turns on
>>> -fsanitize=function, too, or did I get that wrong?
>>> If not, how did you run into this problem? How did you enable the
>>> function sanitizer if not using --enable-sanitizers ?
>>
>> The point is we don't care who enables sanitizers, and unconditonally
>> setting -fno- sanitize=function will clarify that.
>>
>
> Argument ordering is important. You cannot just drop this in the middle
> of meson.build and expect anything reasonable to happen.
That is a good point. We should add -fno-sanitize=function immediately
after -fsanitize=undefined; I will submit v4 with that change.
Regards,
Akihiko Odaki
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v3] meson: Use -fno-sanitize=function when available
2024-08-16 8:27 ` Akihiko Odaki
2024-08-16 8:46 ` Richard Henderson
@ 2024-08-16 8:51 ` Thomas Huth
1 sibling, 0 replies; 13+ messages in thread
From: Thomas Huth @ 2024-08-16 8:51 UTC (permalink / raw)
To: Akihiko Odaki, Alex Bennée, Philippe Mathieu-Daudé,
Wainer dos Santos Moschetta, Beraldo Leal, Paolo Bonzini,
Marc-André Lureau, Daniel P. Berrangé
Cc: qemu-devel
On 16/08/2024 10.27, Akihiko Odaki wrote:
> On 2024/08/16 17:24, Thomas Huth wrote:
>> On 16/08/2024 10.21, Akihiko Odaki wrote:
>>> On 2024/08/16 17:03, Thomas Huth wrote:
>>>> On 16/08/2024 09.30, Akihiko Odaki wrote:
>>>>> On 2024/08/16 16:27, Thomas Huth wrote:
>>>>>> On 16/08/2024 09.12, Akihiko Odaki wrote:
>>>>>>> On 2024/08/16 16:03, Thomas Huth wrote:
>>>>>>>> On 16/08/2024 08.22, Akihiko Odaki wrote:
>>>>>>>>> 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. Add it to meson.build for such. It is not removed from
>>>>>>>>> .gitlab-ci.d/buildtest.yml because -fno-sanitize=function in
>>>>>>>>> meson.build
>>>>>>>>> does not affect --extra-cflags due to argument ordering.
>>>>>>>>>
>>>>>>>>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>>>>>>>>> ---
>>>>>>>>> Changes in v3:
>>>>>>>>> - I was not properly dropping the change of .gitlab-ci.d/buildtest.yml
>>>>>>>>> but only updated the message. v3 fixes this. (Thomas Huth)
>>>>>>>>> - Link to v2:
>>>>>>>>> https://lore.kernel.org/r/20240729-function-v2-1-2401ab18b30b@daynix.com
>>>>>>>>>
>>>>>>>>> Changes in v2:
>>>>>>>>> - Dropped the change of: .gitlab-ci.d/buildtest.yml
>>>>>>>>> - Link to v1:
>>>>>>>>> https://lore.kernel.org/r/20240714-function-v1-1-cc2acb4171ba@daynix.com
>>>>>>>>> ---
>>>>>>>>> meson.build | 1 +
>>>>>>>>> 1 file changed, 1 insertion(+)
>>>>>>>>>
>>>>>>>>> diff --git a/meson.build b/meson.build
>>>>>>>>> index 5613b62a4f42..a4169c572ba9 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')
>>>>>>>>
>>>>>>>> As I mentioned in my last mail: I think it would make sense to move
>>>>>>>> this at the end of the "if get_option('tsan')" block in meson.build,
>>>>>>>> since this apparently only fixes the use of "--enable-sanitizers",
>>>>>>>> and cannot fix the "--extra-cflags" that a user might have specified?
>>>>>>>
>>>>>>> Sorry, I missed it. It cannot fix --extra-cflags, but it should be
>>>>>>> able to fix compiler flags specified by compiler distributor.
>>>>>>
>>>>>> Oh, you mean that there are distros that enable -fsanitize=function by
>>>>>> default? Can you name one? If so, I think that information should go
>>>>>> into the patch description...?
>>>>>
>>>>> No, it is just a precaution.
>>>>
>>>> Ok. I don't think any normal distro will enable this by default since
>>>> this impacts performance of the programs, so it's either the user
>>>> specifying --enable-sanitizers or the user specifying
>>>> --extra-cflags="-fsanitize=...". In the latter case, your patch does not
>>>> help. In the former case, I think this setting should go into the same
>>>> code block as where we set -fsanitize=undefined in our meson.build file,
>>>> so that it is clear where it belongs to.
>>>
>>> It does not look like -fno-sanitize=function belongs to the code block to
>>> me. Putting -fno-sanitize=function in the code block will make it seem to
>>> say that we should disable function sanitizer because the user requests
>>> to enable sanitizers, which makes little sense.
>>
>> As far as I understood, -fsanitize=undefine turns on -fsanitize=function,
>> too, or did I get that wrong?
>> If not, how did you run into this problem? How did you enable the function
>> sanitizer if not using --enable-sanitizers ?
>
> The point is we don't care who enables sanitizers, and unconditonally
> setting -fno-sanitize=function will clarify that.
I think I tend to disagree here. If users enabled saitize=undefined it with
--extra-cflags, they also have to disable sanitize=function with
--extra-cflags, so listing this unconditionally in our meson.build is a red
herring when people are looking at the file.
Thomas
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2024-08-16 8:51 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-16 6:22 [PATCH v3] meson: Use -fno-sanitize=function when available Akihiko Odaki
2024-08-16 7:03 ` Thomas Huth
2024-08-16 7:12 ` Akihiko Odaki
2024-08-16 7:27 ` Thomas Huth
2024-08-16 7:30 ` Akihiko Odaki
2024-08-16 8:03 ` Thomas Huth
2024-08-16 8:21 ` Akihiko Odaki
2024-08-16 8:24 ` Thomas Huth
2024-08-16 8:27 ` Akihiko Odaki
2024-08-16 8:46 ` Richard Henderson
2024-08-16 8:51 ` Akihiko Odaki
2024-08-16 8:51 ` Thomas Huth
2024-08-16 8:05 ` Richard Henderson
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 NNTP newsgroup(s).