Re: AddressSanitizer and the GC

2017-07-21 Thread Walter Bright via Digitalmars-d
On 7/21/2017 2:37 PM, Johan Engelen wrote: Can you advise me on where best to add the asan calls? Offhand, I don't know. It's been maybe 15 years since I worked on it, and a lot of people have moved things about since then. Dmitry Olshansky has worked on it very recently, in fact he is

Re: AddressSanitizer and the GC

2017-07-21 Thread Walter Bright via Digitalmars-d
On 7/21/2017 2:39 PM, Johan Engelen wrote: Quick extra note: the function pointer solution is not friendly to LTO, whereas a weak-linking solution would easily be optimized-out fully with LTO. So that's something to consider too. This code should be version'd with: version

Re: AddressSanitizer and the GC

2017-07-21 Thread Walter Bright via Digitalmars-d
On 7/21/2017 2:14 PM, Johan Engelen wrote: On Friday, 21 July 2017 at 20:56:02 UTC, Walter Bright wrote: If anyone is game, it would be cool to do an LLVM compile of DMD so AddressSanitizer can look for bugs in DMD itself. Yep, I've got fuzzing to work too, so... expect nice blogs "soon". ;-)

Re: AddressSanitizer and the GC

2017-07-21 Thread Johan Engelen via Digitalmars-d
On Friday, 21 July 2017 at 21:37:39 UTC, Johan Engelen wrote: On Friday, 21 July 2017 at 20:53:18 UTC, Walter Bright wrote: On 7/21/2017 12:06 PM, Johan Engelen wrote: < [...] Another option is to use a pointer to the asan functions, like: if (asan_fp) (*asan_fp)(args...) The

Re: AddressSanitizer and the GC

2017-07-21 Thread Johan Engelen via Digitalmars-d
On Friday, 21 July 2017 at 20:53:18 UTC, Walter Bright wrote: On 7/21/2017 12:06 PM, Johan Engelen wrote: < [...] Thanks for your work on this. It is important to support such valuable tools. One way making such things pretty much cost-free in the olden days was to trick the linker into

Re: AddressSanitizer and the GC

2017-07-21 Thread Johan Engelen via Digitalmars-d
On Friday, 21 July 2017 at 20:56:02 UTC, Walter Bright wrote: On 7/21/2017 12:06 PM, Johan Engelen wrote: I've added AddressSanitizer [1] support to LDC, and it is able to nicely catch bugs like this one: If anyone is game, it would be cool to do an LLVM compile of DMD so AddressSanitizer

Re: AddressSanitizer and the GC

2017-07-21 Thread Walter Bright via Digitalmars-d
On 7/21/2017 12:06 PM, Johan Engelen wrote: I've added AddressSanitizer [1] support to LDC, and it is able to nicely catch bugs like this one: If anyone is game, it would be cool to do an LLVM compile of DMD so AddressSanitizer can look for bugs in DMD itself.

Re: AddressSanitizer and the GC

2017-07-21 Thread Walter Bright via Digitalmars-d
On 7/21/2017 12:06 PM, Johan Engelen wrote: < [...] Thanks for your work on this. It is important to support such valuable tools. One way making such things pretty much cost-free in the olden days was to trick the linker into writing NOPs over the function calls by using specially crafted

AddressSanitizer and the GC

2017-07-21 Thread Johan Engelen via Digitalmars-d
Hi all, I've added AddressSanitizer [1] support to LDC, and it is able to nicely catch bugs like this one: ``` void foo(int* arr) { arr[10] = 1; } void main() { int[10] a; foo([0]); } ``` It works for malloc'ed memory, but not yet for GC'd memory. Our GC pool memory is