Skip to content

Commit

Permalink
Update SGX-LKL to use LKL based on Linux v5.4.62 (#822)
Browse files Browse the repository at this point in the history
* Update to LKL 5.4.62
* Fix mount options
* Fix printing of lthread state
* Apply Wireguard patch for Linux 5.4.62 compatibility
* Ignore generated user-space object files
  • Loading branch information
prp committed Sep 7, 2020
1 parent e3d6aa0 commit 5ca2576
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ src/include/shared/sgxlkl_args.h
src/main-oe/sgxlkl_u.c
src/enclave/sgxlkl_t.c

user/enter.o
user/stubs.o

*.tar.gz
*.class
*.log
Expand Down
2 changes: 1 addition & 1 deletion lkl
Submodule lkl updated 15340 files
4 changes: 2 additions & 2 deletions src/lkl/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ static void lkl_mount_devtmpfs(const char* mntpoint)

static void lkl_mount_shmtmpfs()
{
int err = lkl_sys_mount("tmpfs", "/dev/shm", "tmpfs", 0, "rw,nodev");
int err = lkl_sys_mount("tmpfs", "/dev/shm", "tmpfs", 0, "mode=1777,rw");
if (err != 0)
{
sgxlkl_fail("lkl_sys_mount(tmpfs) (/dev/shm): %s\n", lkl_strerror(err));
Expand All @@ -199,7 +199,7 @@ static void lkl_mount_shmtmpfs()

static void lkl_mount_tmpfs()
{
int err = lkl_sys_mount("tmpfs", "/tmp", "tmpfs", 0, "mode=0777");
int err = lkl_sys_mount("tmpfs", "/tmp", "tmpfs", 0, "mode=1777");
if (err != 0)
{
sgxlkl_fail("lkl_sys_mount(tmpfs): %s\n", lkl_strerror(err));
Expand Down
4 changes: 2 additions & 2 deletions src/sched/lthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -1010,8 +1010,8 @@ static void lthread_state_to_string(
STRINGIFY_LT_STATE(EXPIRED)
STRINGIFY_LT_STATE(DETACH)
STRINGIFY_LT_STATE(PINNED)
STRINGIFY_LT_STATE(TERMINATE)
STRINGIFY_LT_STATE(APP_MAIN)
STRINGIFY_LT_STATE(TERMINATE)

lt_state_str[offset - 1] = '\0';
}
Expand All @@ -1023,7 +1023,6 @@ void lthread_dump_all_threads(bool is_lthread)
sgxlkl_info("Stack traces for all lthreads:\n");

struct lthread* this_lthread = NULL;
char lt_state_str[1024] = "";

// Is this called from an lthread?
if (is_lthread)
Expand All @@ -1040,6 +1039,7 @@ void lthread_dump_all_threads(bool is_lthread)
{
int tid = lt->tid;
char* funcname = lt->attr.funcname;
char lt_state_str[1024] = "";

lthread_state_to_string(lt, lt_state_str, 1024);

Expand Down
1 change: 1 addition & 0 deletions third_party/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ${E2FSPROGS}:
${WIREGUARD}:
wget --retry-connrefused -O "${MAKE_ROOT}/wireguard.tar.gz" 'https://download.wireguard.com/monolithic-historical/WireGuard-0.0.20191219.tar.xz'
mkdir -p $@ && tar -C $@ --strip 1 -xf ${MAKE_ROOT}/wireguard.tar.gz
patch -p0 < wireguard-5.4.62.patch
rm ${MAKE_ROOT}/wireguard.tar.gz

${CURL}:
Expand Down
12 changes: 12 additions & 0 deletions third_party/wireguard-5.4.62.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- wireguard/src/queueing.h-orig 2020-09-04 22:06:22.035017800 +0000
+++ wireguard/src/queueing.h 2020-09-04 22:06:42.047326678 +0000
@@ -97,8 +97,8 @@
skb->dev = NULL;
#ifdef CONFIG_NET_SCHED
skb->tc_index = 0;
- skb_reset_tc(skb);
#endif
+ skb_reset_redirect(skb);
skb->hdr_len = skb_headroom(skb);
skb_reset_mac_header(skb);
skb_reset_network_header(skb);

0 comments on commit 5ca2576

Please sign in to comment.