-
Notifications
You must be signed in to change notification settings - Fork 136
Conversation
Signed-off-by: Junyeong Jeong <rhdxmr@gmail.com>
Signed-off-by: Junyeong Jeong <rhdxmr@gmail.com>
Signed-off-by: Junyeong Jeong <rhdxmr@gmail.com>
Signed-off-by: Junyeong Jeong <rhdxmr@gmail.com>
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 like this, and it looks thorough.
However, it seems like struct alignment is a contentious issue. Is there a way we could document a recommendation on using a particular alignment using the #[repr(align(8))]
proc macro for instance?
It seems like it will be pretty cumbersome to use hashtables, as unaligned structs can be arbitrary in how they work with the verifier.
I wrote a comment about the alignment at #150. I hope we have some documentation that states this limit clearly. |
I also considered raising compilation error if the alignment of the value is greater than 8 bytes. |
@rsdy |
I'd like to see what kind of false positives this might trigger. I think if we are certain that this locks in correct behaviour, I'd be inclined to make it a hard error with a good error message than propagating failure to the verifier. |
@rsdy So I am going to add a feature of raising compilation error if the value has This is the basis why the item whose alignment exceeds 8 bytes are banned.
|
@rhdxmr that sounds promising, and quite clear cut. |
Hello @rsdy
Can you review this PR?
1
Add hash table maps for both BPF programs and userspace programs.
All structures provide similar methods.
For BPF programs,
get
,get_mut
,set
,delete
, andget_val
are implemented.For userspace programs
new
,set
,get
,delete
anditer
methods are implemented.2
Check
Map
is valid BPF map type (BPF_MAP_TYPE_HASH
orBPF_MAP_TYPE_PERF_EVENT_ARRAY
) whenHashMap::new
function is called.3
Add derive
Clone
,Debug
attribute toPerCpuValues
.4
Add
hashmaps
example program.