[libvirt PATCH v2 1/7] meson: Allow larger stack frames when instrumenting

Tim Wiederhake twiederh at redhat.com
Thu May 6 15:08:32 UTC 2021


When enabling sanitizers, gcc adds some instrumentation to the code
that may enlarge stack frames. Some function's stack frames are already
close to the limit of 4096 and are enlarged past that threshold,
e.g. virLXCProcessStart which reaches a frame size of 4624 bytes.

Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 meson.build | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 1f97842319..997a23f1b0 100644
--- a/meson.build
+++ b/meson.build
@@ -224,6 +224,9 @@ alloc_max = run_command(
   'print(min(2**(@0@ * 8 - 1) - 1, 2**(@1@ * 8) - 1))'.format(ptrdiff_max, size_max),
 )
 
+# sanitizer instrumentation may enlarge stack frames
+stack_frame_size = get_option('b_sanitize') == 'none' ? 4096 : 8192
+
 cc_flags += [
   '-fasynchronous-unwind-tables',
   '-fexceptions',
@@ -278,7 +281,7 @@ cc_flags += [
   '-Wformat-y2k',
   '-Wformat-zero-length',
   '-Wframe-address',
-  '-Wframe-larger-than=4096',
+  '-Wframe-larger-than=@0@'.format(stack_frame_size),
   '-Wfree-nonheap-object',
   '-Whsa',
   '-Wif-not-aligned',
-- 
2.26.3




More information about the libvir-list mailing list