-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
infra/helper.py not working on Mac M2, Fix for it please review. #9727
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Also looks like there is no workflow build for ARM yet? |
There is none correct. The images were built by me using helper.py and manually pushed. |
@@ -616,26 +613,13 @@ def build_image_impl(project, cache=True, pull=False, architecture='x86_64'): | |||
|
|||
build_args = [] | |||
image_name = 'gcr.io/%s/%s' % (image_project, image_name) | |||
if architecture == 'aarch64': |
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 did you need to remove this? I think doing so breaks aarch64 builds on x86_64 hosts.
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.
when i use build_fuzzer command as below:
python3.10 infra/helper.py build_fuzzers --architecture aarch64 --sanitizer address libtiff
I get following error on Mac M2:
unknown flag: --platform
See 'docker --help'.
looks like some issue with docker command, here is the detailed log:
Run 'docker COMMAND --help' for more information on a command.
To get more help with docker, check out our guides at https://docs.docker.com/go/guides/
Traceback (most recent call last):
File "/home/parallels/Research/oss-fuzz/infra/helper.py", line 1674, in <module>
sys.exit(main())
File "/home/parallels/Research/oss-fuzz/infra/helper.py", line 185, in main
result = build_fuzzers(args)
File "/home/parallels/Research/oss-fuzz/infra/helper.py", line 926, in build_fuzzers
return all(
File "/home/parallels/Research/oss-fuzz/infra/helper.py", line 927, in <genexpr>
build_fuzzers_impl(args.project,
File "/home/parallels/Research/oss-fuzz/infra/helper.py", line 775, in build_fuzzers_impl
if build_project_image and not build_image_impl(project,
File "/home/parallels/Research/oss-fuzz/infra/helper.py", line 637, in build_image_impl
subprocess.check_call(command)
File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['docker', 'buildx', 'build', '--platform', 'linux/arm64', '--progress', 'plain', '--load', '-t', 'gcr.io/oss-fuzz/libtiff', '--file', '/home/parallels/Research/oss-fuzz/projects/libtiff/Dockerfile', '/home/parallels/Research/oss-fuzz/projects/libtiff']' returned non-zero exit status 125.
when i remove, its working fine and i can build image/fuzzers and can run them.
As this change is breaking aarch64 build on x86_64 hosts, we can specify a arg "--cross_compile=1" which can be used in case we want to generate aarch64 build on x86_64. If we just want to create aarch64 build on arch64 itself we dont need to use "--cross_compile" args at all? does it make sense? or i am not sure if there is any other alternative fix. Please let me know if any.
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.
unknown flag: --platform
I think it indicates that it isn't supported by docker. Assuming this is run in the guest VM my guess would be that either the guest OS is out of date there or docker was installed from out-of-date repositories somehow (or both).
That being said I think the right fix would be to not pass --platform
to docker
unless --architecture
is passed to helper.py
explicitly. This way helper.py
would always build fuzz targets using the native architecture by default.
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.
Assuming this is run in the guest VM
FWIW if it's run on the host it could be that docker was installed via brew install docker
and that version of docker
doesn't support the platform option. brew install --cask docker
should install the official docker app where the platform option should work. Either way that error message indicates that docker
isn't compatible with helper.py
in its current form.
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.
It was run on guest Linux vm. It's Kali Linux and docker was installed using apt install.
Yes helper.py is not compatible with the docker it seems.
Will check the docker version and provide here so that it can help.
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.
As far as I can remember there are two ways to install Docker on Debian-based distributions. I think docker-ce
should work
https://docs.docker.com/engine/install/debian/#uninstall-old-versions
https://www.kali.org/docs/containers/installing-docker-on-kali/#installing-docker-ce-on-kali-linux.
Sorry if it caused any confusion, i meant to say i dont see any CI/CD aarch64 build in pull requests. i see following:
|
I checked, my docker version is : 20.10.23+dfsg1, build 7155243 |
Looks like it came from the Have you tried installing |
Yeah the issue is what to do when --platform not supported in docker. We
need to modify helper.py for that.
On Wed, 22 Feb 2023 at 11:59 PM, Evgeny Vereshchagin < ***@***.***> wrote:
20.10.23+dfsg1
Looks like it came from the docker.io package.
Have you tried installing docker-ce:
https://docs.docker.com/engine/install/debian/#uninstall-old-versions
https://www.kali.org/docs/containers/installing-docker-on-kali/#installing-docker-ce-on-kali-linux
? It should make helper.py work. Though it doesn't fix the issue with
docker where --platform isn't supported in general.
—
Reply to this email directly, view it on GitHub
<#9727 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFL3IMF3K3RAUUSL46LGMZ3WYZLG7ANCNFSM6AAAAAAU6NG36I>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
-Hardik Shah
|
I'm not entirely sure but I think it's kind of expected by helper.py that By the way among other things this mess with docker packages on Debian and also RPM-based distributions is why I use |
I was trying oss-fuzz on following setup:
Host: MacBook Pro M2 chip(ARM)
Guest: Kali Linux with parallels Desktop
When i tried infra/helper.py i found following:
I have created a patch, first please check why arm build are not working with infra/helper.py and then please check with my script. I am not very sure if this is a issue specific to M2 Mac or not but i dont have any other hardware to test it.
Also on the other note, base images for java and python will not work on Arm architecture, need to have base image for them to work with OSS-Fuzz.