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

CC | dependency error on kata-agent for s390x #5582

Open
BbolroC opened this issue Nov 3, 2022 · 16 comments · Fixed by #5834
Open

CC | dependency error on kata-agent for s390x #5582

BbolroC opened this issue Nov 3, 2022 · 16 comments · Fixed by #5834
Labels
bug Incorrect behaviour needs-review Needs to be assessed by the team.

Comments

@BbolroC
Copy link
Member

BbolroC commented Nov 3, 2022

Description of problem

Since #5542 was merged on CCv0, CI jobs (e.g. http://jenkins.katacontainers.io/job/kata-containers-CCv0-ubuntu-20.04-s390x-PR/229/consoleText) for s390x has been failing due to the following build error on agent:

Compiling ed25519 v1.5.2
error: failed to run custom build command for `ring v0.16.20`

Caused by:
  process didn't exit successfully: `/kata-containers/src/agent/target/release/build/ring-117466d433d50a09/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', /root/.cargo/registry/src/github.com-eae4ba8cbf2ce1c7/ring-0.16.20/build.rs:358:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
make: *** [Makefile:113: target/s390x-unknown-linux-gnu/release/kata-agent] Error 101

On the image-rs side, confidential-containers/guest-components#47 made a difference for s390x, which introduced sigstore-rsopenidconnectring dependency chain (https://github.com/sigstore/sigstore-rs/blob/main/Cargo.toml#L25).

