-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[kfunc/kretfunc] fix arg and retval resolution
In the case of functions that have arguments that are larger than the size of the registers (e.g. '__sys_bpf' whose second arg, 'bpfptr_t uattr', which has a size of 16 bytes) the 'retval' for kretfunc/fexit is not correct. What's needed is to resolve the btf type size and use that (by dividing by the register size) to determine the index into the args array.
- Loading branch information
1 parent
1772c21
commit d179793
Showing
4 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <linux/bpf.h> | ||
#include <linux/unistd.h> | ||
#include <stdlib.h> | ||
#include <unistd.h> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
if (argc != 3) | ||
{ | ||
return 1; | ||
} | ||
usleep(1000000); | ||
|
||
union bpf_attr attr; | ||
int cmd = atoi(argv[1]); | ||
unsigned int size = atoi(argv[2]); | ||
syscall(__NR_bpf, cmd, &attr, size); | ||
|
||
return 0; | ||
} |