mirror of
https://github.com/clearlinux/graphene.git
synced 2026-09-06 22:01:29 +00:00
[Pal/Linux-SGX] Set CLOEXEC on /dev/isgx and /dev/gsgx
On host exec, file descriptors for /dev/isgx and /dev/gsgx are leaked. Set CLOEXEC for them to be closed when emulating fork/exec by using host exec.
This commit is contained in:
committed by
Michał Kowalczyk
parent
edb0888988
commit
9d3344b808
@@ -15,17 +15,19 @@ void * zero_page;
|
||||
|
||||
int open_gsgx(void)
|
||||
{
|
||||
gsgx_device = INLINE_SYSCALL(open, 3, GSGX_FILE, O_RDWR, 0);
|
||||
gsgx_device = INLINE_SYSCALL(open, 3, GSGX_FILE, O_RDWR | O_CLOEXEC, 0);
|
||||
if (IS_ERR(gsgx_device)) {
|
||||
SGX_DBG(DBG_E, "Cannot open device " GSGX_FILE ". Please make sure the"
|
||||
" \'graphene_sgx\' kernel module is loaded.\n");
|
||||
return -ERRNO(gsgx_device);
|
||||
}
|
||||
|
||||
isgx_device = INLINE_SYSCALL(open, 3, ISGX_FILE, O_RDWR, 0);
|
||||
isgx_device = INLINE_SYSCALL(open, 3, ISGX_FILE, O_RDWR | O_CLOEXEC, 0);
|
||||
if (IS_ERR(isgx_device)) {
|
||||
SGX_DBG(DBG_E, "Cannot open device " ISGX_FILE ". Please make sure the"
|
||||
" Intel SGX kernel module is loaded.\n");
|
||||
INLINE_SYSCALL(close, 1, gsgx_device);
|
||||
gsgx_device = -1;
|
||||
return -ERRNO(isgx_device);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user