Commit ad9c218
committed
_ebpf_object_load_native: wait until service is deleted on error
ebpf-go loads native images via ebpf_object_load_native_by_fds.
Contrary to ebpf_object_load_native this function requires the
caller to provide memory for map and program fds. If the caller
doesn't provide enough space, EBPF_NO_MEMORY is returned along
with a sizing hint. The caller is expected to retry with a larger
buffer.
This behaviour currently breaks for two reasons: first, the error
recovery path of _ebpf_object_load_native stops and deletes the
service, but does not wait for deletion to complete. This is a
problem because each native image can currently only be loaded
once. This causes an error when ebpf-go retries the load with
larger buffers. Second, the check which issues the EBPF_NO_MEMORY
result happens at a point where we can't reliably delete the
service since we don't know its name.
Fix this by waiting for a service to be deleted on the error
path and by pushing the EBPF_NO_MEMORY condition down into
_ebpf_object_load_native. The latter requires some creative
semantics for count_of_maps and count_of_programs: they now
specify the maximum number the caller is willing to accept.1 parent 49f7e99 commit ad9c218
File tree
4 files changed
+69
-61
lines changed- libs
- api
- thunk
- mock
- windows
4 files changed
+69
-61
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
3755 | 3756 | | |
3756 | 3757 | | |
3757 | 3758 | | |
3758 | | - | |
| 3759 | + | |
3759 | 3760 | | |
3760 | | - | |
| 3761 | + | |
3761 | 3762 | | |
3762 | 3763 | | |
3763 | 3764 | | |
| |||
3779 | 3780 | | |
3780 | 3781 | | |
3781 | 3782 | | |
| 3783 | + | |
| 3784 | + | |
3782 | 3785 | | |
3783 | 3786 | | |
3784 | | - | |
3785 | 3787 | | |
3786 | | - | |
3787 | 3788 | | |
3788 | 3789 | | |
3789 | 3790 | | |
| |||
3852 | 3853 | | |
3853 | 3854 | | |
3854 | 3855 | | |
3855 | | - | |
| 3856 | + | |
3856 | 3857 | | |
3857 | 3858 | | |
3858 | 3859 | | |
| |||
3862 | 3863 | | |
3863 | 3864 | | |
3864 | 3865 | | |
| 3866 | + | |
| 3867 | + | |
| 3868 | + | |
| 3869 | + | |
| 3870 | + | |
| 3871 | + | |
| 3872 | + | |
| 3873 | + | |
| 3874 | + | |
| 3875 | + | |
| 3876 | + | |
3865 | 3877 | | |
3866 | | - | |
| 3878 | + | |
3867 | 3879 | | |
3868 | 3880 | | |
3869 | 3881 | | |
| |||
3882 | 3894 | | |
3883 | 3895 | | |
3884 | 3896 | | |
3885 | | - | |
3886 | | - | |
| 3897 | + | |
| 3898 | + | |
3887 | 3899 | | |
3888 | 3900 | | |
3889 | 3901 | | |
3890 | 3902 | | |
3891 | 3903 | | |
3892 | | - | |
| 3904 | + | |
| 3905 | + | |
3893 | 3906 | | |
3894 | 3907 | | |
3895 | 3908 | | |
| |||
3926 | 3939 | | |
3927 | 3940 | | |
3928 | 3941 | | |
3929 | | - | |
3930 | | - | |
3931 | 3942 | | |
3932 | 3943 | | |
3933 | | - | |
| 3944 | + | |
3934 | 3945 | | |
3935 | 3946 | | |
3936 | 3947 | | |
3937 | 3948 | | |
3938 | 3949 | | |
3939 | 3950 | | |
3940 | | - | |
3941 | | - | |
3942 | | - | |
3943 | | - | |
3944 | | - | |
3945 | | - | |
3946 | | - | |
3947 | | - | |
3948 | | - | |
3949 | | - | |
3950 | | - | |
3951 | | - | |
| 3951 | + | |
| 3952 | + | |
3952 | 3953 | | |
3953 | 3954 | | |
3954 | 3955 | | |
| |||
3957 | 3958 | | |
3958 | 3959 | | |
3959 | 3960 | | |
3960 | | - | |
| 3961 | + | |
| 3962 | + | |
3961 | 3963 | | |
3962 | 3964 | | |
3963 | 3965 | | |
| |||
3968 | 3970 | | |
3969 | 3971 | | |
3970 | 3972 | | |
3971 | | - | |
| 3973 | + | |
3972 | 3974 | | |
3973 | 3975 | | |
3974 | 3976 | | |
| |||
3977 | 3979 | | |
3978 | 3980 | | |
3979 | 3981 | | |
3980 | | - | |
| 3982 | + | |
3981 | 3983 | | |
3982 | 3984 | | |
3983 | 3985 | | |
| |||
3986 | 3988 | | |
3987 | 3989 | | |
3988 | 3990 | | |
3989 | | - | |
3990 | | - | |
| 3991 | + | |
| 3992 | + | |
3991 | 3993 | | |
3992 | 3994 | | |
3993 | 3995 | | |
| |||
4006 | 4008 | | |
4007 | 4009 | | |
4008 | 4010 | | |
4009 | | - | |
4010 | | - | |
| 4011 | + | |
| 4012 | + | |
4011 | 4013 | | |
4012 | 4014 | | |
4013 | 4015 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
189 | | - | |
| 188 | + | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
186 | | - | |
| 185 | + | |
| 186 | + | |
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
195 | 195 | | |
196 | | - | |
197 | | - | |
198 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
199 | 201 | | |
200 | 202 | | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
208 | 211 | | |
209 | 212 | | |
210 | | - | |
211 | | - | |
| 213 | + | |
| 214 | + | |
212 | 215 | | |
213 | 216 | | |
214 | 217 | | |
| |||
285 | 288 | | |
286 | 289 | | |
287 | 290 | | |
288 | | - | |
| 291 | + | |
289 | 292 | | |
290 | 293 | | |
291 | | - | |
292 | | - | |
293 | | - | |
| 294 | + | |
294 | 295 | | |
295 | 296 | | |
296 | 297 | | |
297 | 298 | | |
298 | 299 | | |
299 | 300 | | |
300 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
301 | 307 | | |
302 | 308 | | |
303 | | - | |
304 | | - | |
305 | | - | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
306 | 312 | | |
307 | 313 | | |
308 | | - | |
| 314 | + | |
309 | 315 | | |
310 | 316 | | |
311 | 317 | | |
0 commit comments