* [PATCH] meson: -Wno-error=format-overflow for ubsan
@ 2023-11-20 11:23 Akihiko Odaki
2023-11-20 13:16 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 3+ messages in thread
From: Akihiko Odaki @ 2023-11-20 11:23 UTC (permalink / raw)
Cc: Akihiko Odaki, Paolo Bonzini, Marc-André Lureau,
Daniel P. Berrangé, Thomas Huth, Philippe Mathieu-Daudé,
qemu-devel
ubsan causes wrong -Wformat-overflow warnings as follows:
In file included from /usr/include/stdio.h:906,
from /home/alarm/q/var/qemu/include/qemu/osdep.h:114,
from ../disas/cris.c:21:
In function 'sprintf',
inlined from 'format_dec' at ../disas/cris.c:1737:3,
inlined from 'print_with_operands' at ../disas/cris.c:2477:12,
inlined from 'print_insn_cris_generic.constprop' at ../disas/cris.c:2690:8:
/usr/include/bits/stdio2.h:30:10: warning: null destination pointer [-Wformat-overflow=]
30 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31 | __glibc_objsize (__s), __fmt,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 | __va_arg_pack ());
| ~~~~~~~~~~~~~~~~~
Don't let these errors stop the build.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
meson.build | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index d7d841e71e..02f1a18080 100644
--- a/meson.build
+++ b/meson.build
@@ -365,7 +365,9 @@ if get_option('sanitizers')
# Detect static linking issue with ubsan - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
if cc.links('int main(int argc, char **argv) { return argc + 1; }',
args: [qemu_ldflags, '-fsanitize=undefined'])
- qemu_cflags = ['-fsanitize=undefined'] + qemu_cflags
+ # 87884 – ubsan causes wrong -Wformat-overflow warning
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87884
+ qemu_cflags = ['-fsanitize=undefined', '-Wno-error=format-overflow'] + qemu_cflags
qemu_ldflags = ['-fsanitize=undefined'] + qemu_ldflags
endif
endif
--
2.42.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] meson: -Wno-error=format-overflow for ubsan
2023-11-20 11:23 [PATCH] meson: -Wno-error=format-overflow for ubsan Akihiko Odaki
@ 2023-11-20 13:16 ` Philippe Mathieu-Daudé
2023-11-20 13:24 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-20 13:16 UTC (permalink / raw)
To: Akihiko Odaki
Cc: Paolo Bonzini, Marc-André Lureau, Daniel P. Berrangé,
Thomas Huth, qemu-devel
Hi Akihiko,
On 20/11/23 12:23, Akihiko Odaki wrote:
> ubsan causes wrong -Wformat-overflow warnings as follows:
>
> In file included from /usr/include/stdio.h:906,
> from /home/alarm/q/var/qemu/include/qemu/osdep.h:114,
> from ../disas/cris.c:21:
> In function 'sprintf',
> inlined from 'format_dec' at ../disas/cris.c:1737:3,
> inlined from 'print_with_operands' at ../disas/cris.c:2477:12,
> inlined from 'print_insn_cris_generic.constprop' at ../disas/cris.c:2690:8:
> /usr/include/bits/stdio2.h:30:10: warning: null destination pointer [-Wformat-overflow=]
> 30 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 31 | __glibc_objsize (__s), __fmt,
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 32 | __va_arg_pack ());
> | ~~~~~~~~~~~~~~~~~
>
> Don't let these errors stop the build.
Which compiler/version?
>
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> meson.build | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/meson.build b/meson.build
> index d7d841e71e..02f1a18080 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -365,7 +365,9 @@ if get_option('sanitizers')
> # Detect static linking issue with ubsan - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
> if cc.links('int main(int argc, char **argv) { return argc + 1; }',
> args: [qemu_ldflags, '-fsanitize=undefined'])
> - qemu_cflags = ['-fsanitize=undefined'] + qemu_cflags
> + # 87884 – ubsan causes wrong -Wformat-overflow warning
> + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87884
> + qemu_cflags = ['-fsanitize=undefined', '-Wno-error=format-overflow'] + qemu_cflags
> qemu_ldflags = ['-fsanitize=undefined'] + qemu_ldflags
> endif
> endif
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] meson: -Wno-error=format-overflow for ubsan
2023-11-20 13:16 ` Philippe Mathieu-Daudé
@ 2023-11-20 13:24 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-20 13:24 UTC (permalink / raw)
To: Akihiko Odaki
Cc: Paolo Bonzini, Marc-André Lureau, Daniel P. Berrangé,
Thomas Huth, qemu-devel
On 20/11/23 14:16, Philippe Mathieu-Daudé wrote:
> Hi Akihiko,
>
> On 20/11/23 12:23, Akihiko Odaki wrote:
>> ubsan causes wrong -Wformat-overflow warnings as follows:
>>
>> In file included from /usr/include/stdio.h:906,
>> from /home/alarm/q/var/qemu/include/qemu/osdep.h:114,
>> from ../disas/cris.c:21:
>> In function 'sprintf',
>> inlined from 'format_dec' at ../disas/cris.c:1737:3,
>> inlined from 'print_with_operands' at ../disas/cris.c:2477:12,
>> inlined from 'print_insn_cris_generic.constprop' at
>> ../disas/cris.c:2690:8:
>> /usr/include/bits/stdio2.h:30:10: warning: null destination pointer
>> [-Wformat-overflow=]
>> 30 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> 31 | __glibc_objsize (__s), __fmt,
>> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> 32 | __va_arg_pack ());
>> | ~~~~~~~~~~~~~~~~~
>>
>> Don't let these errors stop the build.
>
> Which compiler/version?
>
>>
>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>> ---
>> meson.build | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/meson.build b/meson.build
>> index d7d841e71e..02f1a18080 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -365,7 +365,9 @@ if get_option('sanitizers')
>> # Detect static linking issue with ubsan -
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
>> if cc.links('int main(int argc, char **argv) { return argc + 1; }',
>> args: [qemu_ldflags, '-fsanitize=undefined'])
>> - qemu_cflags = ['-fsanitize=undefined'] + qemu_cflags
>> + # 87884 – ubsan causes wrong -Wformat-overflow warning
>> + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87884
I posted an alternative less intrusive patch, see:
https://lore.kernel.org/all/20231120132222.82138-1-philmd@linaro.org/
>> + qemu_cflags = ['-fsanitize=undefined',
>> '-Wno-error=format-overflow'] + qemu_cflags
>> qemu_ldflags = ['-fsanitize=undefined'] + qemu_ldflags
>> endif
>> endif
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-20 13:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-20 11:23 [PATCH] meson: -Wno-error=format-overflow for ubsan Akihiko Odaki
2023-11-20 13:16 ` Philippe Mathieu-Daudé
2023-11-20 13:24 ` Philippe Mathieu-Daudé
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).