Page MenuHomePhabricator

clemenswasser (Clemens Wasser)
User

Projects

User does not belong to any projects.

User Details

User Since
Jan 5 2021, 2:49 PM (108 w, 6 d)

Recent Activity

Wed, Feb 1

clemenswasser added a comment to D115103: Leak Sanitizer port to Windows.

Wow, this fixed a lot of tests, down to only 17 lsan standalone tests failing :) (26 already passing)

Wed, Feb 1, 12:09 PM · Restricted Project, Restricted Project, Restricted Project
clemenswasser added a comment to D115103: Leak Sanitizer port to Windows.

@aganea Thank you very much!

Wed, Feb 1, 12:04 PM · Restricted Project, Restricted Project, Restricted Project
clemenswasser added a comment to D115103: Leak Sanitizer port to Windows.

@vitalybuka There seems to be a bug in MSVCs bit-field implementation, which causes the disable.c test to fail.
This reproducer (assert) passes with gcc and fails with MSVC (m.tag is 0xffffffff):

cpp
#include <stdint.h>
#include <assert.h>
Wed, Feb 1, 11:58 AM · Restricted Project, Restricted Project, Restricted Project

Dec 7 2022

clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.

@vitalybuka
I've been working on this on-off for the past months and have gotten the tests in the following state:

Unsupported: 41
Passed     : 19
Failed     : 48

There is still the bug with the tracer thread deadlocking during an allocation made in the Microsoft CRT thread setup code when using Asan+Lsan.
I hope I can get the failing tests passing.

Dec 7 2022, 1:41 PM · Restricted Project, Restricted Project, Restricted Project

Jul 16 2022

clemenswasser abandoned D120211: Remove unused includes.
Jul 16 2022, 2:36 PM · Restricted Project, Restricted Project
clemenswasser abandoned D120213: [CodeGen] Forward declare classes & remove includes.
Jul 16 2022, 2:36 PM · Restricted Project, Restricted Project
clemenswasser abandoned D120212: [Bitcode] Forward declare classes & remove includes.
Jul 16 2022, 2:35 PM · Restricted Project, Restricted Project
clemenswasser abandoned D120210: [Analysis] Forward declare classes & remove includes.
Jul 16 2022, 2:35 PM · Restricted Project, Restricted Project
clemenswasser abandoned D120209: [Transforms] Forward declare classes & remove includes.
Jul 16 2022, 2:35 PM · Restricted Project, Restricted Project

Apr 23 2022

clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.

I have now split the lsan TestCases chages into https://reviews.llvm.org/D124322
and managed to get the lsan+asan TestCases nearly to work. The current problem is,
that during the start of the RunThread in StopTheWorld, we are intercepting a call
to calloc done by the ucrt in ucrtbase!DllMainDispatch, which somehow results in a deadlock.
If someone has an idea, how we could avoid/fix this, I would be very happy to hear it.

Apr 23 2022, 2:02 AM · Restricted Project, Restricted Project, Restricted Project
clemenswasser requested review of D124322: Make lsan TestCases more consistent.
Apr 23 2022, 1:36 AM · Restricted Project, Restricted Project

Apr 10 2022

clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.

