-
Notifications
You must be signed in to change notification settings - Fork 241
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
Remove JIT and interpreter code from NativeOnly builds #2475
Conversation
88396ec
to
f7a53a1
Compare
5fc1ceb
to
c5d50c5
Compare
Codecov Report
@@ Coverage Diff @@
## main #2475 +/- ##
==========================================
- Coverage 83.99% 83.96% -0.03%
==========================================
Files 157 157
Lines 29116 29119 +3
==========================================
- Hits 24456 24450 -6
- Misses 4660 4669 +9
|
23ed3a1
to
2ae2e07
Compare
b9a693c
to
57aa29d
Compare
libs/api/libbpf_program.cpp
Outdated
@@ -25,6 +25,7 @@ bpf_load_program_xattr(const struct bpf_load_program_attr* load_attr, char* log_ | |||
return libbpf_err(-EINVAL); | |||
} | |||
|
|||
#if !defined(CONFIG_BPF_JIT_DISABLED) && !defined(CONFIG_BPF_INTERPRETER_DISABLED) |
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.
nit: why do we want to block this at API layer also if it is already blocked in ebpfcore? Anyone can modify and recompile this dll to override this.
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.
Will having the checks in user mode block us to test the ebpfcore code where it fails the jit and interpret IOCTL calls for native_only case?
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.
nit: why do we want to block this at API layer also if it is already blocked in ebpfcore? Anyone can modify and recompile this dll to override this.
footprint reduction, and also changes the error return from "invalid value" to the more specific "not supported" meaning.
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.
Will having the checks in user mode block us to test the ebpfcore code where it fails the jit and interpret IOCTL calls for native_only case?
The UM unit tests test that code path.
@@ -1139,6 +1158,7 @@ DECLARE_CGROUP_SOCK_ADDR_LOAD_TEST( | |||
DECLARE_CGROUP_SOCK_ADDR_LOAD_TEST( | |||
SAMPLE_PATH "cgroup_sock_addr", "authorize_recv_accept6", EBPF_ATTACH_TYPE_CGROUP_INET6_RECV_ACCEPT); | |||
|
|||
#if !defined(CONFIG_BPF_JIT_DISABLED) |
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.
nit: instead of removing these tests from native build, we could possibly use native_module_helper_t
helper to get an appropriate file name (.sys or .o) based on whether JIT is enabled or disabled.
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.
Yes that's what #1121 already covers.
libs/api/ebpf_api.cpp
Outdated
@@ -2528,6 +2538,7 @@ _Requires_lock_not_held_(_ebpf_state_mutex) static ebpf_result_t | |||
EBPF_RETURN_RESULT(result); | |||
} | |||
|
|||
#if !defined(CONFIG_BPF_JIT_DISABLED) && !defined(CONFIG_BPF_INTERPRETER_DISABLED) |
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.
If JIT is enabled but INTERPRET is disabled (which is the case of Regular/Release build), do we still want to disable this API?
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.
no. I think you're saying the &&
should be ||
and I think you're right
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.
yes I meant to say that only -- that it should be ||
instead 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.
Done
@@ -9,11 +9,17 @@ | |||
|
|||
typedef enum _ebpf_operation_id | |||
{ | |||
#if !defined(CONFIG_BPF_JIT_DISABLED) |
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.
nit: removing the operation ids from the middle will cause the value of the other ids to change. So the same operation ID will have different value in native-only vs. regular build. Not sure if this can cause any issues.
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.
Since the IDs are not used in apps (they should be calling libbpf) it's ok to have breaking changes in my view
Fixes microsoft#2030 Fixes microsoft#2488 Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Description
Remove JIT and interpreter code from NativeOnly builds
Fixes #2030 (security cleanup)
Fixes #2488 (bug)
Also fixes version number typo in GettingStarted.md
Testing
Updated CI/CD
Note that issue #2281 only updated kernel tests to use sys files, it did not update the user-mode tests in
tests/unit/libbpf_test.cpp
andtests/end_to_end/end_to_end.cpp
, so in this PR the relevant ones are commented out. Issue #1121 covers updating the relevant ones to use dlls, and also covers updating port_quota.exe.Documentation
Updated docs