@@ -191,7 +191,7 @@ copy_iov_iter(void *ctx, long off, unsigned long arg, int argm, struct msg_gener
191191#endif /* __LARGE_BPF_PROG */
192192
193193FUNC_INLINE long
194- __read_arg (void * ctx , int type , long orig_off , unsigned long arg , int argm , char * args )
194+ __read_arg_1 (void * ctx , int type , long orig_off , unsigned long arg , int argm , char * args )
195195{
196196 struct msg_generic_kprobe * e ;
197197 long size = -1 ;
@@ -296,6 +296,25 @@ __read_arg(void *ctx, int type, long orig_off, unsigned long arg, int argm, char
296296 case sockaddr_type :
297297 size = copy_sockaddr (args , arg );
298298 break ;
299+ default :
300+ size = 0 ;
301+ break ;
302+ }
303+ return size ;
304+ }
305+
306+ FUNC_INLINE long
307+ __read_arg_2 (void * ctx , int type , long orig_off , unsigned long arg , int argm , char * args )
308+ {
309+ struct msg_generic_kprobe * e ;
310+ long size = -1 ;
311+ int zero = 0 ;
312+
313+ e = map_lookup_elem (& process_call_heap , & zero );
314+ if (!e )
315+ return 0 ;
316+
317+ switch (type ) {
299318 case socket_type :
300319 size = copy_socket (args , arg );
301320 // Look up socket in our sock->pid_tgid map
@@ -383,6 +402,7 @@ read_arg(void *ctx, int index, int type, long orig_off, unsigned long arg, int a
383402 char * args ;
384403 const struct path * path_arg = 0 ;
385404 struct path path_buf ;
405+ long size = -1 ;
386406 int zero = 0 ;
387407
388408 e = map_lookup_elem (& process_call_heap , & zero );
@@ -402,7 +422,10 @@ read_arg(void *ctx, int index, int type, long orig_off, unsigned long arg, int a
402422 if (path_arg )
403423 return copy_path (args , path_arg );
404424
405- return __read_arg (ctx , type , orig_off , arg , argm , args );
425+ size = __read_arg_1 (ctx , type , orig_off , arg , argm , args );
426+ if (!size )
427+ size = __read_arg_2 (ctx , type , orig_off , arg , argm , args );
428+ return size ;
406429}
407430
408431FUNC_INLINE int
0 commit comments