From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0101C3851C0C; Fri, 22 May 2020 16:56:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0101C3851C0C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1590166583; bh=0G3Thxgl35/qySl/hWCXjBfmX8oe3or4N//tuNaAa3I=; h=From:To:Subject:Date:From; b=v6dtjvyeCc51LmTlLSuGhr3C2PAwA4qqFBw1lAXowOJUa7gvZh993qUV3P0xn9ven WshKdfKS458Wy4AIvNbrPFwKUWGwAfNFe9ki/yOuphsh9wFU297Xw3H7DZRSDeVkGY zepZdROlvMUcHW2vSfgB8Sp/vBZvG+/fD3uU2Ibo= From: "frantisek at sumsal dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/95275] New: Possible performance regression in libasan with detect_stack_use_after_return=1 Date: Fri, 22 May 2020 16:56:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: frantisek at sumsal dot cz X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 May 2020 16:56:23 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95275 Bug ID: 95275 Summary: Possible performance regression in libasan with detect_stack_use_after_return=3D1 Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: sanitizer Assignee: unassigned at gcc dot gnu.org Reporter: frantisek at sumsal dot cz CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org, jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxi= n at gcc dot gnu.org Target Milestone: --- Hello, This appears to be part #2 to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D91101 as we managed to hit t= he issue once again[0], but in a different codepath. Reproducer: $ git clone https://github.com/systemd/systemd $ git fetch -fu origin refs/pull/15886/merge:pr $ git checkout pr $ meson build-gcc -Db_sanitize=3Daddress,undefined -Dfuzz-tests=3Dtrue --optimization=3D1 $ ninja -C build-gcc $ export ASAN_OPTIONS=3Dstrict_string_checks=3D1:detect_stack_use_after_return=3D1:c= heck_initialization_order=3D1:strict_init_order=3D1 $ export UBSAN_OPTIONS=3Dprint_stacktrace=3D1:print_summary=3D1:halt_on_err= or=3D1 $ time build-gcc/fuzz-unit-file\:address\,undefined test/fuzz/fuzz-unit-file/oss-fuzz-11569 Results: ### gcc (GCC) 10.0.1 20200328 (Red Hat 10.0.1-0.11) $ time build-gcc/fuzz-unit-file\:address\,undefined test/fuzz/fuzz-unit-file/oss-fuzz-11569=20 test/fuzz/fuzz-unit-file/oss-fuzz-11569... ok real 3m22.804s user 3m18.725s sys 0m0.245s ### gcc (GCC) 10.0.1 20200328 (Red Hat 10.0.1-0.11) with detect_stack_use_after_return=3D0 $ export ASAN_OPTIONS=3Dstrict_string_checks=3D1:detect_stack_use_after_return=3D0:c= heck_initialization_order=3D1:strict_init_order=3D1 $ time build-gcc/fuzz-unit-file\:address\,undefined test/fuzz/fuzz-unit-file/oss-fuzz-11569 test/fuzz/fuzz-unit-file/oss-fuzz-11569... ok real 0m2.803s user 0m2.731s sys 0m0.060s ### clang version 10.0.0 (Fedora 10.0.0-0.3.rc4.fc32) for comparison $ time build-clang/fuzz-unit-file\:address\,undefined test/fuzz/fuzz-unit-file/oss-fuzz-11569=20 test/fuzz/fuzz-unit-file/oss-fuzz-11569... ok real 0m3.222s user 0m3.104s sys 0m0.089s ### perf # Samples: 862K of event 'cycles:u' # Event count (approx.): 873078595486 # # Overhead Command Shared Object Symbol=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 # ........ ............... ........................=20 ......................................... # 95.14% fuzz-unit-file: libasan.so.6.0.0 [.] __asan_stack_malloc_0 3.13% fuzz-unit-file: libasan.so.6.0.0 [.] __asan_stack_malloc_1 0.18% fuzz-unit-file: libc-2.31.so [.] __strlen_avx2 0.17% fuzz-unit-file: libasan.so.6.0.0 [.] __asan_stack_malloc_2 0.15% fuzz-unit-file: libasan.so.6.0.0 [.] __asan_region_is_poisoned 0.07% fuzz-unit-file: libc-2.31.so [.] __strchr_avx2 0.06% fuzz-unit-file: libsystemd-shared-245.so [.] utf8_encoded_valid_unichar ... ### perf (call graph) # Samples: 804K of event 'cycles:u' # Event count (approx.): 811179153673 # # Children Self Command Shared Object Symbol=20= =20=20=20=20=20=20=20=20 # ........ ........ ............... ........................=20 ......................................... # 99.97% 0.00% fuzz-unit-file: fuzz-unit-file [.] LLVMFuzzerTestOneInput | ---LLVMFuzzerTestOneInput |=20=20=20=20=20=20=20=20=20=20 --99.57%--config_parse |=20=20=20=20=20=20=20=20=20=20 --99.56%--parse_line |=20=20=20=20=20=20=20=20=20=20 |--93.39%--next_assignment (inlined) | |=20=20=20=20=20=20=20=20= =20=20 |=20=20=20=20=20=20=20=20=20=20 --93.39%--config_parse_unit_requires_mounts_for | |=20=20=20=20=20= =20=20=20=20=20 |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 |--88.89%--path_simplify_and_warn | | |=20= =20=20=20=20=20=20=20=20 | |=20=20=20=20=20= =20=20=20=20=20 --88.87%--utf8_is_valid | |=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 |=20=20=20=20=20=20=20=20=20=20 | |=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 --88.85%--utf8_encoded_valid_unichar | |=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 |=20=20=20=20=20=20=20=20=20=20 | |=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 --88.79%--__asan_stack_malloc_0 | |=20=20=20=20=20= =20=20=20=20=20 |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20 --4.09%--unit_full_printf |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 specifier_printf | |=20= =20=20=20=20=20=20=20=20 |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 --3.96%--specifier_cgroup |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 |=20=20=20=20=20=20=20=20=20=20 |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 --3.96%--unit_default_cgroup_path |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 |=20=20=20=20=20=20=20=20=20=20 |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 |--2.10%--cg_slice_to_path |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 | |=20=20=20=20=20=20=20=20=20=20 |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 | |--0.76%--strextend_with_separator |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 | | |=20=20=20=20=20=20=20=20=20=20 |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 | | --0.73%--__asan_stack_malloc_1 |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 | |=20=20=20=20=20=20=20=20=20=20 |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 | --0.73%--cg_escape |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 | |=20=20=20=20=20=20=20=20=20=20 |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 | --0.68%--__asan_stack_malloc_1 |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 |=20=20=20=20=20=20=20=20=20=20 |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 --0.74%--unit_has_name |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 |=20=20=20=20=20=20=20=20=20=20 |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 --0.74%--set_contains (inlined) |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 |=20=20=20=20=20=20=20=20=20=20 |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 --0.74%--internal_hashmap_contains |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 |=20=20=20=20=20=20=20=20=20=20 |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 --0.74%--base_bucket_hash |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 |=20=20=20=20=20=20= =20=20=20=20 |=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20 --0.70%--__asan_stack_malloc_1 |=20=20=20=20=20=20=20=20=20=20 --6.15%--utf8_is_valid |=20=20=20=20=20=20=20=20= =20=20 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 --6.15%--utf8_encoded_valid_unichar |=20=20=20=20=20= =20=20=20=20=20 =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20 --6.15%--__asan_stack_malloc_0 As mentioned in [0], compiling with -O2 makes no difference. I'd attach full perf reports, but they're quite large (33M for the 'base' one, ~6.5G for ca= ll graph). [0] https://github.com/systemd/systemd/pull/15886#issuecomment-632689604=