Commit 52bdd47
bpf: Craft non-linear skbs in BPF_PROG_TEST_RUN
This patch adds support for crafting non-linear skbs in BPF test runs
for tc programs. The size of the linear area is given by ctx->data_end,
with a minimum of ETH_HLEN always pulled in the linear area. If ctx or
ctx->data_end are null, a linear skb is used.
This is particularly useful to test support for non-linear skbs in large
codebases such as Cilium. We've had multiple bugs in the past few years
where we were missing calls to bpf_skb_pull_data(). This support in
BPF_PROG_TEST_RUN would allow us to automatically cover this case in our
BPF tests.
In addition to the selftests introduced later in the series, this patch
was tested by setting enabling non-linear skbs for all tc selftests
programs and checking test failures were expected.
Tested-by: [email protected]
Suggested-by: Daniel Borkmann <[email protected]>
Signed-off-by: Paul Chaignon <[email protected]>1 parent 1609bfe commit 52bdd47
1 file changed
+61
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
910 | 910 | | |
911 | 911 | | |
912 | 912 | | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
913 | 919 | | |
914 | 920 | | |
915 | 921 | | |
| |||
984 | 990 | | |
985 | 991 | | |
986 | 992 | | |
| 993 | + | |
987 | 994 | | |
988 | 995 | | |
989 | 996 | | |
| 997 | + | |
| 998 | + | |
990 | 999 | | |
991 | 1000 | | |
992 | 1001 | | |
| |||
1023 | 1032 | | |
1024 | 1033 | | |
1025 | 1034 | | |
1026 | | - | |
1027 | | - | |
1028 | | - | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
1029 | 1045 | | |
1030 | 1046 | | |
1031 | 1047 | | |
| |||
1044 | 1060 | | |
1045 | 1061 | | |
1046 | 1062 | | |
| 1063 | + | |
1047 | 1064 | | |
1048 | 1065 | | |
1049 | 1066 | | |
1050 | | - | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
1051 | 1104 | | |
1052 | 1105 | | |
1053 | 1106 | | |
| |||
1130 | 1183 | | |
1131 | 1184 | | |
1132 | 1185 | | |
1133 | | - | |
1134 | | - | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
1135 | 1189 | | |
| 1190 | + | |
1136 | 1191 | | |
1137 | 1192 | | |
1138 | 1193 | | |
| |||
0 commit comments