I always forget to change the line endings, sorry :(

Apr 10 2022, 9:52 AM · Restricted Project, Restricted Project, Restricted Project
clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.

Since I am currently unable to intercept the ExitProcess/TerminateProcess in the ucrt (exit_or_terminate_process in Windows Kits\10\Source\10.0.22000.0\ucrt\startup\exit.cpp:143)
I inserted a call to Die in HandleLeaks (just like on Linux). This brings the passing Test up to 22

Apr 10 2022, 9:41 AM · Restricted Project, Restricted Project, Restricted Project
clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.

The CI seems to fail because of the parent revision? Retry

Apr 10 2022, 8:57 AM · Restricted Project, Restricted Project, Restricted Project
clemenswasser updated the summary of D115103: Leak Sanitizer port to Windows.
Apr 10 2022, 8:51 AM · Restricted Project, Restricted Project, Restricted Project
clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.

I was wrong, the Problem was, that I didn't change the exit code, when a leak gets detected.
I now intercept ExitProcess and change the exit code in there, with this there are already 12 Tests passing on Windows.

Apr 10 2022, 8:39 AM · Restricted Project, Restricted Project, Restricted Project

Apr 9 2022

clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.

Hi,
today I found some more time to play/progress with this patch. I'm generally optimistic that most of the basic lsan stuff should already be working on Windows.
However without some help of you, I'm unable to get the tests to properly work. The main Problem I looked into today is that llvm-lit.py seems to be somehow unable to capture the stdout/err of the tests. More precisely my Debugging showed that when I insert a print(procs[-1].stdout.read()) at TestRunner.py:790 I get the correctly captured stdout of a test e.g.:

=================================================================
==25028==ERROR: LeakSanitizer: detected memory leaks
Apr 9 2022, 3:13 PM · Restricted Project, Restricted Project, Restricted Project

Feb 20 2022

clemenswasser added inline comments to D120211: Remove unused includes.
Feb 20 2022, 11:14 AM · Restricted Project, Restricted Project
clemenswasser added inline comments to D120211: Remove unused includes.
Feb 20 2022, 10:13 AM · Restricted Project, Restricted Project
clemenswasser added inline comments to D120211: Remove unused includes.
Feb 20 2022, 10:08 AM · Restricted Project, Restricted Project
clemenswasser requested review of D120213: [CodeGen] Forward declare classes & remove includes.
Feb 20 2022, 7:35 AM · Restricted Project, Restricted Project
clemenswasser requested review of D120212: [Bitcode] Forward declare classes & remove includes.
Feb 20 2022, 7:31 AM · Restricted Project, Restricted Project
clemenswasser requested review of D120211: Remove unused includes.
Feb 20 2022, 7:29 AM · Restricted Project, Restricted Project
clemenswasser requested review of D120210: [Analysis] Forward declare classes & remove includes.
Feb 20 2022, 7:27 AM · Restricted Project, Restricted Project
clemenswasser updated the diff for D120208: [tools] Forward declare classes & remove includes.

Update Patch. I reformatted but diffed the wrong commit hash, sorry :(

Feb 20 2022, 7:25 AM · Restricted Project, Restricted Project
clemenswasser updated the diff for D120209: [Transforms] Forward declare classes & remove includes.

Update Patch. I reformatted but diffed the wrong commit hash, sorry :(

Feb 20 2022, 7:23 AM · Restricted Project, Restricted Project
clemenswasser updated the diff for D120208: [tools] Forward declare classes & remove includes.

Fix Patch

Feb 20 2022, 6:55 AM · Restricted Project, Restricted Project
clemenswasser updated the diff for D120209: [Transforms] Forward declare classes & remove includes.

Fix Patch

Feb 20 2022, 6:54 AM · Restricted Project, Restricted Project
clemenswasser added a comment to D120209: [Transforms] Forward declare classes & remove includes.

Wow, I was so confused... thanks!

Feb 20 2022, 6:53 AM · Restricted Project, Restricted Project
clemenswasser updated the diff for D120209: [Transforms] Forward declare classes & remove includes.

Rebase patch

Feb 20 2022, 6:31 AM · Restricted Project, Restricted Project
clemenswasser updated the diff for D120208: [tools] Forward declare classes & remove includes.

Rebase patch

Feb 20 2022, 6:31 AM · Restricted Project, Restricted Project
clemenswasser requested review of D120209: [Transforms] Forward declare classes & remove includes.
Feb 20 2022, 6:29 AM · Restricted Project, Restricted Project
clemenswasser requested review of D120208: [tools] Forward declare classes & remove includes.
Feb 20 2022, 6:24 AM · Restricted Project, Restricted Project

Jan 13 2022

clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.

Updated the Tests.
The Problem with Lsan+Asan still exists. I have just disabled them for now.
I hope anyone can help me with getting the tests to run correctly?

Jan 13 2022, 8:56 AM · Restricted Project, Restricted Project, Restricted Project

Jan 7 2022

clemenswasser added a comment to D115103: Leak Sanitizer port to Windows.

All the lsan tests, when run in lsan+asan mode, Deadlock in StopTheWord when creating the tracer thread...


-> check-lsan gets stuck, due to all the deadlocking tests :(

Jan 7 2022, 11:49 AM · Restricted Project, Restricted Project, Restricted Project
clemenswasser added a comment to D115103: Leak Sanitizer port to Windows.

@aganea Thanks for your help. I already did everything you wrote (I am however using the coreutils provided by Git).
check-asan works on my new computer. I still don't know why it didn't work on my older one...
I will try to get the lsan tests working (and hopefully passing 😉) on windows soon.

Jan 7 2022, 9:28 AM · Restricted Project, Restricted Project, Restricted Project

Dec 24 2021

clemenswasser added a comment to D115103: Leak Sanitizer port to Windows.

@vitalybuka
No check-asan doesn't work for me. It just hangs forever and does absolutely nothing. No output, nothing showing up in Task Manager with high CPU usage or anything.
However check-clang does work. Is there some documentation on running check-asan on windows.
I also saw that none of the Windows buildbots check/test anything related to sanitizers. It seems to me that none of the sanitizer stuff gets ever tested on Windows?
Do the test for sanitizers_common/asan/ubsan/etc. even work on Windows?

Dec 24 2021, 8:26 AM · Restricted Project, Restricted Project, Restricted Project

Dec 23 2021

clemenswasser added a comment to D115103: Leak Sanitizer port to Windows.

@vitalybuka I have now removed all LSAN_BASE occurrences.
However the invocations of the compiled test executables don't seem to work either.
This doesn't work:
// RUN: %env_lsan_opts=use_stacks=0:use_registers=0 not %run %t foo 2>&1 | FileCheck %s --check-prefix=CHECK-do
It generates this error:

[build] $ ":" "RUN: at line 3"
[build] $ "env" "LSAN_OPTIONS=:detect_leaks=1:use_stacks=0:use_registers=0" "not" "E:\git\llvm-project\llvm\build\ninja_debug\projects\compiler-rt\test\lsan\X86_64LsanConfig\TestCases\Output\leak_check_at_exit.cpp.tmp.exe" "foo"
[build] note: command had no output on stdout or stderr
[build] error: command failed with exit status: True
Dec 23 2021, 4:41 AM · Restricted Project, Restricted Project, Restricted Project

Dec 22 2021

clemenswasser added a comment to D115103: Leak Sanitizer port to Windows.

The problem is, that LSAN_BASE is not always use_stacks=0:use_registers=0.
Also there are many test cases, where LSAN_BASE gets used multiple times.
Removing it would result in bad repetition.

Dec 22 2021, 3:07 PM · Restricted Project, Restricted Project, Restricted Project
clemenswasser added a comment to D115103: Leak Sanitizer port to Windows.

@vitalybuka could you or someone else help me get the lsan tests running on Windows?
For example lets look at compiler-rt\test\lsan\TestCases\leak_check_at_exit.cpp (and basically all other tests, this serves as an easy example)
I imagine that the following defines a variable called LSAN_BASE :
// RUN: LSAN_BASE="use_stacks=0:use_registers=0"
This doesn't seem to work on Windows.
It gives the following error message:

[build] $ ":" "RUN: at line 2"
[build] $ "LSAN_BASE=use_stacks=0:use_registers=0"
[build] # command stderr:
[build] 'LSAN_BASE=use_stacks=0:use_registers=0': command not found
Dec 22 2021, 2:27 PM · Restricted Project, Restricted Project, Restricted Project

Dec 18 2021

clemenswasser updated the diff for D115204: Port __sanitizer::StopTheWorld to Windows.

Fix continue in loop.
Thanks @mstorsjo!

Dec 18 2021, 3:38 AM · Restricted Project
clemenswasser added inline comments to D115204: Port __sanitizer::StopTheWorld to Windows.
Dec 18 2021, 3:35 AM · Restricted Project
clemenswasser updated the diff for D115204: Port __sanitizer::StopTheWorld to Windows.

Fix warning

Dec 18 2021, 3:15 AM · Restricted Project

Dec 17 2021

clemenswasser added a comment to D115204: Port __sanitizer::StopTheWorld to Windows.

@mstorsjo probably my only option is to silence the warning locally?

Dec 17 2021, 3:12 PM · Restricted Project
clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.

Simplify Architecture checks

Dec 17 2021, 1:54 PM · Restricted Project, Restricted Project, Restricted Project
clemenswasser added a comment to D115204: Port __sanitizer::StopTheWorld to Windows.

@clemenswasser Please upload fixed version here and we will try again

Dec 17 2021, 1:35 PM · Restricted Project
clemenswasser updated the diff for D115204: Port __sanitizer::StopTheWorld to Windows.

Fix typo

Dec 17 2021, 1:33 PM · Restricted Project
clemenswasser updated the diff for D115204: Port __sanitizer::StopTheWorld to Windows.

@mstorsjo I hope this fixes all of your Problems.
For me all sanitizer tests pass on X64 and I386.
Could someone test if the tests also pass on ARM and ARM64?

Dec 17 2021, 1:25 PM · Restricted Project
clemenswasser added a comment to D115204: Port __sanitizer::StopTheWorld to Windows.

@mstorsjo sorry for the inconveniences.
I am quite busy right now. I will probably fix this either later today or tomorrow.

Dec 17 2021, 10:19 AM · Restricted Project

Dec 16 2021

clemenswasser added a comment to D115204: Port __sanitizer::StopTheWorld to Windows.

Please update the summary, in particular remove:

So I couldn't test if this port actually works
Many other SanitizerUnitTests fail to compile (look in the attached log):

I assume you have resolve the issue in the summary?

Dec 16 2021, 1:27 PM · Restricted Project
clemenswasser updated the summary of D115204: Port __sanitizer::StopTheWorld to Windows.
Dec 16 2021, 1:26 PM · Restricted Project

Dec 14 2021

clemenswasser updated the diff for D115204: Port __sanitizer::StopTheWorld to Windows.

Disable SegvInCallback test on Windows

Dec 14 2021, 1:17 AM · Restricted Project

Dec 12 2021

clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.

Implement ProcessGlobalRegions
Fix Interceptors for Windows

Dec 12 2021, 6:23 AM · Restricted Project, Restricted Project, Restricted Project

Dec 11 2021

clemenswasser requested review of D115584: [lsan] Format CAN_SANITIZE_LEAKS defines.
Dec 11 2021, 12:55 PM · Restricted Project

Dec 10 2021

clemenswasser added inline comments to D115204: Port __sanitizer::StopTheWorld to Windows.
Dec 10 2021, 12:46 AM · Restricted Project

Dec 8 2021

clemenswasser updated the diff for D115204: Port __sanitizer::StopTheWorld to Windows.

Add error handling

Dec 8 2021, 11:52 AM · Restricted Project

Dec 7 2021

clemenswasser added inline comments to D115204: Port __sanitizer::StopTheWorld to Windows.
Dec 7 2021, 11:57 PM · Restricted Project
clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.
Dec 7 2021, 9:53 AM · Restricted Project, Restricted Project, Restricted Project
clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.

Split this patch up into multiple smaller ones:

Dec 7 2021, 9:50 AM · Restricted Project, Restricted Project, Restricted Project
clemenswasser requested review of D115262: Format lsan.h.
Dec 7 2021, 9:24 AM · Restricted Project
clemenswasser added inline comments to D115103: Leak Sanitizer port to Windows.
Dec 7 2021, 7:44 AM · Restricted Project, Restricted Project, Restricted Project
clemenswasser updated the diff for D115204: Port __sanitizer::StopTheWorld to Windows.

Catch all SEH Exceptions like EXCEPTION_ACCESS_VIOLATION during execution of the callback in StopTheWorld and report them.
This makes the last failing test SegvInCallback pass on Windows 🎉

Dec 7 2021, 6:14 AM · Restricted Project
clemenswasser updated the diff for D115204: Port __sanitizer::StopTheWorld to Windows.

Cleanup of the StopTheWorld implementation.
Fix the following bug:

@vitalybuka I can now run the tests on Windows. However the SuspendThreadsAdvanced test currently fails.
I think it fails because of an issue in my implementation of StopTheWorld.
The problem is that between the call to CreateToolhelp32Snapshot and suspending the Threads, there are still new threads being created, which are then not part of the snapshot.
Because of that, new threads can't being suspended.
Do you (or someone else) have any idea how I could fix this?

Dec 7 2021, 5:43 AM · Restricted Project
clemenswasser updated the diff for D115204: Port __sanitizer::StopTheWorld to Windows.

clang-format :(

Dec 7 2021, 5:11 AM · Restricted Project
clemenswasser added a comment to D115204: Port __sanitizer::StopTheWorld to Windows.

@vitalybuka I can now run the tests on Windows. However the SuspendThreadsAdvanced test currently fails.
I think it fails because of an issue in my implementation of StopTheWorld.
The problem is that between the call to CreateToolhelp32Snapshot and suspending the Threads, there are still new threads being created, which are then not part of the snapshot.
Because of that, new threads can't being suspended.
Do you (or someone else) have any idea how I could fix this?

Dec 7 2021, 5:09 AM · Restricted Project
clemenswasser added a comment to D115204: Port __sanitizer::StopTheWorld to Windows.

Many other SanitizerUnitTests fail to compile (look in the attached log):

Something wrong with the compiler. Can you try different revisions and compare results HEAD, HEAD~10000 etc.?
If it's broken on HEAD then you can file a bug.

Dec 7 2021, 4:39 AM · Restricted Project
clemenswasser updated the diff for D115204: Port __sanitizer::StopTheWorld to Windows.

Hopefully fixes test StopTheWorld.SuspendThreadsAdvanced

Dec 7 2021, 4:24 AM · Restricted Project
clemenswasser added a comment to D115186: Change __lsan::kMaxAllowedMallocSize literal types to unsigned long long.

@vitalybuka No I don't have permissions to push. Could you please do it for me :)

Dec 7 2021, 3:57 AM · Restricted Project
clemenswasser updated the diff for D115204: Port __sanitizer::StopTheWorld to Windows.

Remove ASSERT_NO_THROW from StopTheWorld tests

Dec 7 2021, 3:37 AM · Restricted Project

Dec 6 2021

clemenswasser requested review of D115204: Port __sanitizer::StopTheWorld to Windows.
Dec 6 2021, 4:27 PM · Restricted Project
clemenswasser added a comment to D115186: Change __lsan::kMaxAllowedMallocSize literal types to unsigned long long.

S

I assume you have no committer access?

I don't know. Is that important. Can you please explain what you mean by that? :)

If you asking then you unlikely have one. :) you can't push into git repo.
Someone else will need to commit patches for your, often reviewer.
I will do that.

Dec 6 2021, 3:48 PM · Restricted Project
clemenswasser added a comment to D115186: Change __lsan::kMaxAllowedMallocSize literal types to unsigned long long.

I assume you have no committer access?

Dec 6 2021, 2:45 PM · Restricted Project
clemenswasser requested review of D115186: Change __lsan::kMaxAllowedMallocSize literal types to unsigned long long.
Dec 6 2021, 1:48 PM · Restricted Project
clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.

Remove wrong interceptors

Dec 6 2021, 3:59 AM · Restricted Project, Restricted Project, Restricted Project
clemenswasser added reviewers for D115103: Leak Sanitizer port to Windows: kcc, dvyukov.
Dec 6 2021, 2:06 AM · Restricted Project, Restricted Project, Restricted Project

Dec 4 2021

clemenswasser updated the summary of D115103: Leak Sanitizer port to Windows.
Dec 4 2021, 2:44 PM · Restricted Project, Restricted Project, Restricted Project
clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.

Use LF line endings

Dec 4 2021, 1:11 PM · Restricted Project, Restricted Project, Restricted Project
clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.

Apply clang-format

Dec 4 2021, 1:08 PM · Restricted Project, Restricted Project, Restricted Project
clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.

Move __lsan_init call inside of SANITIZER_WINDOWS ifdef

Dec 4 2021, 12:56 PM · Restricted Project, Restricted Project, Restricted Project
clemenswasser updated the diff for D115103: Leak Sanitizer port to Windows.

Changed to core.autocrlf=false

Dec 4 2021, 12:47 PM · Restricted Project, Restricted Project, Restricted Project
clemenswasser updated the summary of D115103: Leak Sanitizer port to Windows.
Dec 4 2021, 12:36 PM · Restricted Project, Restricted Project, Restricted Project
clemenswasser requested review of D115103: Leak Sanitizer port to Windows.
Dec 4 2021, 12:11 PM · Restricted Project, Restricted Project, Restricted Project

Jan 23 2021

clemenswasser added a comment to D95184: [ASan] Stop blocking child thread progress from parent thread in `pthread_create` interceptor..

You should also change compiler-rt/lib/asan/asan_win.cpp like this:

diff --git a/compiler-rt/lib/asan/asan_win.cpp b/compiler-rt/lib/asan/asan_win.cpp
index 8044ae16ff9b..1577c83cf994 100644
--- a/compiler-rt/lib/asan/asan_win.cpp
+++ b/compiler-rt/lib/asan/asan_win.cpp
@@ -134,7 +134,7 @@ INTERCEPTOR(int, _except_handler4, void *a, void *b, void *c, void *d) {
 static thread_return_t THREAD_CALLING_CONV asan_thread_start(void *arg) {
   AsanThread *t = (AsanThread *)arg;
   SetCurrentThread(t);
-  return t->ThreadStart(GetTid(), /* signal_thread_is_registered */ nullptr);
+  return t->ThreadStart(GetTid());
 }
Jan 23 2021, 6:43 AM · Restricted Project