@@ -358,15 +358,30 @@ int BPF_PROG(tcp_v4_connect_fexit, struct sock *sk, struct sockaddr *uaddr, int
358358}
359359
360360SEC ("kprobe/inet_csk_accept" )
361- int BPF_KPROBE (inet_csk_accept , struct sock * sk , int flags , int * err , bool kern )
361+ int BPF_KPROBE (inet_csk_accept )
362362{
363363 /*
364364 This function will save the reference value to error.
365365 in kretprobe we look at the value we got back in that reference
366366 */
367367 __u64 pid_tgid = bpf_get_current_pid_tgid ();
368368 __u32 pid = pid_tgid >> 32 ;
369- __u64 err_ptr = (__u64 )err ;
369+
370+ __u64 err_ptr = 0 ;
371+
372+ // Linux v6.10-rc1+
373+ // https://github.com/torvalds/linux/commit/92ef0fd55ac80dfc2e4654edfe5d1ddfa6e070fe
374+ if (bpf_core_type_exists (struct proto_accept_arg )) {
375+ struct proto_accept_arg * arg = (struct proto_accept_arg * )PT_REGS_PARM2 (ctx );
376+
377+ int * err_ptr_raw = 0 ;
378+ bpf_core_read (& err_ptr_raw , sizeof (err_ptr_raw ), & arg -> err );
379+ err_ptr = (__u64 )err_ptr_raw ;
380+ } else {
381+ int * err = (int * )PT_REGS_PARM3 (ctx );
382+ err_ptr = (__u64 )err ;
383+ }
384+
370385 bpf_map_update_elem (& retina_dropreason_accept_pids , & pid , & err_ptr , BPF_ANY );
371386 return 0 ;
372387}
@@ -549,4 +564,4 @@ int BPF_PROG(nf_conntrack_confirm_fexit, struct sk_buff *skb, int retVal)
549564
550565 update_metrics_map_basic (CONNTRACK_ADD_DROP , retVal , skb_len );
551566 return 0 ;
552- }
567+ }
0 commit comments