occlum / occlum

Occlum is a memory-safe, multi-process library OS for Intel SGX
https://occlum.io/
Other
1.39k stars 235 forks source link

[BUG] ioctl SGXIOC_GET_EPID_GROUP_ID test failure on Aliyun SGX v2 VM #594

Open jessehui opened 3 years ago

jessehui commented 3 years ago

Describe the bug

ioctl SGXIOC_GET_EPID_GROUP_ID test failure.

To reproduce

Steps to reproduce the behavior:

  1. TESTS=ioctl make test

Logs

If applicable, add logs to help explain your problem.

[2021-08-12T06:15:56.360Z][TRACE][T2][#24][··Writev] Retval = 54
[2021-08-12T06:15:56.360Z][TRACE][T2][#25][····Open] Syscall { num = Open, path = 0x7ffa88c02831, flags = 0, mode = 0 }
[2021-08-12T06:15:56.360Z][DEBUG][T2][#25][····Open] openat: fs_path: FsPath { Absolute("/dev/sgx") }, flags: 0o0, mode: 0o0
[2021-08-12T06:15:56.360Z][DEBUG][T2][#25][····Open] lookup_inode: cwd: "/", path: "/dev/sgx"
[2021-08-12T06:15:56.360Z][DEBUG][T2][#25][····Open] convert_to_abs_path: cwd: "/", path: "/dev/sgx"
[2021-08-12T06:15:56.360Z][TRACE][T2][#25][····Open] Retval = 3
[2021-08-12T06:15:56.360Z][TRACE][T2][#26][···Ioctl] Syscall { num = Ioctl, fd = 3, cmd = 2147775233, argp = 0x7ffa8a1ffdec }
[2021-08-12T06:15:56.360Z][DEBUG][T2][#26][···Ioctl] ioctl: fd: 3, cmd: NonBuiltin(NonBuiltinIoctlCmd { cmd_num: StructuredIoctlNum { cmd_id: 1, magic_char: 115, arg_size: 4, arg_type: Output }, arg_buf: Some([0, 0, 0, 0]) })
aesm_service[13]: [ADMIN]EPID Provisioning initiated
aesm_service[13]: The Request ID is 842c05db896a4a859f4fa7af4aba1940
aesm_service[13]: The Request ID is 2f5480511b534a6baa7e8fd36761a4fc
aesm_service[13]: [ADMIN]EPID Provisioning protocol error reported by Backend (6)
aesm_service[13]: [ADMIN]EPID Provisioning failed
[2021-08-12T06:16:01.470Z][ERROR][T2][#26][···Ioctl] EINVAL (#22, Invalid argument): occlum_ocall_sgx_init_quote failed [line = 82, file = src/util/sgx/epid/attestation_agent.rs]
[2021-08-12T06:16:01.470Z][ERROR][T2][#26][···Ioctl] Error = EINVAL (#22, Invalid argument): IOCTLError
[2021-08-12T06:16:01.470Z][TRACE][T2][#26][···Ioctl] Retval = -22
[2021-08-12T06:16:01.470Z][TRACE][T2][#27][··Writev] Syscall { num = Writev, fd = 1, iov = 0x7ffa8a1ffa10, count = 2 }
[2021-08-12T06:16:01.470Z][DEBUG][T2][#27][··Writev] writev: fd: 1
        ERROR:failed to ioctl /dev/sgx in func do_SGXIOC_GET_EPID_GROUP_ID at line 169 of file main.c with errno 22: Invalid argument
[2021-08-12T06:16:01.470Z][TRACE][T2][#27][··Writev] Retval = 128
[2021-08-12T06:16:01.470Z][TRACE][T2][#28][···Close] Syscall { num = Close, fd = 3 }
[2021-08-12T06:16:01.470Z][DEBUG][T2][#28][···Close] close: fd: 3
[2021-08-12T06:16:01.470Z][TRACE][T2][#28][···Close] Retval = 0
[2021-08-12T06:16:01.470Z][TRACE][T2][#29][··Writev] Syscall { num = Writev, fd = 1, iov = 0x7ffa8a1ffa70, count = 2 }
[2021-08-12T06:16:01.470Z][DEBUG][T2][#29][··Writev] writev: fd: 1
  func test_sgx_ioctl_SGXIOC_GET_EPID_GROUP_ID - [ERR]
[2021-08-12T06:16:01.470Z][TRACE][T2][#29][··Writev] Retval = 55
[2021-08-12T06:16:01.470Z][TRACE][T2][#30][ExitGroup] Syscall { num = ExitGroup, exit_status = -1 }
[2021-08-12T06:16:01.470Z][DEBUG][T2][#30][ExitGroup] exit_group: -1
[2021-08-12T06:16:01.470Z][DEBUG][T2][#30][ExitGroup] futex_wake_bitset addr: 0x7ffa89295364, max_count: 1, bitset: 0xffffffff
[2021-08-12T06:16:01.470Z][DEBUG][T2][#30][ExitGroup] futex_wake_bitset addr: 0x7ffa80e0df40, max_count: 1, bitset: 0xffffffff
[2021-08-12T06:16:01.470Z][TRACE][T2][#30][ExitGroup] Retval = 0
[2021-08-12T06:16:01.470Z][ INFO][T2][#30][ExitGroup] Thread exited: tid = 2, status = 255
[2021-08-12T06:16:01.470Z][ INFO][T0][#30][ExitGroup] user space vm free: VMRange { start: 0x7ffa87ce6000, end: 0x7ffa8f4e6000, size: 0x7800000 }
[2021-08-12T06:16:01.470Z][ INFO][T0][#30][ExitGroup] Idle process reaps zombie children pid = []
[2021-08-12T06:16:01.470Z][ WARN][T0][#30][ExitGroup] HostFS: sync is unimplemented

Environment

Additional context

Add any other context about the problem here.

Possible solution/Implementation

Not obligatory, but suggest a fix/reason for the bug.

guzongmin commented 3 years ago

SGX V2 only support DCAP, EPID case should fail.