-
Notifications
You must be signed in to change notification settings - Fork 0
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
Syscall filtering PoC #267
Conversation
89aafe8
to
247ae37
Compare
247ae37
to
5147254
Compare
There are demos of four runtime components here:
|
|
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.
Mostly just minor comments.
Could you add a bit of doc comments (e.g. what you put in the PR comments) for each of the POC main files? Just so someone can tell what a thing should do when they open it.
I like the idea of doing the memory map tracker in Rust, let's do it.
// this would compare syscall number to write() and allow if it matches | ||
/*BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_write, 0, 1), | ||
BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW),*/ |
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 don't think these comment are necessary, the macros is pretty straightforward.
// a user notification fd to pass to the supervisor, but we also want to pass | ||
// FLAG_TSYNC, and these two cannot be combined in one call because they | ||
// impose conflicting interpretations on the syscall return value. | ||
int sc_unotify_fd = syscall(SYS_seccomp, SECCOMP_SET_MODE_FILTER, |
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.
Might be worth adding a comment after this saying what we would do with this fd?
6d03c28
to
8758dd1
Compare
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.
Have a few comments from last time that still seem relevant. New stuff looks ok, but I'll take another look tomorrow.
0ce7e62
to
2c232c9
Compare
2c232c9
to
e17a907
Compare
use no_std as this reduces binary size from several megs to 36kB
also rename remove -> unmap because unmap can actually split regions but definitely does unmap exactly the region specified
this is not comprehensive, but is enough for tests to pass
…rtment at most once we'll want to revisit this when #165 is solved and we can enforce stricter ownership over allocations
unfortunately, even when tracing a program from exec(), the initial mappings of stack and executable are pre-existing and not known to the tracer. we could read them from /proc/<pid>/maps, but for now we simply allow to protect these unknown regions of memory. TODO: file a bug on this
…validating mmap(NULL)
…ame permissions that currently apply
…startup as compartment 0
e17a907
to
dcc2167
Compare
I said I wasn't going to clean up this history but I ended up doing it just to make sure the code was all in good shape. As such, merging via rebase rather than squash. Some of the intermediate commits are worth noticing individually as they're changes to our memory-management policy needed to run real programs, which we may want to revisit later. |
This adds some demos and infrastructure used by both those demos and eventually the final runtime. We still need to weld together the pieces in the manner described best in our slides, and the memory-map tracking is still WIP. I would plausibly prefer rewriting part of the memory-map tracking in Rust (
memory_map.c
) to have access to fancier data structures and more assurances.