A conversation for the s390x support on ring started with a PR(briansmith/ring#1297) last year, but not yet merged. We need to fix this issue on image-rs or sigstore-rs like what has been made for kata-ctl (https://github.com/kata-containers/kata-containers/blob/main/src/tools/kata-ctl/Cargo.toml#L23) while we are waiting for having the PR for ring merged.

[target.'cfg(target_arch = "s390x")'.dependencies]
reqwest = { version = "0.11", default-features = false, features = ["json", "blocking", "native-tls"] }

[target.'cfg(not(target_arch = "s390x"))'.dependencies]
reqwest = { version = "0.11", default-features = false, features = ["json", "blocking", "rustls-tls"] }

cc: @stevenhorsman, @arronwy, @hbrueckner

@BbolroC BbolroC added bug Incorrect behaviour needs-review Needs to be assessed by the team. labels Nov 3, 2022
@hbrueckner
Copy link
Contributor

@BbolroC Thanks for opening this issue!

Also cc'ing @uweigand for ring dependency awareness.

@arronwy
Copy link
Member

arronwy commented Nov 4, 2022

@Xynnn007

@BbolroC
Copy link
Member Author

BbolroC commented Nov 4, 2022

UPDATE

Investigation and test results

  1. The code changes below made for kata-ctl cannot solve the problem:
[target.'cfg(target_arch = "s390x")'.dependencies]
reqwest = { version = "0.11", default-features = false, features = ["json", "blocking", "native-tls"] }

[target.'cfg(not(target_arch = "s390x"))'.dependencies]
reqwest = { version = "0.11", default-features = false, features = ["json", "blocking", "rustls-tls"] }

The reqwest has features where we could selectively configure either of them for the crate (even none of them).

  • rustls-tls refers to hyper-rustls -> rustls -> ring
  • native-tls does not have any chain to ring.
  1. The problem is different for the sigstore case (Cargo.toml at the commit referred by image-rs: https://github.com/sigstore/sigstore-rs/blob/v0.3.3/Cargo.toml) , native-tls is configured by default. but the problem comes from openidconnect, where ring is hard-coded as dependency (https://github.com/ramosbugs/openidconnect-rs/blob/main/Cargo.toml#L41)

Conclusion

  1. Let sigstore not use openidconnect - not good
  2. Let image-rs not use sigstore - not good
  3. Get the PR for ring merged - ideal, but no guarantee for when

I look forward to feedback from @uweigand. Thanks @Xynnn007 and @huoqifeng for the discussion

@stevenhorsman
Copy link
Member

@fidencio mentioned that td-shim have replaced ring with sha2 https://github.com/confidential-containers/td-shim/pull/428/files, so I wonder if that would be helpful, but would involved getting openidconnect to accept the change I guess. If ring isn't being very slow to accept PRs then they might be interested though.

@BbolroC
Copy link
Member Author

BbolroC commented Nov 7, 2022

@stevenhorsman Thanks for the idea. I've gone through how ring is used in openidconnect. The search result of the package is around 70 hits over 2 files. which does not look simple to make a PR in a short period of time. (fyi: I am not a crypto expert enough to handle a PR for this. We should find someone else to do this.) Plus, unlike the PR for ring (titled s390x support), it might be really hard to convince an author of openidconnect (https://github.com/ramosbugs) to switch to sha2 just for the issue we are facing.

cc: @hbrueckner

@stevenhorsman
Copy link
Member

Plus, unlike the PR for ring (titled s390x support), it might be really hard to convince an author of openidconnect (https://github.com/ramosbugs) to switch to sha2 just for the issue we are facing.

Yep - that makes sense and not unexpected, we just thought we'd throw in the idea. 🤞 we can get the ring PR merged soon.

@Xynnn007
Copy link
Contributor

Xynnn007 commented Nov 7, 2022

BTW - This PR is working add RustCrypto support, which can get rid of ring. ramosbugs/openidconnect-rs#58

@hbrueckner
Copy link
Contributor

Hi @BbolroC @stevenhorsman ,

@stevenhorsman Thanks for the idea. I've gone through how ring is used in openidconnect. The search result of the package is around 70 hits over 2 files. which does not look simple to make a PR in a short period of time. (fyi: I am not a crypto

Also looked into ring usage in openidconnect and agree with @BbolroC ... they seem to entirely rely on ring for cryptographic operations.

@hbrueckner
Copy link
Contributor

  • This PR is working add RustCrypto support,

Thanks for sharing. And looking at the commit, they indeed replace a couple of crypto operations with the rustCrypto ones (e.g. similar to the mentioned sha2 above.)

BbolroC added a commit to BbolroC/kata-containers that referenced this issue Nov 7, 2022
This is just to keep the support for s390x without the cosign
verification while looking for a solution for kata-containers#5582.

Fixes: kata-containers#5599

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
BbolroC added a commit to BbolroC/kata-containers that referenced this issue Nov 7, 2022
This is just to keep the support for s390x without the cosign
verification while looking for a solution for kata-containers#5582.

Fixes: kata-containers#5599

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
BbolroC added a commit to BbolroC/kata-containers that referenced this issue Nov 7, 2022
This is just to keep the support for s390x without the cosign
verification while looking for a solution for kata-containers#5582.

Fixes: kata-containers#5599

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
BbolroC added a commit to BbolroC/kata-containers that referenced this issue Nov 7, 2022
This is just to keep the support for s390x without the cosign
verification while looking for a solution for kata-containers#5582.

Fixes: kata-containers#5599

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
BbolroC added a commit to BbolroC/kata-containers that referenced this issue Nov 7, 2022
This is just to keep the support for s390x without the cosign
verification while looking for a solution for kata-containers#5582.

Fixes: kata-containers#5599

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
BbolroC added a commit to BbolroC/kata-containers that referenced this issue Nov 7, 2022
This is just to keep the support for s390x without the cosign
verification while looking for a solution for kata-containers#5582.

Fixes: kata-containers#5599

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
@liudalibj
Copy link
Contributor

Looks like @briansmith is working on briansmith/ring#1555, when the issue be finished, maybe openidconnect can run on s390x platform successfully with new released ring version.

@mattarnoatibm
Copy link

mattarnoatibm commented Nov 25, 2022

While we wait for the fix in the ring create to be progressed and completed we're going to attempt a workaround conditionally compiling image-rs without the sigstore-rs crate and without support for cosign signing when its compiled for s390x: confidential-containers/guest-components#80.

mattarnoatibm referenced this issue in mattarnoatibm/kata-containers Dec 5, 2022
Exclude the image-rs cosign feature when the build target
is the s390x architecture.

Fixes: kata-containers#5582

Signed-off-by: Matthew Arnold <mattarno@uk.ibm.com>
mattarnoatibm referenced this issue in mattarnoatibm/kata-containers Dec 5, 2022
Exclude the image-rs cosign feature when the build target
is the s390x architecture.

Change Cargo to use workspace resolver 2 so that conditional
include for the image-rs crate is resolved correctly for different
targets.

Fixes: kata-containers#5582

Signed-off-by: Matthew Arnold <mattarno@uk.ibm.com>
@stevenhorsman stevenhorsman linked a pull request Dec 5, 2022 that will close this issue
mattarnoatibm referenced this issue in mattarnoatibm/kata-containers Dec 5, 2022
Exclude the image-rs cosign feature when the build target
is the s390x architecture.

Change Cargo to use workspace resolver 2 so that conditional
include for the image-rs crate is resolved correctly for different
targets.

Fixes: kata-containers#5582

Signed-off-by: Matthew Arnold <mattarno@uk.ibm.com>
mattarnoatibm added a commit to mattarnoatibm/kata-containers that referenced this issue Dec 5, 2022
Exclude the image-rs cosign feature when the build target
is the s390x architecture.

Change Cargo to use workspace resolver 2 so that conditional
include for the image-rs crate is resolved correctly for different
targets.

Fixes: kata-containers#5582

Signed-off-by: Matthew Arnold <mattarno@uk.ibm.com>
mattarnoatibm added a commit to mattarnoatibm/kata-containers that referenced this issue Dec 5, 2022
Exclude the image-rs cosign feature when the build target
is the s390x architecture.

Change Cargo to use workspace resolver 2 so that conditional
include for the image-rs crate is resolved correctly for different
targets.

Update cargo lock.

Fixes: kata-containers#5582

Signed-off-by: Matthew Arnold <mattarno@uk.ibm.com>
@katacontainersbot katacontainersbot moved this from To do to In progress in Issue backlog Dec 5, 2022
@BbolroC
Copy link
Member Author

BbolroC commented Feb 6, 2023

@stevenhorsman I was wondering if this issue could be closed.

@stevenhorsman
Copy link
Member

@stevenhorsman I was wondering if this issue could be closed.

I don't think we should close it, but maybe it needs updating, or possibly moving to image-rs? AFAIK we didn't get ring working on s390x, so cosign support doesn't work (which we'd like, hence keeping this open), we are just avoiding the problem by not building the co-sign feature on s390x.

@BbolroC
Copy link
Member Author

BbolroC commented Feb 6, 2023

True. Then I will make an update on what is going for this issue this week. Thanks for your opinion. ❤️

@Xynnn007
Copy link
Contributor

Xynnn007 commented Feb 7, 2023

FYI, recentlyopenidconnect replaced ring with Rust Cryptos. I'm going to test in the sigstore crate and replace that with the new version, which may help s390x to support cosign.

@stevenhorsman
Copy link
Member

@Xynnn007 - thanks for the update and for testing it out. I thought Gerry mentioned that the latest sigstore clashed with another dependency, but hopefully that is resolved/resolvable now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behaviour needs-review Needs to be assessed by the team.
Projects
Issue backlog
  
In progress
Development

Successfully merging a pull request may close this issue.

7 participants