This repository has been archived by the owner on Jan 10, 2025. It is now read-only.
forked from qmonnet/rbpf
-
Notifications
You must be signed in to change notification settings - Fork 183
Refactor - Moves config flags into executable capabilities #473
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## main #473 +/- ##
==========================================
+ Coverage 89.65% 89.81% +0.15%
==========================================
Files 23 23
Lines 9989 10195 +206
==========================================
+ Hits 8956 9157 +201
- Misses 1033 1038 +5
|
Lichtso
force-pushed
the
refactor/executable_capabilities
branch
8 times, most recently
from
June 21, 2023 18:35
ebb0385
to
42e217f
Compare
alessandrod
reviewed
Jun 25, 2023
src/elf.rs
Outdated
@@ -260,13 +261,26 @@ pub(crate) enum Section { | |||
Borrowed(usize, Range<usize>), | |||
} | |||
|
|||
/// Defines a set of capabilities of an executable | |||
#[derive(Debug, PartialEq, Eq, Clone)] | |||
pub enum ExecutableCapabilities { |
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.
Wouldn't it be better if this was
#[deive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
enum SbpfVersion {
V1 = 1,
V2 = 2,
V3 = 3,
}
impl SbpfVersion {
fn has_static_syscalls(&self) -> bool {
self >= SbpfVersion::V2
}
fn allows_elf_virtual_addresses(&self) -> bool { ... }
...
}
Then in the call sites it would be obvious from the has_*
name what's being
checked for, and we wouldn't have to go and edit call sites if we flip things on
and off across versions.
Lichtso
force-pushed
the
refactor/executable_capabilities
branch
from
June 26, 2023 14:22
42e217f
to
11ad14d
Compare
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Makes the SBPF version selectable per executable, instead of per loader.
Replaces:
Config::dynamic_stack_frames
Config::enable_sdiv
Config::static_syscalls
Config::enable_elf_vaddr
Config::reject_rodata_stack_overlap
With
Config::enable_sbpf_v1
andConfig::enable_sbpf_v2
.