Intel® Software Guard Extensions (Intel® SGX)
Discussion board focused on hardware-based isolation and memory encryption to provide extended code protection in solutions.

SGX driver works only with sudo

kai__chi
Novice
1,403 Views

Hi,

My problem is that SGX applications run only when ran with sudo access. Without it seems that it doesn't detect the driver. I am running the SampleEnclave application on a machine with Xeon Gold 6330 CPU, Ubuntu 22.04, kernel 5.15.0-87-generic, SGX SDK 2.22.

When I run sudo ./app I get a typical output:

Checksum(0x0x7ffe61adc650, 100) = 0xfffd4143
Info: executing thread synchronization, please wait...  
Info: SampleEnclave successfully returned.
Enter a character before exit ...

When I run just ./app:

[get_driver_type edmm_utility.cpp:116] Failed to open Intel SGX device.
[open_se_device edmm_utility.cpp:178] Failed to open Intel SGX device.
[get_driver_type /home/sgx/jenkins/ubuntuServer2204-release-build-trunk-222/build_target/PROD/label/Builder-UbuntuSrv2204/label_exp/ubuntu64/linux-trunk-opensource/psw/urts/linux/edmm_utility.cpp:116] Failed to open Intel SGX device.
Info: Please make sure SGX module is enabled in the BIOS, and install SGX driver afterwards.
Error: Invalid SGX device.
Enter a character before exit ...

 Any idea what is going on?

Labels (2)
0 Kudos
1 Solution
Scott_R_Intel
Employee
1,397 Views

On Ubuntu 22.04, you need to add your user to the "sgx" user group to be able to use the SGX device:

sudo usermod -aG sgx $USER

Make sure you log out and back in for the group add to take effect.

View solution in original post

4 Replies
Scott_R_Intel
Employee
1,398 Views

On Ubuntu 22.04, you need to add your user to the "sgx" user group to be able to use the SGX device:

sudo usermod -aG sgx $USER

Make sure you log out and back in for the group add to take effect.

Wan_Intel
Moderator
1,366 Views

Hi Kai Chi,

Thanks for reaching out to us.


Did you build the project with sudo command?


Could you please run make clean command in the terminal and build the application again without sudo?

Regards,

Wan


0 Kudos
kai__chi
Novice
1,307 Views

Thanks! Adding user to group sgx solved the problem. I overlooked it in the new installation guide.

Wan_Intel
Moderator
1,296 Views

Hi Scott_R_Intel,

Thanks for sharing the solution in the Intel® SGX community.

 

Hi Kai__chi,

Glad to know that your issue has been resolved. We'll close this case now. Please open a new question if additional information is needed and we'll be happy to help.

 

 

Regards,

Wan


0 Kudos
Reply