fshahinfar1 / kashk

Generate BPF kernel offload from source code of applications
1 stars 0 forks source link

Issue with address operator on arrays when it is moved to the BPF map #23

Open fshahinfar1 opened 4 months ago

fshahinfar1 commented 4 months ago

The tool may move an array to an BPF MAP. In this case, the array is changed into a pointer to the MAP address. If the user had used the address-of operator (&) somewhere on the array, the code will be incorrect. It is because the semantic of & operator on an array or on a pointer is a bit different.

Example:

char x[200];
memset(&x, 0, 200);

will be converted to (which is wrong)

char *x = ...
memset(&x, 0, 200);