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

source/cpu: detect Intel SGX #647

Merged
merged 1 commit into from
Nov 24, 2021
Merged

Conversation

mythi
Copy link
Contributor

@mythi mythi commented Nov 12, 2021

Fixes: #130, #638

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Nov 12, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @mythi. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Nov 12, 2021
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 12, 2021
Copy link
Contributor

@marquiz marquiz left a comment

Choose a reason for hiding this comment

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

Basically looks good and simple to me.

Would it be useful to add other SGX attributes from klauspost/cpuid as raw features, now that we add this, WDYT? I'm thinking about these max enclave size etc.

Comment on lines +41 to +43
if epcSize > 0 {
sgx["enabled"] = "true"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we advertise epcSize as the raw feature, directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to start with something minimal/basic and enabled is consistent with the other cpusource features. The boolean value can be taken into nodeSelector directly which is my use case at least until #464 lands. Would there be any use for epcSize other than using it in, e.g., {op: Gt, value: ["0"]}?

I'm thinking about these max enclave size etc.

I'm not sure how useful they are. We could label, e.g., sgx2=true but to actually use the feature the kernel support needs to be there and we cannot detect that. max enclave size value is a bit value for 2^(<value>) computation.

Copy link
Contributor

Choose a reason for hiding this comment

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

I wanted to start with something minimal/basic and enabled is consistent with the other cpusource features. The boolean value can be taken into nodeSelector directly which is my use case at least until #464 lands. Would there be any use for epcSize other than using it in, e.g., {op: Gt, value: ["0"]}?

Yeah, for the label enabled makes sense. I might be wrong but my intuition is that the better direction would be to expose "raw features" as raw as possible, avoiding any translations. More likely to avoid problems like the kernel module values (currently =y and =m now translate to true and we have no means of telling between y or m). As you said, in this case enabled would translate to {op: Gt, value: ["0"]} in the custom rules. That said, I don't know what use people could find for the numerical value (expose it as an extended resource?). Maybe we should expose both, enabled and epcSize?

I'm thinking about these max enclave size etc.

I'm not sure how useful they are. We could label, e.g., sgx2=true but to actually use the feature the kernel support needs to be there and we cannot detect that. max enclave size value is a bit value for 2^(<value>) computation.

K, can be added later, if needed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

expose it as an extended resource?). Maybe we should expose both, enabled and epcSize?

We have an NFD source hook to read epcSize and that value is registered as sgx.intel.com/epc. I guess NFD could register the value too but why not then use the NFD source hook because it comes with the device plugin that is also needed.

@mythi mythi marked this pull request as ready for review November 16, 2021 06:16
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 16, 2021
Copy link
Contributor

@marquiz marquiz left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 18, 2021
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
@mythi
Copy link
Contributor Author

mythi commented Nov 23, 2021

rebased to latest master and force pushed

Copy link
Contributor

@marquiz marquiz left a comment

Choose a reason for hiding this comment

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

Thanks @mythi for this enhancement 👍 Let's merge this and expand functionality in future, if needed

/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: marquiz, mythi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 24, 2021
@k8s-ci-robot k8s-ci-robot merged commit 9fbb938 into kubernetes-sigs:master Nov 24, 2021
@marquiz marquiz mentioned this pull request Dec 22, 2021
22 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve SGX labels
3 participants