Giter Club home page Giter Club logo

sgx-emulator's Introduction

SGX-emulator and SDK

Use the emulator with the following specific setting only!

64-bit Ubuntu 14.04.3 LTS guest OS in VirtualBox

(This is the setting we have tested so far, and we can ensure the working of our emulator! We may relieve the requirement on VirtualBox in the future release.)

Before execution, make sure about the right Linux version

uname -r
3.19.0-25-generic

Here's a prebuilt VirtualBox image. The username and password to login the system are both "sgx"

https://www.dropbox.com/s/z18a12m09ajw6ry/sgx-env.vdi?dl=0

Demo

sudo insmod sgx.ko
make sha
#sudo dmesg -c
make r # view the standard output
dmesg # view kernel output
sudo rmmod sgx

(alternative, you can also run make in the second line).

Explanation

This demo will show you a simple Enclave program that computes sha1 (cryptographic hash from openssl) inside Enclave.

  • In user-space code, it appears to be a simple function call into a dynamically loaded library.
  • In dmesg, you can see that the function call is "captured" in the kernel space (triggered by an illegal instruction, verified through the following "experiment"). We use this kernel-space hooking to emulate the SGX ENCLU instructions (EENTER and EEXIT).
sudo rmmod sgx
make r #you should be able to see the "illegal instruction" exception

sgx-emulator's People

Contributors

chenju2k6 avatar tristartom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sgx-emulator's Issues

SGX.ko

Greetings,

do you have the source code of the SGX.ko file ?

Thanks

insmod: error inserting 'sgx.ko': -1 Invalid module format

insmod: error inserting 'sgx.ko': -1 Invalid module format
my VM configuration:
uname -a: Linux ubuntu 3.19.0-031900-generic #201504091832 SMP Thu Apr 9 17:35:46 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
the virtualization software is virtualbox 5.0.14

make: *** [run] Illegal instruction

Hi, any instructions on how to use the sgx-emulator at https://github.com/tristartom/sgx-emulator?
I've configured a ubuntu 1404 VM using vmware and the kernel is 3.19 as the readme says, but it still failed to insmod or run the sgx module. The error is as follows:

sudo insmod sgx.ko

insmod: ERROR: could not insert module sgx.ko: Invalid module format

make r

TT: base:0x2b608daea000, _entry_point:0x2b608daeaf03, diff: 0xf03, args: 0x7fff02d71970
00400000-00402000 r-xp 00000000 08:01 6167990 /home/john/sgx-emulator/bin/a.out
00601000-00602000 r--p 00001000 08:01 6167990 /home/john/sgx-emulator/bin/a.out
00602000-00603000 rw-p 00002000 08:01 6167990 /home/john/sgx-emulator/bin/a.out
00d07000-00d28000 rw-p 00000000 00:00 0 [heap]
2b608d2fc000-2b608d31f000 r-xp 00000000 08:01 4723319 /lib/x86_64-linux-gnu/ld-2.19.so
2b608d31f000-2b608d322000 rw-p 00000000 00:00 0
2b608d32f000-2b608d332000 rw-p 00000000 00:00 0
2b608d51e000-2b608d51f000 r--p 00022000 08:01 4723319 /lib/x86_64-linux-gnu/ld-2.19.so
2b608d51f000-2b608d520000 rw-p 00023000 08:01 4723319 /lib/x86_64-linux-gnu/ld-2.19.so
2b608d520000-2b608d521000 rw-p 00000000 00:00 0
2b608d521000-2b608d524000 r-xp 00000000 08:01 4723311 /lib/x86_64-linux-gnu/libdl-2.19.so
2b608d524000-2b608d723000 ---p 00003000 08:01 4723311 /lib/x86_64-linux-gnu/libdl-2.19.so
2b608d723000-2b608d724000 r--p 00002000 08:01 4723311 /lib/x86_64-linux-gnu/libdl-2.19.so
2b608d724000-2b608d725000 rw-p 00003000 08:01 4723311 /lib/x86_64-linux-gnu/libdl-2.19.so
2b608d725000-2b608d8e0000 r-xp 00000000 08:01 4723322 /lib/x86_64-linux-gnu/libc-2.19.so
2b608d8e0000-2b608dadf000 ---p 001bb000 08:01 4723322 /lib/x86_64-linux-gnu/libc-2.19.so
2b608dadf000-2b608dae3000 r--p 001ba000 08:01 4723322 /lib/x86_64-linux-gnu/libc-2.19.so
2b608dae3000-2b608dae5000 rw-p 001be000 08:01 4723322 /lib/x86_64-linux-gnu/libc-2.19.so
2b608dae5000-2b608daea000 rw-p 00000000 00:00 0
2b608daea000-2b608daec000 r-xp 00000000 08:01 6167988 /home/john/sgx-emulator/bin/enclave_foo.so
2b608daec000-2b608dceb000 ---p 00002000 08:01 6167988 /home/john/sgx-emulator/bin/enclave_foo.so
2b608dceb000-2b608dcec000 r--p 00001000 08:01 6167988 /home/john/sgx-emulator/bin/enclave_foo.so
2b608dcec000-2b608dced000 rw-p 00002000 08:01 6167988 /home/john/sgx-emulator/bin/enclave_foo.so
2b608dced000-2b608ddd3000 r-xp 00000000 08:01 3932544 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
2b608ddd3000-2b608dfd2000 ---p 000e6000 08:01 3932544 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
2b608dfd2000-2b608dfda000 r--p 000e5000 08:01 3932544 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
2b608dfda000-2b608dfdc000 rw-p 000ed000 08:01 3932544 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19
2b608dfdc000-2b608dff1000 rw-p 00000000 00:00 0
2b608dff1000-2b608e007000 r-xp 00000000 08:01 4722754 /lib/x86_64-linux-gnu/libgcc_s.so.1
2b608e007000-2b608e206000 ---p 00016000 08:01 4722754 /lib/x86_64-linux-gnu/libgcc_s.so.1
2b608e206000-2b608e207000 rw-p 00015000 08:01 4722754 /lib/x86_64-linux-gnu/libgcc_s.so.1
2b608e207000-2b608e30c000 r-xp 00000000 08:01 4723307 /lib/x86_64-linux-gnu/libm-2.19.so
2b608e30c000-2b608e50b000 ---p 00105000 08:01 4723307 /lib/x86_64-linux-gnu/libm-2.19.so
2b608e50b000-2b608e50c000 r--p 00104000 08:01 4723307 /lib/x86_64-linux-gnu/libm-2.19.so
2b608e50c000-2b608e50d000 rw-p 00105000 08:01 4723307 /lib/x86_64-linux-gnu/libm-2.19.so
7fff02d52000-7fff02d73000 rw-p 00000000 00:00 0 [stack]
7fff02dc0000-7fff02dc2000 r--p 00000000 00:00 0 [vvar]
7fff02dc2000-7fff02dc4000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
note: sections in order: .text, .rodata, .bss
TT: begin of e_enter: which_enclave: 0xd07010; entry_point: 0x2b608daeaf03, rip_enter:400fb5, rt_args: 0x7fff02d71970
make: *** [run] Illegal instruction

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.