Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ebpf): optimize sendmsg/recvmsg kprobes #3766

Merged

Commits on Dec 17, 2023

  1. feat(ebpf): optimize sendmsg/recvmsg kprobes

    Move the socket validation section in these eBPF programs from the map
    updating functions to the initial stage of the eBPF program.
    This is better because it is much quicker to validate the socket, than
    initally checking `should_trace` and doing `init_program_data`.
    It is also consistent with another networking kprobe of the packet logic
    `trace_sock_alloc_file`.
    
    Old version benchmark:
    PROGRAM: security_socket_recvmsg (runtime: 569255060 ns, amount: 90974 times, average: 6257 ns)
    PROGRAM: security_socket_sendmsg (runtime: 603516073 ns, amount: 109182 times, average: 5527 ns)
    
    New version benchmark:
    PROGRAM: security_socket_recvmsg (runtime: 613052965 ns, amount: 134066 times, average: 4572 ns)
    PROGRAM: security_socket_sendmsg (runtime: 652289846 ns, amount: 161178 times, average: 4047 ns)
    NDStrahilevitz committed Dec 17, 2023
    Configuration menu
    Copy the full SHA
    9f90b1d View commit details
    Browse the repository at this point in the history