[libvirt PATCH] meson: Increase stack size limit for sanitizer builds

Tim Wiederhake posted 1 patch 2 years, 7 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20210923092338.19942-1-twiederh@redhat.com
meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt PATCH] meson: Increase stack size limit for sanitizer builds
Posted by Tim Wiederhake 2 years, 7 months ago
When building with "CC=clang", "-Db_sanitize=address,undefined", and
"-Dbuildtype=debug", the following error occurs:

    ../src/conf/nwfilter_conf.c:2190:1: error: stack frame size of 10616
    bytes in function 'virNWFilterRuleDefFixup' [-Werror,-Wframe-larger-than=]
    virNWFilterRuleDefFixup(virNWFilterRuleDef *rule)
    ^
    1 error generated.

Enforcing stack frame only makes sense on normal builds when stack usage
is deterministic.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 488490181f..be5a99a069 100644
--- a/meson.build
+++ b/meson.build
@@ -225,7 +225,7 @@ alloc_max = run_command(
 )
 
 # sanitizer instrumentation may enlarge stack frames
-stack_frame_size = get_option('b_sanitize') == 'none' ? 4096 : 8192
+stack_frame_size = get_option('b_sanitize') == 'none' ? 4096 : 32768
 
 # array_bounds=2 check triggers false positive on some GCC
 # versions when using sanitizers. Seen on Fedora 34 with
-- 
2.31.1

Re: [libvirt PATCH] meson: Increase stack size limit for sanitizer builds
Posted by Tim Wiederhake 2 years, 7 months ago
On Thu, 2021-09-23 at 11:23 +0200, Tim Wiederhake wrote:
> When building with "CC=clang", "-Db_sanitize=address,undefined", and
> "-Dbuildtype=debug", the following error occurs:
> 
>     ../src/conf/nwfilter_conf.c:2190:1: error: stack frame size of
> 10616
>     bytes in function 'virNWFilterRuleDefFixup' [-Werror,-Wframe-
> larger-than=]
>     virNWFilterRuleDefFixup(virNWFilterRuleDef *rule)
>     ^
>     1 error generated.
> 
> Enforcing stack frame only makes sense on normal builds when stack
> usage
> is deterministic.
> 
> Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
> ---
>  meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index 488490181f..be5a99a069 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -225,7 +225,7 @@ alloc_max = run_command(
>  )
>  
>  # sanitizer instrumentation may enlarge stack frames
> -stack_frame_size = get_option('b_sanitize') == 'none' ? 4096 : 8192
> +stack_frame_size = get_option('b_sanitize') == 'none' ? 4096 : 32768
>  
>  # array_bounds=2 check triggers false positive on some GCC
>  # versions when using sanitizers. Seen on Fedora 34 with

Please consider this an alternative to
https://listman.redhat.com/archives/libvir-list/2021-September/msg00599.html
based on Daniel's input.

Note that this patch could replace both patches from that series in
theory; I merged the first one (g_auto-ification of
virDomainDefParseXML) regardless.

Regards,
Tim

Re: [libvirt PATCH] meson: Increase stack size limit for sanitizer builds
Posted by Daniel P. Berrangé 2 years, 7 months ago
On Thu, Sep 23, 2021 at 11:23:38AM +0200, Tim Wiederhake wrote:
> When building with "CC=clang", "-Db_sanitize=address,undefined", and
> "-Dbuildtype=debug", the following error occurs:
> 
>     ../src/conf/nwfilter_conf.c:2190:1: error: stack frame size of 10616
>     bytes in function 'virNWFilterRuleDefFixup' [-Werror,-Wframe-larger-than=]
>     virNWFilterRuleDefFixup(virNWFilterRuleDef *rule)
>     ^
>     1 error generated.
> 
> Enforcing stack frame only makes sense on normal builds when stack usage
> is deterministic.
> 
> Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
> ---
>  meson.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index 488490181f..be5a99a069 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -225,7 +225,7 @@ alloc_max = run_command(
>  )
>  
>  # sanitizer instrumentation may enlarge stack frames
> -stack_frame_size = get_option('b_sanitize') == 'none' ? 4096 : 8192
> +stack_frame_size = get_option('b_sanitize') == 'none' ? 4096 : 32768
>  
>  # array_bounds=2 check triggers false positive on some GCC
>  # versions when using sanitizers. Seen on Fedora 34 with

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|