-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support the clone system call. #259
Conversation
Don't merge this yet: the LKL commit will change once lsds/lkl#1 is merged. I'll force-push to this branch to update the LKL submodule once that's done. |
Note that this doesn't yet fix #154. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, some minor comments. I see CI failures though...
CI is failing because the weak symbol for |
@@ -0,0 +1,11 @@ | |||
FROM alpine:3.6 AS builder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of curiosity, given that 3.6 is rather dated. is there a "no later than X" dependency for sgx-lkl that I'm not aware of?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use a consistent Alpine version in all tests. @letmaik?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened #260. For this PR, it's fine to leave it at an arbitrary version. The maximum supported currently is 3.10.
6fe9619
to
23f27cf
Compare
I started looking into the failing
At this point, you are prepped to run the single test for HW mode:
for SW mode: SGXLKL_VERBOSE=1 SGXLKL_KERNEL_VERBOSE=0 ../../../build/sgx-lkl-run-oe --sw-debug sgxlkl-miniroot-fs.img /ltp/testcases/kernel/syscalls/access/access02 Result I getHW: tst_test.c:1106: INFO: Timeout per run is 0h 05m 00s SW: It hangs after printing access02.c:144: PASS: access(file_w, W_OK) as nobody behaviour is correct. This is somewhat different than what I am seeing in CI, so, before I proceed any further, @davidchisnall can you try recreating the above? The source of the failing test is https://github.com/linux-test-project/ltp/blob/master/testcases/kernel/syscalls/access/access02.c |
Thanks @SeanTAllen. I actually see something more interesting when I try to reproduce this locally:
So it appears that we're hitting the code path for creating a new clone'd task (for a test that shouldn't be calling clone). I'll take a look. |
This implements two new LKL hooks. The first one to create an lthread with a specific initial register state (to capture the returns-twice behaviour of clone, along with the caller's ability to define the stack and TLS addresses). The new thread is immediately associated with the Linux task structure (normally, lthreads are associated with Linux tasks lazily when they perform a system call). The second hook destroys a thread. This is done in response to an exit system call. This is somewhat complicated, because LKL never returns to this thread and the thread's stack may be deallocated by the time we exit it. The lthread scheduler does not have an easy way of adding a mechanism to kill a thread without that thread running. We can add one eventually, but for now create a temporary stack that lthreads can use during teardown and make them run the teardown from there. Disable access02 test. It is spuriously passing and this makes it fail. See #277 for more information. Fixes #155
This implements two new LKL hooks. The first one to create an lthread
with a specific initial register state (to capture the returns-twice
behaviour of clone, along with the caller's ability to define the stack
and TLS addresses). The new thread is immediately associated with the
Linux task structure (normally, lthreads are associated with Linux tasks
lazily when they perform a system call).
The second hook destroys a thread. This is done in response to an exit
system call. This is somewhat complicated, because LKL never returns to
this thread and the thread's stack may be deallocated by the time we
exit it.
The lthread scheduler does not have an easy way of adding a mechanism to
kill a thread without that thread running. We can add one eventually,
but for now create a temporary stack that lthreads can use during
teardown and make them run the teardown from there.
Fixes #155