Closed jkeenan closed 11 months ago
Compilation failed like this:
This is not a direct compilation failure, this is a build step (that involves calling perl code) failure. ASAN will detect false-positives without PERL_DESTRUCT_LEVEL=2 set, so you should call export PERL_DESTRUCT_LEVEL=2
before inspecting anything involving leaks. Or, alternatively, call export ASAN_OPTIONS=detect_leaks=false
to disable leaks detection altogether.
For me, threaded build finished successfully with PERL_DESTRUCT_LEVEL set on threaded blead.
On blead, in the ASAN unthreaded build, I got 4 test failures: Signal: KILL
Combined with single test PASS'es this looks like some limits being hit - memory? kernel? especially when tests are run in parallel - ASAN involves enormous VIRT allocations, which are not without overhead.
Compilation failed like this:
This is not a direct compilation failure, this is a build step (that involves calling perl code) failure. ASAN will detect false-positives without PERL_DESTRUCT_LEVEL=2 set, so you should call
export PERL_DESTRUCT_LEVEL=2
before inspecting anything involving leaks. Or, alternatively, callexport ASAN_OPTIONS=detect_leaks=false
to disable leaks detection altogether.For me, threaded build finished successfully with PERL_DESTRUCT_LEVEL set on threaded blead.
On blead, in the ASAN unthreaded build, I got 4 test failures: Signal: KILL
Combined with single test PASS'es this looks like some limits being hit - memory? kernel? especially when tests are run in parallel - ASAN involves enormous VIRT allocations, which are not without overhead.
Thanks for looking into this. I set PERL_DESTRUCT_LEVEL=2
as you suggested, then built a perl
using clang
, threaded, ASAN.
$ ./perl -Ilib -V:config_args; env | grep DESTRUCT
config_args='-des -Dusedevel -Dcc=clang -Accflags=-g -fno-omit-frame-pointer -fsanitize=address -fno-common -fsanitize-blacklist=/home/jkeenan/gitwork/perl/asan_ignore -Aldflags=-fsanitize=address -Duseithreads';
PERL_DESTRUCT_LEVEL=2
miniperl
and perl
both built successfully. make test_harness
displayed failures in these 4 files:
Test Summary Report
-------------------
lib/croak.t (Wstat: 0 Tests: 215 Failed: 15)
Failed tests: 1-11, 13-16
re/pat.t (Wstat: 9 (Signal: KILL) Tests: 276 Failed: 0)
Non-zero wait status: 9
Parse errors: Bad plan. You planned 1230 tests but ran 276.
re/pat_psycho_thr.t (Wstat: 9 (Signal: KILL) Tests: 10 Failed: 0)
Non-zero wait status: 9
Parse errors: Bad plan. You planned 15 tests but ran 10.
re/pat_psycho.t (Wstat: 9 (Signal: KILL) Tests: 0 Failed: 0)
Non-zero wait status: 9
Parse errors: Bad plan. You planned 15 tests but ran 0.
../lib/warnings.t (Wstat: 0 Tests: 940 Failed: 4)
Failed tests: 379-382
Re-running those files one at a time, I got these results:
$ cd t; TEST_JOBS=1 ./perl harness lib/croak.t re/pat.t re/pat_psycho_thr.t re/pat_psycho.t; cd -
...
lib/croak.t .......... 177/215 #
# Note: 'run_multiple_progs' run has one or more failures
# you can consider setting the environment variable
# PERL_TEST_ABORT_FIRST_FAILURE=1 before running the test
# to stop on the first error.
#
lib/croak.t .......... Failed 15/215 subtests
(less 3 skipped subtests: 197 okay)
re/pat.t ............. ok
re/pat_psycho_thr.t .. ok
re/pat_psycho.t ...... ok
Test Summary Report
-------------------
lib/croak.t (Wstat: 0 Tests: 215 Failed: 15)
Failed tests: 1-11, 13-16
Files=4, Tests=1475, 96 wallclock secs ( 0.29 usr 0.04 sys + 43.63 cusr 51.04 csys = 95.00 CPU)
Result: FAIL
$ ./perl -Ilib -V:config_args; env | grep DESTRUCT config_args='-des -Dusedevel -Dcc=clang -Accflags=-g -fno-omit-frame-pointer -fsanitize=address -fno-common -fsanitize-blacklist=/home/jkeenan/gitwork/perl/asan_ignore -Aldflags=-fsanitize=address -Duseithreads'; PERL_DESTRUCT_LEVEL=2
I'm not sure what this is meant to demonstrate.
You need to set PERL_DESTRUCT_LEVEL=2 in the environment, not in Configure, eg with bash:
$ PERL_DESTRUCT_LEVEL=2 TEST_JOBS=2 make -j2 test_harness
building 5.36.0 with the Debian clang, configured:
$ ./Configure -des -Dusedevel -Dcc=clang -Dusethreads -Accflags=-fsanitize=address -Aldflags=-fsanitize=address -Dlddlflags=-shared\ -fsanitize=address
successfully compiled and tested.
blead has known leaks, addressed by #20809 and #20812
On 2/15/23 19:10, Tony Cook wrote:
$ ./perl -Ilib -V:config_args; env | grep DESTRUCT config_args='-des -Dusedevel -Dcc=clang -Accflags=-g -fno-omit-frame-pointer -fsanitize=address -fno-common -fsanitize-blacklist=/home/jkeenan/gitwork/perl/asan_ignore -Aldflags=-fsanitize=address -Duseithreads'; PERL_DESTRUCT_LEVEL=2
I'm not sure what this is meant to demonstrate.
You need to set PERL_DESTRUCT_LEVEL=2 in the environment, not in Configure, eg with bash:
That's what I did. I just wanted to print out both the config_args and the relevant envvar in a compact way after I had run test_harness.
If I get a chance I'll try to run this configuration on those pull requests.
The last part of this should be fixed by 080297a1c054c421f95cf78ca4f58a960f1d124f.
Here is an update on my attempts to build and test perl on Debian Linux using clang (version 11) with ASAN.
$ uname -a
Linux bullseye 5.10.0-18-amd64 #1 SMP Debian 5.10.140-1 (2022-09-02) x86_64 GNU/Linux
$ clang-11 --version | head -n 1
Debian clang version 11.0.1-2
$ git describe
v5.39.3-11-gb0cb9aaabb
$ export PERL_DESTRUCT_LEVEL=2
$ sh ./Configure -des -Dusedevel -Dcc=clang \
-Accflags="-g -fno-omit-frame-pointer -fsanitize=address -fno-common -fsanitize-blacklist=`pwd`/asan_ignore" -Aldflags="-fsanitize=address" \
-Duseithreads \
&& make miniperl
This completed successfully, as did make minitest
. I then ran make test_harness
where $TEST_JOBS
defaulted to 4
. I got test failures in 4 files, which I then re-ran individually:
$ cd t; TEST_JOBS=1 ./perl harness re/pat.t re/pat_psycho_thr.t run/locale.t re/pat_psycho.t; cd -
I still got one test failure:
run/locale.t ......... 41/? # Failed test 41 - check that setlocale overrides startup at run/locale.t line 580
# got "ok\n\n=================================================================\n==2789493==ERROR: LeakSanitizer: detected memory leaks\n\nDirect leak of 168 byte(s) in 1 object(s) allocated from:\n #0 0x4aecad in malloc (/home/jkeenan/gitwork/perl/perl+0x4aecad)\n #1 0x75e094 in Perl_safesysmalloc /home/jkeenan/gitwork/perl/util.c:159:21\n #2 0x99f70c in S_calculate_LC_ALL_string /home/jkeenan/gitwork/perl/locale.c:2925:13\n #3 0x9980ba in S_native_querylocale_i /home/jkeenan/gitwork/perl/locale.c:4272:12\n #4 0x9980ba in Perl_setlocale /home/jkeenan/gitwork/perl/locale.c:4381:35\n #5 0x7fd650cab0b9 in XS_POSIX_setlocale /home/jkeenan/gitwork/perl/ext/POSIX/POSIX.xs:2074:20\n #6 0x7fca4c in Perl_rpp_invoke_xs /home/jkeenan/gitwork/perl/./inline.h:859:9\n #7 0x7fca4c in Perl_pp_entersub /home/jkeenan/gitwork/perl/pp_hot.c:5910:9\n #8 0x7d870c in Perl_runops_standard /home/jkeenan/gitwork/perl/run.c:41:26\n #9 0x556c9b in S_run_body /home/jkeenan/gitwork/perl/perl.c\n #10 0x556036 in perl_run /home/jkeenan/gitwork/perl/perl.c:2725:9\n #11 0x4deaa9 in main /home/jkeenan/gitwork/perl/perlmain.c:127:9\n #12 0x7fd653d09d09 in __libc_start_main csu/../csu/libc-start.c:308:16\n\nSUMMARY: AddressSanitizer: 168 byte(s) leaked in 1 allocation(s)."
# expected "ok"
# diff at 2
# after "ok"
# have "\n\n======================================"
# want ""
# PROG:
# use POSIX;
#
# my $a_acute = "\N{LATIN SMALL LETTER A WITH ACUTE}";
# my $egrave = "\N{LATIN SMALL LETTER E WITH GRAVE}";
# my $combo = "$a_acute.$egrave";
#
# setlocale(&POSIX::LC_ALL, "C");
# use locale;
#
# # In a UTF-8 locale, \b matches Latin1 before string, mid, and end
# if ($combo eq ($combo =~ s/\b/!/gr)) {
# print "ok\n";
# }
# else {
# print "not ok\n";
# }
# STATUS: 256
=================================================================
==2789468==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 281 byte(s) in 1 object(s) allocated from:
#0 0x4aecad in malloc (/home/jkeenan/gitwork/perl/perl+0x4aecad)
#1 0x75e094 in Perl_safesysmalloc /home/jkeenan/gitwork/perl/util.c:159:21
#2 0x99f70c in S_calculate_LC_ALL_string /home/jkeenan/gitwork/perl/locale.c:2925:13
#3 0x9980ba in S_native_querylocale_i /home/jkeenan/gitwork/perl/locale.c:4272:12
#4 0x9980ba in Perl_setlocale /home/jkeenan/gitwork/perl/locale.c:4381:35
#5 0x7ff1ed4ab0b9 in XS_POSIX_setlocale /home/jkeenan/gitwork/perl/ext/POSIX/POSIX.xs:2074:20
#6 0x7fca4c in Perl_rpp_invoke_xs /home/jkeenan/gitwork/perl/./inline.h:859:9
#7 0x7fca4c in Perl_pp_entersub /home/jkeenan/gitwork/perl/pp_hot.c:5910:9
#8 0x7d870c in Perl_runops_standard /home/jkeenan/gitwork/perl/run.c:41:26
#9 0x556c9b in S_run_body /home/jkeenan/gitwork/perl/perl.c
#10 0x556036 in perl_run /home/jkeenan/gitwork/perl/perl.c:2725:9
#11 0x4deaa9 in main /home/jkeenan/gitwork/perl/perlmain.c:127:9
#12 0x7ff1f04e2d09 in __libc_start_main csu/../csu/libc-start.c:308:16
SUMMARY: AddressSanitizer: 281 byte(s) leaked in 1 allocation(s).
run/locale.t ......... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/42 subtests
(less 31 skipped subtests: 10 okay)
re/pat_psycho.t ...... ok
Test Summary Report
-------------------
run/locale.t (Wstat: 256 (exited 1) Tests: 42 Failed: 1)
Failed test: 41
Non-zero exit status: 1
Files=4, Tests=1337, 162 wallclock secs ( 0.26 usr 0.03 sys + 52.34 cusr 108.81 csys = 161.44 CPU)
Result: FAIL
Finished test run at Fri Sep 22 19:26:36 2023.
/home/jkeenan/gitwork/perl
And I got similar failure output simply running ./perl -Ilib t/run/locale.t
.
That's a different failure to your original report.
That's a different failure to your original report.
True ... but the original report was from 7 months ago, and a lot has changed since then (especially with locales).
I successfully run ASAN clang version 14.0.0-1ubuntu1.1 all the time
On Sat, Sep 23, 2023 at 08:46:26PM -0700, Karl Williamson wrote:
I successfully run ASAN clang version 14.0.0-1ubuntu1.1 all the time
Some smokers have been failing locale tests under ASAN since around v5.39.2-97, 2f7afdcea1. E.g.:
From: George Greer @.> Message-Id: @.> To: @.*** Date: Sat, 23 Sep 2023 20:15 -0400 Subject: Smoke [blead] v5.39.3-16-gde4a70f325 FAIL(F) linux 6.4.15-200.fc38.x86_64 [Fedora Linux 38] (x86_64/1 cpu[8 cores]) {blead_clang_quick_sanitize=address}
Enabled stack-use-after-return (Linux/Darwin) and leak-detection (Linux). Smok e logs available at http://m-l.org/~perl/smoke/perl/x86_64-linux-thread-multi/b lead_clang_quick_sanitize=address/logde4a70f325814c204a79d4d025b3c464f70088bb.l og.gz
Automated smoke report for branch blead 5.39.4 patch de4a70f325814c204a79d4d025 b3c464f70088bb v5.39.3-16-gde4a70f325 vier.local: Intel(R) Xeon(R) CPU E5-1620 0 @ 3.60GHz (GenuineIntel 4675MHz) (x8 6_64/1 cpu[8 cores]) on linux - 6.4.15-200.fc38.x86_64 [Fedora Linux 38] using ccache clang version Clang 16.0.6 (Fedora 16.0.6-3.fc38) smoketime 3 hours 50 minutes (average 57 minutes 40 seconds)
Summary: FAIL(F)
O = OK F = Failure(s), extended report at the bottom X = Failure(s) under TEST but not under harness ? = still running or test results not (yet) available Build failures during: - = unknown or N/A c = Configure, m = make, M = make (after miniperl), t = make test-prep
v5.39.3-16-gde4a70f325 Configuration (common) -Accflags="-g -fno-omit-frame-po
inter -fsanitize=address -fno-common -fsanitize-blacklist=pwd
/asan_ignore" -
Aldflags="-fsanitize=address" -Dcc="ccache clang"
F F F F -Duseithreads | +--------- -DDEBUGGING +----------- no debugging
Testsuite was run only with 'harness' and HARNESS_OPTIONS=j4
Failures: (common-args) -Accflags="-g -fno-omit-frame-pointer -fsanitize=addres
s -fno-common -fsanitize-blacklist=pwd
/asan_ignore" -Aldflags="-fsanitize=ad
dress" -Dcc="ccache clang"
[default]
[default] -DDEBUGGING
[default] -Duseithreads
[default] -DDEBUGGING -Duseithreads
../ext/XS-APItest/t/locale.t................................FAILED
Non-zero exit status: 1
../lib/locale.t.............................................FAILED
Non-zero exit status: 1
../t/run/locale.t...........................................FAILED
42
Non-zero exit status: 1
MANIFEST did not declare '.mailmap' (See log because mailing list size limit is too small.) Non-Fatal messages(gcc):
-- Report by Test::Smoke v1.72 running on perl 5.36.1 (Reporter v0.053 / Smoker v0.046)
It looks like calculate_LC_ALL_string() doesn't handle returning == WANT_PL_setlocale_buf
, though the only mentions of WANT_PL_setlocale_buf
are the definition in perl.h
and the call to calculate_LC_ALL_string().
On 9/24/23 18:56, Tony Cook wrote:
It looks like calculate_LC_ALL_string() doesn't handle |returning == WANT_PL_setlocale_buf|, though the only mentions of |WANT_PL_setlocale_buf| are the definition in |perl.h| and the call to calculate_LC_ALL_string().
It appears to be a problem caused during rebasing. I'm looking into it.
— Reply to this email directly, view it on GitHub https://github.com/Perl/perl5/issues/20810#issuecomment-1732738922, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2DH6MFPBBIFKG6QF45SDX4DJE3ANCNFSM6AAAAAAU4HEMXI. You are receiving this because you commented.Message ID: @.***>
I have pushed a smoke branch which hopefully fixes it. Results are at https://perl.develop-help.com/?b=smoke-me%2Fkhw-WANT, and anyone can test it themselves by checking out the branch smoke-me/khw-WANT
It looks good in smokes, corresponding reports from blead https://perl5.test-smoke.org/report/5040808 and khw-WANT https://perl5.test-smoke.org/report/5040814
It looks good in smokes, corresponding reports from blead https://perl5.test-smoke.org/report/5040808 and khw-WANT https://perl5.test-smoke.org/report/5040814
My results, on the Linux where I've been playing with ASAN.
$ git checkout smoke-me/khw-WANT
$ export PERL_DESTRUCT_LEVEL=2
$ sh ./Configure -des -Dusedevel -Dcc=clang -Accflags='-g -fno-omit-frame-pointer -fsanitize=address -fno-common -fsanitize-blacklist=/home/jkeenan/gitwork/perl/asan_ignore' -Aldflags=-fsanitize=address -Duseithreads && make minitest_prep
$ make minitest && make test
...
All tests successful.
I have created a pull request from @khwilliamson's smoke-me/khw-WANT branch mentioned above.
Inspired by some discussion on #p5p, I decided to try to build a
perl
on Linux (Debian 11) withclang
and ASAN. I make no claim to knowing what I'm doing in ASAN territory; I did not have any clear idea of what the results would be. I found that when I configured with arguments similar to those used in George Greer's smoke-testing reports (e.g., https://perl5.test-smoke.org/report/5030661), I was able to get at least as far as building miniperl with ASAN and unthreaded builds -- but not with threaded builds.Threaded builds
I've tried the following at tags v5.34.0 and v5.36.0 as well as blead.
Compilation failed like this:
... followed by a long list of direct and indirect leaks.
Unthreaded builds
If I simply dropped the
-Duseithreads
from the configuration, miniperl would build on v5.34.0, v5.36.0 and blead (v5.37.8-172-gd0613d9c78
).On
v5.34.0
, in the ASAN unthreaded build, I got 2 test failures inmake test_harness
:However, when I tested just those two files, I got a PASS.
(I didn't completely test
v5.36.0
.)On blead, in the ASAN unthreaded build, I got 4 test failures:
Re-running just the failing files, I got 3 PASSes and 1 FAIL.
To what extent are these results plausible? First, failure to get as far as
miniperl
with clang, ASAN and threads?Second, inconsistent test failures with ASAN but without threads?