@@ -391,14 +391,22 @@ extract_arg_depth(u32 i, struct extract_arg_data *data)
391391{
392392 if (i >= MAX_BTF_ARG_DEPTH || !data -> btf_config [i ].is_initialized )
393393 return 1 ;
394+
394395 * data -> arg = * data -> arg + data -> btf_config [i ].offset ;
395- if (data -> btf_config [i ].is_pointer )
396- probe_read ((void * )data -> arg , sizeof (char * ), (void * )* data -> arg );
396+
397+ if (data -> btf_config [i ].is_pointer ) {
398+ if (probe_read ((void * )data -> arg , sizeof (char * ), (void * )* data -> arg ) < 0 ) {
399+ * data -> resolve_err_depth = i ;
400+ return 1 ;
401+ }
402+ }
403+
397404 return 0 ;
398405}
399406
400407#ifdef __LARGE_BPF_PROG
401- FUNC_INLINE void extract_arg (struct event_config * config , int index , unsigned long * a )
408+ FUNC_INLINE void extract_arg (struct event_config * config , int index , unsigned long * a ,
409+ __s8 * resolve_err_depth )
402410{
403411 struct config_btf_arg * btf_config ;
404412
@@ -413,6 +421,7 @@ FUNC_INLINE void extract_arg(struct event_config *config, int index, unsigned lo
413421 struct extract_arg_data extract_data = {
414422 .btf_config = btf_config ,
415423 .arg = a ,
424+ .resolve_err_depth = resolve_err_depth ,
416425 };
417426#ifndef __V61_BPF_PROG
418427#pragma unroll
@@ -426,7 +435,10 @@ FUNC_INLINE void extract_arg(struct event_config *config, int index, unsigned lo
426435 }
427436}
428437#else
429- FUNC_INLINE void extract_arg (struct event_config * config , int index , unsigned long * a ) {}
438+ FUNC_INLINE void extract_arg (struct event_config * config , int index , unsigned long * a ,
439+ __s8 * resolve_err_depth )
440+ {
441+ }
430442#endif /* __LARGE_BPF_PROG */
431443
432444FUNC_INLINE int arg_idx (int index )
@@ -471,9 +483,11 @@ FUNC_INLINE long generic_read_arg(void *ctx, int index, long off, struct bpf_map
471483 ty = config -> arg [index ];
472484 am = config -> arm [index ];
473485
486+ e -> resolve_err_depth [index ] = -1 ;
487+
474488#if defined(GENERIC_TRACEPOINT ) || defined(GENERIC_USDT )
475489 a = (& e -> a0 )[index ];
476- extract_arg (config , index , & a );
490+ extract_arg (config , index , & a , & e -> resolve_err_depth [ index ] );
477491#else
478492 arg_index = config -> idx [index ];
479493 asm volatile ("%[arg_index] &= %1 ;\n"
@@ -491,7 +505,7 @@ FUNC_INLINE long generic_read_arg(void *ctx, int index, long off, struct bpf_map
491505 else
492506 a = (& e -> a0 )[arg_index ];
493507
494- extract_arg (config , index , & a );
508+ extract_arg (config , index , & a , & e -> resolve_err_depth [ index ] );
495509
496510 if (should_offload_path (ty ))
497511 return generic_path_offload (ctx , ty , a , index , off , tailcals );
0 commit comments