Skip to content

Allow arm64 to fallback to arm (v8, v7, v6, v5)#4932

Merged
fuweid merged 1 commit intocontainerd:masterfrom
tianon:arm64-fallback
Jan 14, 2021
Merged

Allow arm64 to fallback to arm (v8, v7, v6, v5)#4932
fuweid merged 1 commit intocontainerd:masterfrom
tianon:arm64-fallback

Conversation

@tianon
Copy link
Copy Markdown
Member

@tianon tianon commented Jan 12, 2021

This isn't supported by all arm64 chips, but it is common enough that I think it's worth an explicit fallback. I think it will be more common for images to have arm64 support without arm support, but even if a user has an arm64 chip that does not support arm32, having it fail to run the arm32 image is an acceptable compromise (because it's non-trivial to detect arm32 support without running a binary, AFAIK).

Also, before this change the failure would've simply been "no such image" instead of "failed to run" so I think it's pretty reasonable to allow it to try the additional 32bit set of images just in case one of them actually does work (like it will on many popular chips like 64bit Raspberry Pis and AWS Graviton).

This also reverts #4013 (#3990) because it should no longer be necessary with this follow-up to #4891 - if GOARCH is arm but the CPU reports variant 8, it will try 8, then 7, 6, and finally 5, and arm64 will fall back to that same vector.

The exact set of "acceptable" platforms is more clearly seen in the test changes. 😄 😏

@tianon
Copy link
Copy Markdown
Member Author

tianon commented Jan 12, 2021

That's a suspiciously large number of failures. 😬
(I'm digging to try and figure out wtf)

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Jan 12, 2021

Build succeeded.

@tianon
Copy link
Copy Markdown
Member Author

tianon commented Jan 12, 2021

Oh. https://github.com/containerd/containerd/actions/runs/480924253 (appears to be the same failure on the latest master build)

Maybe not my fault? 😅

@fuweid
Copy link
Copy Markdown
Member

fuweid commented Jan 13, 2021

@tianon rebase might fix the issue 😂

This isn't supported by *all* arm64 chips, but it is common enough that I think it's worth an explicit fallback.  I think it will be more common for images to have arm64 support without arm support, but even if a user has an arm64 chip that does not support arm32, having it fail to run the arm32 image is an acceptable compromise (because it's non-trivial to detect arm32 support without running a binary, AFAIK).

Also, before this change the failure would've simply been "no such image" instead of "failed to run" so I think it's pretty reasonable to allow it to try the additional 32bit set of images just in case one of them actually does work (like it will on many popular chips like 64bit Raspberry Pis and AWS Graviton).

Signed-off-by: Tianon Gravi <[email protected]>
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented Jan 13, 2021

Build succeeded.

Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fuweid fuweid merged commit 66fec3b into containerd:master Jan 14, 2021
@tianon tianon deleted the arm64-fallback branch January 14, 2021 15:52
@thaJeztah
Copy link
Copy Markdown
Member

Hm... late to the party, but it came up in a discussion;

This isn't supported by all arm64 chips, but it is common enough that I think it's worth an explicit fallback

Apparently, Apple's m1 falls in the category "not all arm64 chips", and doesn't support 32 bit 😞

@tonistiigi
Copy link
Copy Markdown
Member

My understanding is that fallback is not a requirement for chipmakers and if it isn't then we shouldn't make up our own rules that give wrong behavior to users. If other more modern chips start coming out I'd expect them to also start dropping the support. All future Apple chips will definitely not support this.

If we want to have some magic that detects the chips where fallback is possible and it can be determined from cpuinfo() I think one way would be for the platforms.Default() to store something either in variant or internally that could tweak the comparator later.

@justincormack

@tianon
Copy link
Copy Markdown
Member Author

tianon commented Jun 22, 2021

The end result is error: failed to pull vs error: failed to run, right?
(Saving a bit of bandwidth and a different error message.)

@tonistiigi
Copy link
Copy Markdown
Member

Docker Desktop in M1 can run arm32 containers, but they run under qemu emulator like other unsupported architectures(no run error). But to do that user needs to use flags that opt-in to emulation mode and ignore the warnings. If they set their expected platform as arm64 then they don't get something else running under emulation.

@justincormack
Copy link
Copy Markdown
Contributor

Generally i think automatic fallback to 32 bit architectures is a mistake in containerd, it is not what people mostly want. The client could ask for it, but there are potential security issues (lack of workable ASLR), compatibility issues (I was downloading a container to use libraries in it in build and 32 bit ones won't link), and performance issues if it runs under emulation, or doesn't run at all.

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.

6 participants