mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #2543] Setup automated Windows builds/CI using Cygwin on ReactOS #1675
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#1675
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @solardiz on GitHub (May 14, 2017).
Original GitHub issue: https://github.com/openwall/john/issues/2543
Originally assigned to: @kholia on GitHub.
I suggested this before in https://github.com/magnumripper/JohnTheRipper/issues/2372#issuecomment-270007448 but at the time I thought that ReactOS wouldn't run Cygwin.
It appears that since mid-2016 ReactOS is finally able to run Cygwin:
https://twitter.com/reactos/status/735141249775194112
https://jira.reactos.org/browse/CORE-7739
so maybe we should proceed with that setup, in a VM. Or maybe two setups: 32-bit and 64-bit.
Also relevant is this comment from the above ReactOS JIRA entry:
Since we probably still want our JtR builds to work on XP/2003, perhaps we should stick to Cygwin <=2.5.2.
@kholia commented on GitHub (May 26, 2017):
AppVeyor (which is another CI service like Travis CI) provides CI services on Windows platform. It comes with MinGW, MSYS, and Cygwin pre-installed.
See https://www.appveyor.com/docs/build-environment/ for details.
@solardiz commented on GitHub (Aug 7, 2017):
To clarify: this issue isn't only about testing, but also (and maybe even more importantly) about making up-to-date Windows builds available to the users. Last time this latter aspect was brought up on john-users, @kholia said the automated builds with MinGW were not recommended for end-users. So we need such builds with Cygwin instead, which we would be able to recommend.
@kholia commented on GitHub (Aug 8, 2017):
Thanks to @claudioandre and @magnumripper, our automated MinGW builds work well now. The only remaining problem with them is that they are not fully optimized (only SSE2, no SSE4, no AVX2 IIRC).
I believe that we can generated optimized builds (e.g. with AVX2 support) using the existing CI infrastructure but I am not sure how compatible will such builds be for end-users. Perhaps we can publish multiple binaries (e.g. john-sse2, john-avx2) in a single build to solve this problem.
@kholia commented on GitHub (Sep 2, 2017):
I am going to try https://github.com/magnumripper/JohnTheRipper/wiki/Fallback-binary-chains for MinGW builds too. Once this experiment is successful, we can recommend the MinGW builds to end-users (and close this task).
@kholia commented on GitHub (Sep 2, 2017):
Testing AVX + AVX2 MinGW builds on Windows 10 64-bit,
With AVX, all formats work fine.
AVX2 stuff seems to be working for some formats.
Working formats -> md5crypt with AVX2, LM with AVX2, NT with AVX2
Non-working formats -> tripcode, descrypt, bsdicrypt (all with AVX2)
I don't know what is causing this crash!
@solardiz @magnumripper I need your help in debugging this descrypt crash which occurs in MinGW AVX2 builds.
@solardiz commented on GitHub (Sep 2, 2017):
No, it is not. AVX2 needs 32-byte alignment, so ...20 or ...40 would be OK, but ...30 is not.
@kholia commented on GitHub (Sep 2, 2017):
I see, my math was quite off!
Can this misalignment explain why the AVX2 build is crashing?
Is there something we can do to ensure correct alignment of the data buffer?
@solardiz commented on GitHub (Sep 2, 2017):
Of course, this is why it is crashing.
It's not "the data buffer" - it's something else gcc put on the stack, maybe spilling a register.
You can try
-mpreferred-stack-boundary=5, but I doubt it'd help because the stack is properly aligned as it is, but this gcc build looks broken in that it spills(?) onto an unaligned stack location even when the stack is aligned. Yet maybe gcc reuses this same setting elsewhere, so it might help.@kholia commented on GitHub (Sep 2, 2017):
It seems that this GCC option does not work with MinGW stuff,
@kholia commented on GitHub (Sep 2, 2017):
The AVX2 john binary works fine under Wine for descrypt, bsdicrypt and md5crypt (surprising) but it crashes for LM.
I am out of debugging ideas.
Do our previously published Windows builds have support for AVX2? I am guessing no.
@magnumripper commented on GitHub (Sep 2, 2017):
What crap version of gcc is this anyway? Can't you enforce use of something better?
@kholia commented on GitHub (Sep 2, 2017):
MinGW GCC version is
mingw64-gcc-6.3.0-1.fc25.x86_64. I can try using MinGW GCC 7.2 which should be installable on our CircleCI build bot.Update: I think in order to test MinGW GCC 7.2, we need to merge https://github.com/magnumripper/JohnTheRipper/pull/2715 first.
I don't have this version of GCC on my local machine, and my internet connectivity is not good at the moment.
@magnumripper commented on GitHub (Sep 2, 2017):
I'm amazed such a modern version of gcc can do something that silly.
@solardiz commented on GitHub (Sep 2, 2017):
This suggests that stack alignment is not enforced beyond 16 bytes, either. So when both the stack is misaligned and the offsets are, the sum ends up aligned. Maybe gcc is actually being sort-of correctly smart in not aligning stack offsets if it knows the stack itself might not be aligned anyway. So basically no AVX2 support by that build of gcc.
IIRC, Jim played with this before, and was putting explicit alignment attributes on local variables inside OpenMP regions for that reason. However, with the stack itself possibly misaligned, it is unclear if that would reliably help. Also, it wouldn't apply to implicit spilling. I guess part of the issue is (not) having incoming stack alignment on callbacks from Windows (such as on new thread spawning). This probably goes beyond gcc.
@kholia commented on GitHub (Sep 2, 2017):
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412 is relevant to this topic. The problem seems complex, and also is unfixed so far.
@kholia commented on GitHub (Sep 2, 2017):
https://github.com/tpoechtrager/wclang (clang based cross-compiler) - this can be a possible workaround for this problem.
@solardiz commented on GitHub (Sep 2, 2017):
What about
--fork? I vaguely recall some of our users got--forkworking under Windows in some Cygwin builds, so perhaps we should in our builds too, and perhaps there's no chance for that if we build with MinGW?@kholia commented on GitHub (Sep 3, 2017):
Yes, MinGW does not support
forkstuff IIRC.Even if we use Cygwin, the AVX2 alignment problem with GCC + Windows combination will remain, correct?
I am not sure if Cygwin builds have any advantages over MinGW builds. I don't have much experience with Cygwin to know this.
@magnumripper commented on GitHub (Sep 3, 2017):
I don't quite understand how/why gcc has bugs like this on Windows only?! Perhaps it's because of the different function calling convention. Perhaps a 32-bit build would work better?
@kholia commented on GitHub (Sep 3, 2017):
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412 has some details on this but I don't understand them 100%.
Yes, a 32-bit AVX2 build should work. GCC folks fixed the "alignment bug" for 32-bit AVX2 binaries. I am confirming this now.
@kholia commented on GitHub (Sep 3, 2017):
A 32-bit AVX2 build works fine. However, a 32-bit build needs 32-bit DLL files (e.g. libwinpthread-1.dll) and a 64-bit build needs 64-bit DLL files. This means that we can't mix a 32-bit AVX2 build with 64 bit AVX + SSE2 builds.
I wonder about the performance difference between 32-bit and 64-bit MinGW builds.
@kholia commented on GitHub (Sep 3, 2017):
A
.batfile can perhaps be used to workaround this issue but it would be a ugly solution.@magnumripper commented on GitHub (Sep 3, 2017):
In general it shouldn't be a big deal. For most of our code I believe the main difference is register pressure.
@kholia commented on GitHub (Sep 3, 2017):
I am OK with distributing 32-bit MinGW builds with AVX2 > AVX > SSE2 fallback chain.
@solardiz commented on GitHub (Sep 8, 2017):
Register pressure can be a big deal. AVX2 on 32-bit is probably still faster than AVX on 64-bit, but almost certainly not to the same extent as AVX2 on 64-bit would be.
Having some builds is better than none, so if we can only have 32-bit let's have those. But in the long run we definitely do need 64-bit Windows builds as well. Also for large file support, which we've been too lazy to implement for 32-bit, but which we get without effort for 64-bit.
And I'd like us to have Cygwin builds too, and to see if we can get
--forkworking there.@magnumripper commented on GitHub (Sep 8, 2017):
IIRC @jfoug (perhaps me too, I can't recall) invested some time in supporting large file support. I believe it's been mostly or fully there for years, for both win32 and Linux.
@solardiz commented on GitHub (Sep 8, 2017):
Oh, you're right - looks like jumbo does have large file support. Thanks!
@kholia commented on GitHub (Dec 5, 2017):
It seems that 64-bit Cygwin toolchain does not suffer from this problem. I haven't actually confirmed this though.
@jfoug commented on GitHub (Dec 5, 2017):
It does not. Nor does the 32 bit, btw ;) I use both forms of cygwin in my testing.
Fork works under cygwin. Fork would build under mingw, but we NEVER got it working. The stack alignment issue hit cygwin at one time (long ago before I started using it), There were sprinkling of comments still out there. But that has long since gone away. The only caveat was in some OMP regions, there were still alignment issues, but those were worked around under cygwin.
We have had AVX2 support a long time for both 32 and 64 bit builds on cygwin. As for performance, there is a very noticeable improvement going from 32 to 64 bit. in cygwin. 10 to 30% is usual, average is probably in the 15% range. There are many formats where the speed change is pretty much nothing. There are some where it is huge. One other big key, is speed of oSSL. The oSSL builds for 64 bit are quite a bit faster. They use MMX/SSE for 64 bit registers, etc, speeding up a lot of stuff, while I am not sure that is done in the 32 bit builds. So yes, there is a noticeable difference. I personally used 32 bit a long time, because not all items were supported on cygwin64. Also at that time, I was still using MinGW, and even though the 64 bit mingw was there, getting it to work was like spotting a unicorn. But then I switched over to cygwin, still built in 32 bit, but did a bit of work on 64 bit, and switched over (very easy to install, and simply works), patched a couple things in john, and have never really looked back.
@jfoug commented on GitHub (Dec 5, 2017):
Large file support should be there for all systems supporting it. Hell, it is even there for that dinosaur sparc 32 bit system, lol (AND for Vc 32 bit). So it has been there a while. It was a combination of ./configure probing for many possible usable functions, and then packing that knowledge into a single spot in the code (common, misc, I do not remember), and then the large file stuff simply works.
Yes, for some older systems like cygnus (i.e. DOS), it probably would not be there, but anything newer than a TRS80, and it should work fine.
@kholia commented on GitHub (Dec 5, 2017):
Hmm. I guess I need to start loving Cygwin a lot more ;)
I will take a look at getting AppVeyor and Cygwin stuff going soon.
@jfoug commented on GitHub (Dec 5, 2017):
@kholia NOTE, I did love/hate MinGW for a long time. I was under the impression that cygwin was fat slow and bloated. That was not a valid assumption. Once I started using it, and saw that it does 95% of everything that can be done under *nix but still maintain windows, I was sold. Yes, I run many flavors of Linux in VMs, but as we have seen, this is not really ideal. For testing, it is fine. For real world work, not so much.
@jfoug commented on GitHub (Dec 5, 2017):
But the one issue we still have not worked around, is how to get a auto build working.
NOTE, I do have a Linode setup. I could work on it to do automatic CI builds. Right now, the Linode is setup for Linux, but they also have Windows environments (I think), where a cygwin env and a build schedule could be setup. Just an option ;)
@kholia commented on GitHub (Dec 5, 2017):
This is exactly what I am aiming to tackle in the near future. I believe that AppVeyor continuous integration (CI) service can help us here.
@solardiz commented on GitHub (Sep 15, 2018):
Not exactly on-topic for this issue, but FWIW here's a new project to cross-build MSI installers for Windows (in case we ever want to do that) from Linux or other systems (not needing ReactOS either): https://wix.sk1project.net/
@ghost commented on GitHub (Sep 27, 2020):
I found this today. I have a question:
Can be done, but it is complicated and involves money. On the other hand, upstream committed code:
test=0andtest=full=0only.The issue should be closed as "cant be done".
@solardiz commented on GitHub (Jun 9, 2024):
We currently run VMs via QEMU in GitHub Actions for the LKRG project, booting Linux in there and loading the just-built kernel module to test it. We could maybe do the same here with a ReactOS image. To get our added code in there, in the LKRG project we build a custom image each time (with
mkosi), but here we could use something different - e.g., build a non-bootable fs image that our fixed ReactOS image would know to mount as a second disk and run code from? Just thinking out loud.Anyway, even if not on CI, then supporting ReactOS-based builds of John for Windows would still be nice to have in a project (e.g., a separate repo nearby), so that we could do purely free software based builds of our binary releases for Windows.
I was actually thinking of closing this one when I came here today, which I may do, but I think it can be done.
@Swamich19 commented on GitHub (Aug 6, 2025):
I was going through this issue and had a small suggestion.
Since stack alignment problems mainly affect AVX2 builds with MinGW, and Cygwin 64-bit seems more stable, maybe a hybrid approach could help-
Also, using GitHub Actions + QEMU boot script might be a good workaround to automate ReactOS builds, even if it's slower.
Just an idea really appreciate all the hard work on keeping builds open-source and cross-platform!