[libvirt PATCH 1/6] meson: Allow larger stack frames when instrumenting
Pavel Hrdina
phrdina at redhat.com
Mon May 3 11:10:53 UTC 2021
On Mon, May 03, 2021 at 12:01:41PM +0200, Tim Wiederhake wrote:
> 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 | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/meson.build b/meson.build
> index 618cbd6b1d..bbdbe4afd8 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -278,7 +278,8 @@ cc_flags += [
> '-Wformat-y2k',
> '-Wformat-zero-length',
> '-Wframe-address',
> - '-Wframe-larger-than=4096',
> + # sanitizer instrumentation may enlarge stack frames
> + '-Wframe-larger-than=@0@'.format(get_option('b_sanitize') in ['', 'none'] ? 4096 : 8192),
> '-Wfree-nonheap-object',
> '-Whsa',
> '-Wif-not-aligned',
Looks good but needs some polishing. I would do something similar to
what we do with -Walloc-size-larger-than:
# sanitizer instrumentation may enlarge stack frames
stack_frame_size = get_option('b_sanitize') == 'none' ? 4096 : 8192
cc_flags += [
...
'-Wframe-larger-than=@0@'.format(stack_frame_size),
...
]
In addition there is no need to check for empty string as meson will
handle that while parsing the command argument. All of the following
commands:
meson build -Db_sanitize=
meson build -Db_sanitize=""
meson build -Db_sanitize=" "
meson build -Db_sanitize="asdf"
result in this error (the value in the error message reflects the one
actually used):
meson.build:1:0: ERROR: Value "" (of type "string") for combo option "Code sanitizer to use" is not one of the choices. Possible choices are (as string): "none", "address", "thread", "undefined", "memory", "address,undefined".
Pavel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210503/352e04da/attachment-0001.sig>
More information about the libvir-list
mailing list