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

fix for newest nightly #157

Merged
merged 1 commit into from
Jul 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions enclave-runner/src/tcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ pub(crate) fn coenter<T: Tcs>(
let mut _tmp2: u64;

unsafe {
let mut uninit_debug_buf: DebugBuffer;
let mut uninit_debug_buf: std::mem::MaybeUninit<DebugBuffer>;
let debug_buf = debug_buf.map(|r| r.borrow_mut());
let debug_buf = match debug_buf {
Some(mut buf) => buf.as_mut_ptr(),
None => {
uninit_debug_buf = std::mem::uninitialized();
uninit_debug_buf.as_mut_ptr()
uninit_debug_buf = std::mem::MaybeUninit::uninit();
uninit_debug_buf.as_mut_ptr() as *mut _
}
};
asm!("
Expand Down
18 changes: 9 additions & 9 deletions sgxs-tools/src/sgx_detect/tests/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,26 @@ impl DebugSupport for SgxCpuConfiguration {
if !Paint::is_enabled() {
swcontrol_msg = swcontrol_msg.replace('“', r#"""#).replace('”', r#"""#).into();
}
const SGX_DISABLED: Result<EfiSoftwareguardstatus, Rc<Error>> = Ok(EfiSoftwareguardstatus { status: SgxEnableStatus::Disabled });
Copy link
Member

Choose a reason for hiding this comment

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

You said this is going to be fixed in tomorrow's nightly? Then don't make these changes

Copy link
Member Author

@Goirad Goirad Jul 12, 2019

Choose a reason for hiding this comment

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

Well, I said that but what I meant was there is an open PR that makes the warning allow instead of deny. Jeffrey said that it is probably not a false positive, so we would have to deal with it regardless.

Copy link
Member Author

Choose a reason for hiding this comment

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

Issue and PR

const SGX_ENABLED: Result<EfiSoftwareguardstatus, Rc<Error>> = Ok(EfiSoftwareguardstatus { status: SgxEnableStatus::Enabled });
const SGX_SWCONTROL: Result<EfiSoftwareguardstatus, Rc<Error>> = Ok(EfiSoftwareguardstatus { status: SgxEnableStatus::SoftwareControlled });
const SGX_UNKNOWN: Result<EfiSoftwareguardstatus, Rc<Error>> = Ok(EfiSoftwareguardstatus { status: SgxEnableStatus::Unknown });
const SGX_DISABLED: EfiSoftwareguardstatus = EfiSoftwareguardstatus { status: SgxEnableStatus::Disabled };
const SGX_ENABLED: EfiSoftwareguardstatus = EfiSoftwareguardstatus { status: SgxEnableStatus::Enabled };
const SGX_SWCONTROL: EfiSoftwareguardstatus = EfiSoftwareguardstatus { status: SgxEnableStatus::SoftwareControlled };
const SGX_UNKNOWN: EfiSoftwareguardstatus = EfiSoftwareguardstatus { status: SgxEnableStatus::Unknown };

writeln!(out, "Your hardware supports SGX, but it's not enabled.\n")?;

match (&inner.efi_status, &inner.efi_epcbios) {
(&SGX_DISABLED, _) => {
(&Ok(SGX_DISABLED), _) => {
writeln!(out, "Your BIOS supports SGX, but it's disabled. Reboot your machine and enable SGX in your BIOS.")?;
debug_msr = false;
},
(&SGX_ENABLED, _) => {
(&Ok(SGX_ENABLED), _) => {
writeln!(out, "Your BIOS says it supports SGX and SGX is enabled, but it's not. Try updating your BIOS to the latest version or contact your BIOS vendor.")?;
},
(&SGX_SWCONTROL, Err(e)) if is_efi_perm_error(&e) => {
(&Ok(SGX_SWCONTROL), Err(e)) if is_efi_perm_error(&e) => {
writeln!(out, "Your BIOS says it supports SGX reconfiguration, but the control mechanism could not be accessed due to a permission issue.")?;
writeln!(out, "\nWould you like to re-run this program with sudo to try again?\n{}", Paint::red("(not supported yet)"))?; //TODO
}
(&SGX_SWCONTROL, Err(_)) => {
(&Ok(SGX_SWCONTROL), Err(_)) => {
write!(out, "Your BIOS says it supports SGX reconfiguration, but there is a problem with the control mechanism.")?;
writeln!(out, "{}", swcontrol_msg)?;
},
Expand All @@ -95,7 +95,7 @@ impl DebugSupport for SgxCpuConfiguration {
writeln!(out, "BIOS support for SGX could not be determined due to a permission issue.")?;
writeln!(out, "\nWould you like to re-run this program with sudo to try again?\n{}", Paint::red("TODO"))?;
}
(&SGX_UNKNOWN, Err(_)) | (Err(_), Err(_)) => {
(&Ok(SGX_UNKNOWN), Err(_)) | (Err(_), Err(_)) => {
writeln!(out, "BIOS support for SGX could not be determined. Reboot your machine and try to enable SGX in your BIOS. Alternatively, try updating your BIOS to the latest version or contact your BIOS vendor.")?;
}
}
Expand Down