Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc --sanitize doesnt work (missing stuff from procfs prevents address-sanitizer from working) #1898

Closed
LewisPringle opened this issue Apr 12, 2017 · 8 comments

Comments

@LewisPringle
Copy link

LewisPringle commented Apr 12, 2017

Please use the following bug reporting template to help produce actionable and reproducible issues. Please try to ensure that the reproduction is minimal so that the team can go through more bugs!

  • A brief description
    Compiling a program with gcc --sanitize=address doesn't work
    (https://en.wikipedia.org/wiki/AddressSanitizer -fsanitize=address

  • Expected results

  • Actual results (with terminal output if applicable)
    sanitizer_procmaps_linux.cc:55 "((IsOneOf(*current_, 's', 'p'))) != (0)" (0x0, 0x0)

  • Your Windows build number
    16170

  • Steps / All commands required to reproduce the error from a brand new installation
    compile any program with gcc --sanitize=address and run it.

  • Strace of the failing command

  • Required packages and commands to install

See our contributing instructions for assistance.

@aseering
Copy link
Contributor

aseering commented Apr 12, 2017

Hi again @LewisPringle -- it looks like you haven't yet had a chance to fill out the ticket description. Could you please do when you get a chance?

clang's implementation of AddressSanitizer is briefly discussed on #120 (comment) , for what it's worth. That's a rather old comment; it may no longer be relevant with recent builds. But it's described as having different issues; not this particular issue.

@LewisPringle
Copy link
Author

LewisPringle commented Apr 13, 2017

Sorry - new to your process ;-)

Note - the reason this is an IMPORTANT bug to fix (or missing feature if you prefer) - is because one of the primary target audiences for unix on windows - are developers, and this is a basic developer tool.

@therealkenc
Copy link
Collaborator

This is the same problem as described in #708 (message). Or at least, that is what is causing the IsOneOf(*current_, 's', 'p') to fail, anyway.

@firewave
Copy link

Using build 16299 the compilation now works for me. But the program fails to run.

My code looks like this

#include <string.h>

int main() {
	char arr[2];
	strcpy(arr, "str");
	return 0;
}

Using the following command-line

gcc -fsanitize=address crash.c -o crash

@g-berthiaume
Copy link

Update 2019: The gcc flag -fsanitize=address doesn't seems to work.

  • Tests

I was following this blog post from Daniel Lemire.

test

  • Expected results
    I was excepting this output
$ ./s
=================================================================
==3911==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1024 byte(s) in 1 object(s) allocated from:
    #0 0x7f55516b644a in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9444a)
    #1 0x40084e in main /home/dlemire/tmp/s.c:6
    #2 0x7f555127eec4 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ec4)

SUMMARY: AddressSanitizer: 1024 byte(s) leaked in 1 allocation(s).
  • Windows version
    1809

@therealkenc
Copy link
Collaborator

I wasn't able to reproduce the previous post's testcase here. The OP for this issue was with respect a malformed /proc entry which has since been addressed and was dupe #708 and should have been closed in 2017. This issue was lost in the noise.

In principle you could open a new issue regarding your demonstrable lack of output from the sanitizer (a different problem), but to be actionable it would (from a practical standpoint) need some kind of reproduction steps from a clean install. My test was done on Insider 18865, but it is unlikely that will be of difference (with the usual caveat anything possible). I don't think you are doing anything wrong, but at the moment I can't divine the difference between our runs either.

image

@g-berthiaume
Copy link

Thanks for your feedback.
I'm not sure what is going on. I will investigate. Maybe reinstall gcc ?
In anycase, you have my thanks.

@Brian-Perkins
Copy link

Also see #3589 which was fixed after 1809.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants