-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Adding address sanitizer to auto running tests #10
Comments
Thanks for looking into this! You probably need to install |
I tried installing clang, and setting the environment variable CC to clang. I get:
I think it doesn't work with alpine: google/sanitizers#1080 |
Yeah, you're right! I think alpine is preferred, since it's a really lightweight distribution, but it might be possible to choose another distro if we have to. I'm not sure how we would add this to the test-runner based on how it works right now. Do we really want the solution to fail, if the sanitizer gives a warning? I just remembered that @wolf99 opened an issue on this in the automated-tests repo, see: exercism/automated-tests#39 |
I think that if a student has a buffer over flow, a memory leak or a use
after free, their solution is wrong, and I will want to detect this.
These at not warnings, but bugs (and potential vulnerabilities) that are
detected.
…On Mon, Jul 20, 2020, 13:26 Johan Berg ***@***.***> wrote:
Yeah, you're right!
I think alpine is preferred, since it's a really lightweight distribution,
but it might be possible to choose another distro if we have to.
I'm not sure how we would add this to the test-runner based on how it
works right now. Do we really want the solution to fail, if the sanitizer
gives a warning?
I just remembered that @wolf99 <https://github.com/wolf99> opened an
issue on this in the automated-tests repo, see:
exercism/automated-tests#39
<exercism/automated-tests#39>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMBEONJLZJ2M5PAQ2FMGJTR4QLU7ANCNFSM4O6G23GQ>
.
|
I agree that we would want to detect this. However, for a student trying to learn C, an asan error message will probably be very confusing. I think it would be better if we could run this separately, and not as a part of the test run. And let mentors provide automatic feedback which will be more easy to understand for the students. |
The output for a leak (gcc 9.3 on ubuntu) is:
(Just added a malloc somewhere and compiled). This is pretty straight froward - just a stack trace of an allocation that wasn't free. This is, hopefully easy enough to swallow. This is the output for a buffer overflow:
Generated with: int *a = malloc(1);
a[2] = 3;
free(a); This is a little harder to swallow, but the main part is the stack trace. I guess we can filter some of this, or help a student having trouble. |
I'll cc @exercism/c for some more input on this. For those of you who don't know what this repo is about, it is used to enable in-browser coding for version 3 of Exercism. The student will be able to press a button and run the tests in a Docker container and be presented with the results. To see this in action: https://research.exercism.io/experiments/1 |
We've maintained a memory check Make target for years in the C track (first with valgrind and later using ASAN), but it was never enabled by default so that students who aren't expecting it don't see it. I think there's a lot of value to having it but I do worry about a student writing their first C program and seeing that error. If it was explained first for the student, or if it was somehow opt-in to avoid confusion, it would be much more useful. I haven't followed much of the v3 work, but there could easily be a whole exercise showing "here's how C lets you do dangerous things with memory, here's why you don't want to do that, and here is a tool (ASAN) that we'll now run on the exercises to make sure those problems are caught". |
Exercism V3 doesn't really focus so much on aspects that different tools can bring (such as a memory sanitizer). With that in mind, and the reasoning with which we left memory checking as optional in V2, I would err on the side of leaving it as optional. At least for now. I guess depending on how V3 pans out it may be good to add in a at a later stage. May be worth raising in the V3 slack channel though to get some more opinions on.
Has it been that long already! 😄 Time flies when you're having fun |
This discussion has divided into three different things:
If someone thinks that 1 shouldn't be answered with "YES!", I suggest we move that discussion into a separate issue, just so things are kept organized. I opened issue #11 for discussing point 2. Point 3 is actually the reason I opened this issue. Should I move this discussion into a separate issue? Should I edit the title? |
I asked a question about this in the Exercism slack v3 channel. It was suggested by @iHiD and @ErikSchierboom to use the analyzer for this, see https://github.com/exercism/automated-analysis |
(@elyashiv Happy to answer questions on the why/what/how behind that if you have any! :)) |
Some of the most common errors are only caught by the address sanitizer.
I started looking into adding it into the tests runner.
The first obstacle I encountered is that alpine linux doesn't seem to support the address sanitizer, and it is used as the docker base.
The text was updated successfully, but these errors were encountered: