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

Adding MacOS Support #203

Merged
merged 47 commits into from
Mar 17, 2024
Merged

Adding MacOS Support #203

merged 47 commits into from
Mar 17, 2024

Conversation

njelich
Copy link
Contributor

@njelich njelich commented Feb 29, 2024

Hi! I played around with getting this to work on Mac, two main elements to get around were the linux_personality usage and lsb_release for getting some info. Both of those should be working fine, but I am getting some different behavior from tests.

I couldn't dig much deeper into these, but in general I get something like this in these tests, related to GDB

Stdout GDB output: ["", "$4 = void", "", "", "", ""]
Error: SiginfoParse("Siginfo string: $4 = void doesn't match regex template")
.
 Stderr: Error: Program terminated (no crash)

I would appreciate some direction. Thanks :) Hopefully we can port this amazing tool of Mac, and if LLDB is implemented instead of GDB even on M1 Macs (since GDB doesn't support M1 yet).

Note: the shift aways from lsb_release might be a good addition on its own, shifting aeverything to a single command - uname

@njelich
Copy link
Contributor Author

njelich commented Feb 29, 2024

Requesting reviewer from @anfedotoff

For more detail on the test issues, take a look at the MacOS CI runs on my fork - I used a println to inspect whats happening a little.
https://github.com/njelich/casr/actions/runs/8101522669/job/22141894399

Copy link

codecov bot commented Feb 29, 2024

Codecov Report

Attention: Patch coverage is 80.95238% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 62.45%. Comparing base (c2ce4c8) to head (fc77ab9).
Report is 3 commits behind head on master.

Files Patch % Lines
casr/src/bin/casr-san.rs 33.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #203      +/-   ##
==========================================
+ Coverage   62.37%   62.45%   +0.07%     
==========================================
  Files          32       32              
  Lines        5292     5327      +35     
==========================================
+ Hits         3301     3327      +26     
- Misses       1991     2000       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SweetVishnya
Copy link
Collaborator

AFAIK, uname won't print Ubuntu distro version.

libcasr/src/report.rs Show resolved Hide resolved
@Avgor46
Copy link
Member

Avgor46 commented Feb 29, 2024

I would appreciate some direction

We use precompiled binaries in tests, so they are in elf format. I think you should try to recompile them.

@anfedotoff
Copy link
Collaborator

Hi, @njelich!
Thanks, it's a great idea to support Mac!
As for GDB tests, the error occurs here.
$4 = void looks like that no signal was cached by gdb. We use this command for that.
I think, we should recompile gdb tests for Mac, to get them work. You can look at this Makefile.
Maybe the right way is to compile binaries in tests, the way we do here for example.

@njelich
Copy link
Contributor Author

njelich commented Mar 10, 2024

@SweetVishnya I made progress with the CI and GDB install on M1 Mac. Re recompiling the tests, do I simply run the x86 Makefile at the start of the test CI?

@SweetVishnya
Copy link
Collaborator

@njelich, I suppose that running Makefile is sufficient to recompile tests. However, there may be more binary tests just stored in git. @Avgor46, can you give more insight on tests?

@Avgor46
Copy link
Member

Avgor46 commented Mar 11, 2024

We have the following tests:

  1. coredump tests
  2. clustering tests
  3. casr-san tests
  4. casr-gdb tests
  5. other languages tests
  6. fuzzers

The first kind should not be tested on Mac OS. Second works well. For 3-4 you just need to recompile using Makefile. Tests for 5-6 categories we should discuss.

@SweetVishnya
Copy link
Collaborator

However, there is still some ELF and signal dependent code:

https://github.com/ispras/casr/blob/master/libcasr/src/gdb/exploitable.rs

@njelich
Copy link
Contributor Author

njelich commented Mar 11, 2024

.I disabled the coredump tests, recompiled everything etc - it passes now.

https://github.com/njelich/casr/actions/runs/8239547704/job/22533003557

README.md Outdated Show resolved Hide resolved
@njelich
Copy link
Contributor Author

njelich commented Mar 12, 2024

@SweetVishnya What should it be named then?

https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available/
Because there will be no more Intel macs

@SweetVishnya
Copy link
Collaborator

@Avgor46 could you help with proper naming, please?

@Avgor46
Copy link
Member

Avgor46 commented Mar 12, 2024

Maybe darwin-arm64?

@njelich
Copy link
Contributor Author

njelich commented Mar 13, 2024

Updated to darwin-arm64, please verify and merge.

@SweetVishnya
Copy link
Collaborator

SweetVishnya commented Mar 14, 2024

@njelich, although, almost all of the tests are disabled. Have you tried to manually run casr-libfuzzer and casr-gdb? Do you have any screenshots?

@SweetVishnya SweetVishnya merged commit 4c36a1f into ispras:master Mar 17, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants