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

Populate /proc/cpuinfo with complete and attested entries #529

Open
prp opened this issue Jun 25, 2020 · 2 comments
Open

Populate /proc/cpuinfo with complete and attested entries #529

prp opened this issue Jun 25, 2020 · 2 comments
Labels
area: sgx-lkl Core SGX-LKL functionality enhancement p1 Medium priority
Milestone

Comments

@prp
Copy link
Member

prp commented Jun 25, 2020

Applications such as OpenVINO (https://github.com/opencv/dldt) parse '/proc/cpuinfo' instead of using sysconf (which SGX-LKL supports) to obtain CPU information. Without valid entries in `/proc/cpuinfo', this is broken.

SGX-LKL has some limited support for cpuinfo by populating this with valid (static) values:

https://github.com/lsds/lkl/blob/86819ac5446e1fa31ca67db68aa165bbf07b90a9/arch/lkl/kernel/proc.c#L13

A full solution should read the host cpuinfo and bring some of that information into the enclave. For security reasons, it needs to be attested and checked for plausibility. The number of CPU cores should be set to the number of ethreads (which is also what we do for sysconf information inside the enclave.)

A proper implementation of cpuinfo will also have to bring in more x86 architecture specific code under arch/lkl/, in particular, cpu.h.

(Related to #256.)

@prp prp added enhancement area: sgx-lkl Core SGX-LKL functionality p1 Medium priority labels Jun 25, 2020
@prp prp added this to the Milestone 1 milestone Jun 25, 2020
@davidchisnall
Copy link
Contributor

I think the right way to approach this is to add a hook in LKL that exposes host ops for populating /proc/cpuinfo. We can then populate it from the same source that we use for emulating CPUID and for sysinfo, once we have that information in the attested configuration.

@AntonioND
Copy link
Contributor

This PR partially fixes this issue: #798 It adds the host ops that can be used to populate cpuinfo, and fills it with mostly dummy information. The only values that are real are the number of CPUs, and the indexes of CPUs, which is obtained from the number of ethreads.

@AntonioND AntonioND removed their assignment Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: sgx-lkl Core SGX-LKL functionality enhancement p1 Medium priority
Projects
None yet
Development

No branches or pull requests

3 participants