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

hashcat: fix metal library detection, skip OpenCL on virtualized ARM #183847

Merged
merged 2 commits into from
Sep 7, 2024

Conversation

cho-m
Copy link
Member

@cho-m cho-m commented Sep 7, 2024

  • Have you followed the guidelines for contributing?
  • Have you ensured that your commits follow the commit style guide?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Is your test running fine brew test <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it pass brew audit --new <formula>?

Superseding #181921 for working on test failure on CI.

EDIT: cherry-picked commit from other PR and thus closes #181921


Needs a new bottle due to attestation

@cho-m cho-m added the CI-no-fail-fast Continue CI tests despite failing GitHub Actions matrix builds. label Sep 7, 2024
@carlocab
Copy link
Member

carlocab commented Sep 7, 2024

Do you not need the patch from #181921?

@cho-m
Copy link
Member Author

cho-m commented Sep 7, 2024

Do you not need the patch from #181921?

Maybe needed. Locally, I can install existing Monterey bottle and it finds Metal but may have some issues with recent builds

hashcat_bin --benchmark -m 0 -D 1,2 -w 2 --backend-ignore-opencl
hashcat (v6.2.6) starting in benchmark mode

METAL API (Metal 343.21)
========================
...

-------------------
* Hash-Mode 0 (MD5)
-------------------

Speed.#1.........:  1519.7 MH/s (9.93ms) @ Accel:512 Loops:128 Thr:32 Vec:1

Could be that __METAL_MACOS__ was only defined on older Xcode.

There are still remnants of macro usage in Xcode.app though none in CLT:

rg __METAL_MACOS__ /Applications/Xcode.app/Contents/Developer/**/macos
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/32023.155/include/metal/metal_stdlib
39:#if defined(__METAL_MACOS__) && !defined(__METAL__)
67:#endif // __METAL_MACOS__

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/32023.155/include/metal/metal_config
598:#ifdef __METAL_MACOS__
1170:#endif // __METAL_MACOS__

@cho-m cho-m changed the title hashcat: skip OpenCL on virtualized ARM hashcat: fix metal library detection, skip OpenCL on virtualized ARM Sep 7, 2024
@cho-m cho-m added the license License PRs label Sep 7, 2024
@cho-m
Copy link
Member Author

cho-m commented Sep 7, 2024

Still can't find any devices. Locally, I can confirm:

  • Old ARM Monterey bottle works
  • Source build w/o patch fails to find Metal
  • Source build w/ patch finds Metal

I think we have Metal on CI given other formulae like:

# FIXME: when GitHub Actions Intel Mac runners support the use of Metal,
# remove this weakened version and conditional


May need to see what code path to reach Metal detection is and what version of Metal is on runners.

@Bo98
Copy link
Member

Bo98 commented Sep 7, 2024

Well it's not printing clGetDeviceIDs(): CL_INVALID_VALUE anymore at least so this is progress.

Could be that __METAL_MACOS__ was only defined on older Xcode.

It was a Metal 3.0 change where macOS and iOS paths were combined to a unified one. I think __METAL_VERSION__ technically covers both old and new but if it's an upstream patch then we'll use what upstream have.

@cho-m
Copy link
Member Author

cho-m commented Sep 7, 2024

Might just have to check failure or --help or --version.

Not sure if MTLCreateSystemDefaultDevice() is available. At least wasn't back in actions/runner-images#1779

@cho-m cho-m marked this pull request as ready for review September 7, 2024 21:42
@cho-m cho-m added the ready to merge PR can be merged once CI is green label Sep 7, 2024
Copy link
Contributor

github-actions bot commented Sep 7, 2024

🤖 An automated task has requested bottles to be published to this PR.

@github-actions github-actions bot added the CI-published-bottle-commits The commits for the built bottles have been pushed to the PR branch. label Sep 7, 2024
@BrewTestBot BrewTestBot added this pull request to the merge queue Sep 7, 2024
Merged via the queue into master with commit c55ec16 Sep 7, 2024
15 checks passed
@BrewTestBot BrewTestBot deleted the hashcat-arm branch September 7, 2024 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI-no-fail-fast Continue CI tests despite failing GitHub Actions matrix builds. CI-published-bottle-commits The commits for the built bottles have been pushed to the PR branch. license License PRs ready to merge PR can be merged once CI is green
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants