You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently ebpf_extension_header_t struct is defined as below:
typedef struct _ebpf_extension_header
{
uint16_t version; ///< Version of the extension data structure.
size_t size; ///< Size of the extension data structure.
} ebpf_extension_header_t;
This works fine, as long as the runtime gets a pointer to single object, and the version and size fields are sufficient to safely read and copy the fields from the original struct. But if the extension (or any other versioned interface which is also using this header for versioning) passes an array of structs, then the runtime also needs to figure out the total size of a struct. Due to padding, the struct will not be same as size above. So for each case, the runtime has to calculate the total size of the struct, and padding added for each struct will be different.
One way to simplify this is to add another field total_size in the above struct, which will be simply sizeof(<struct>).
The text was updated successfully, but these errors were encountered:
Currently
ebpf_extension_header_t
struct is defined as below:This works fine, as long as the runtime gets a pointer to single object, and the
version
andsize
fields are sufficient to safely read and copy the fields from the original struct. But if the extension (or any other versioned interface which is also using this header for versioning) passes an array of structs, then the runtime also needs to figure out the total size of a struct. Due to padding, the struct will not be same assize
above. So for each case, the runtime has to calculate the total size of the struct, and padding added for each struct will be different.One way to simplify this is to add another field
total_size
in the above struct, which will be simplysizeof(<struct>)
.The text was updated successfully, but these errors were encountered: