-
-
Notifications
You must be signed in to change notification settings - Fork 668
Allow to run the DMD testsuite on hardened systems #7420
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
Conversation
|
Okay so regarding: -> I updated the |
test/runnable/test_cdvecfill.d
Outdated
| foreach (arch; [EnumMembers!Arch]) | ||
| { | ||
| auto args = [dmd, "-c", "-O", "-mcpu=" ~ arch.to!string, "test/runnable/test_cdvecfill.d"]; | ||
| auto args = [dmd, "-c", "-fPIC", "-O", "-mcpu=" ~ arch.to!string, "test/runnable/test_cdvecfill.d"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line in the update script isn't necessary itself because the default dmd.conf for Linux x86_64 already adds -fPIC as default flag, but imho explicitness helps.
bf89166 to
26fea93
Compare
| /* pop rcx */ 0x59, | ||
| /* pop rbp */ 0x5d, | ||
| /* ret */ 0xc3, | ||
| ]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this code change necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently when emitting position-independent code, different registers are used. There's an update script included in this file which I used to update the test cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be prudent to keep the original test for Non-PIC and simply keep this PR as a simple addition? My motivation being to test both scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I could use version(D_PIC), but this would make the update script more complex. And I'm not sure it's necessary, because this script is only run under Linux x86_64 atm and since 2.072.2 dmd uses -fPIC for compiled programs on Linux as default (for Darwin -fPIC is even fixed). Anyhow, if I add the old test cases, this would only make sense, if they are run as part of the test suite and then if not in version(PIE) we would have to detect if the environment is hardened and then avoid running the test cases.
And in case this will ever be needed, the original code is still saved in git and alternatively it can be easily regenerated with Martin's fancy update script.
So I would only do this extra work if @MartinNowak or @WalterBright think it's essential.
|
Looks like this may address this issue: https://issues.dlang.org/show_bug.cgi?id=18013 |
Yes it will. I'm a Arch Linux user myself, so I constantly bump into the |
|
Can you add this to the list of bugs fixed: My fix is a bit different, I'll push it soon so we can compare our approaches. |
|
I don't think your PR fixes all of the issues from 18014. When running: docker run -it zombinedev/dmd-test-suite-docker --repos:dmd:pr/7420I get these errors: Though it gets much further than: docker run -it zombinedev/dmd-test-suite-docker --repos:dmd:masterWhich can't even build the test runner ( |
|
I'll see if with your fix for 18013 my branch finally passes the test suite, and if that's the case I'll open an alternative PR. |
Seems like we have to go with three containers :/ |
ac30592 to
8ece1fa
Compare
|
Looks like we are good to go here :) The docker image is based on this: https://github.com/wilzbach/dlang-docker/blob/master/circleci/dlang.docker Why 3 jobs and not 2?Code coverage:
Why is there now
|
|
Ah I forgot to mention - the https://circleci.com/workflow-run/cd281b04-466e-4db5-b44d-c6281a3b31db |
| no_pic: | ||
| working_directory: ~/dmd | ||
| docker: | ||
| - image: circleci/node:4.8.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could replace this with a D Docker image that doesn't require -fPIC, e.g. https://github.com/wilzbach/dlang-docker/blob/master/circleci/dlang.docker built for Ubuntu 14.04, but this should be more than fine for now (it's the existing status quo after all).
| parallelism: 2 | ||
| branches: | ||
| ignore: | ||
| - dmd-1.x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This didn't work with the new workflow setting and AFAICT is only required for the respective branch anyways.
| command: ./.circleci/run.sh coverage | ||
| name: Run testsuite with -cov | ||
| command: ./.circleci/run.sh all | ||
| name: Run all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reduced the commands to "all", s.t. it's easier to maintain both jobs.
| endif | ||
| export DFLAGS | ||
| endif | ||
| REQUIRED_ARGS+=$(PIC_FLAG) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the other PRs that's all that's needed to fix the test suite for -fPIC :)
| check-clean-git) echo "removed" ;; | ||
| codecov) | ||
| echo "removed - use 'all'" | ||
| ;& |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fall-through is required, s.t. existing PRs don't need to be rebased, but will call all automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a good idea to add that as a comment to the script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Done.
|
Does the test suite pass? Even test/runnable/test17559.d? |
|
This is looking great. Can you give a final summary? What's remaining before we can merge this? |
I try to do an honest summary of the disadvantages I see as you know the advantages of testing automatically for
Con:
Con:
I haven't found a good solution for this :/
This is ready from my sides. CIs are happy -> I'm happy |
JinShil
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! 👍
|
The only thing that is still unclear to me is why the stack traces work on the Docker image. http://forum.dlang.org/post/ufpwobqmisamazigcaav@forum.dlang.org Maybe it's not as assumed due to PIE, but sth. else. glibc maybe? Arch Linux currently ships |
Same here. That's why I asked.
Evidence certainly points to something else. I use Arch Linux too. I don't think it should hold up this PR. |
I agree, so let's move forward here? |
Yep, just wanted to give others a few days opportunity to chime it. I think they've had enough time. auto-merge toggling on... |



Because most Linux OSes now use hardening (e.g. Debian, Ubuntu, Arch Linux) and the DMD test suite should work out of the box.
-fPIChas been the default on Linux x64 since2.072.2.See also: