From 75157f082b9cd1960f08ec28eb4f9e19a235abfa Mon Sep 17 00:00:00 2001 From: Nikola Grcevski Date: Thu, 26 Feb 2026 12:12:06 -0500 Subject: [PATCH] fix java TLS bugs --- bpf/generictracer/http2_grpc.h | 12 +----------- bpf/generictracer/java_tls.c | 2 ++ bpf/generictracer/k_tracer.c | 3 +++ 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/bpf/generictracer/http2_grpc.h b/bpf/generictracer/http2_grpc.h index 7539cd6bb1..3b5b5d328a 100644 --- a/bpf/generictracer/http2_grpc.h +++ b/bpf/generictracer/http2_grpc.h @@ -55,16 +55,6 @@ static __always_inline u8 read_http2_grpc_frame_header(frame_header_t *frame, return 1; } -static __always_inline u8 is_settings_frame(unsigned char *p, u32 len) { - frame_header_t frame = {0}; - - if (!read_http2_grpc_frame_header(&frame, p, len)) { - return 0; - } - - return frame.type == FrameSettings && !frame.stream_id; -} - static __always_inline u8 is_headers_frame(const frame_header_t *frame) { return frame->type == FrameHeaders && frame->stream_id; } @@ -78,7 +68,7 @@ static __always_inline u8 has_preface(unsigned char *p, u32 len) { } static __always_inline u8 is_http2_or_grpc(unsigned char *p, u32 len) { - return has_preface(p, len) || is_settings_frame(p, len); + return has_preface(p, len); } static __always_inline u8 http_grpc_stream_ended(const frame_header_t *frame) { diff --git a/bpf/generictracer/java_tls.c b/bpf/generictracer/java_tls.c index 9b734b4ebd..69f0294cf0 100644 --- a/bpf/generictracer/java_tls.c +++ b/bpf/generictracer/java_tls.c @@ -140,6 +140,8 @@ int BPF_KPROBE(obi_kprobe_sys_ioctl) { if (len > 0) { void *buf = arg + 1 + sizeof(connection_info_t) + sizeof(u32); + const u64 zero = 0; + bpf_map_update_elem(&active_ssl_connections, &p_conn, &zero, BPF_ANY); handle_buf_with_connection(ctx, &p_conn, buf, len, WITH_SSL, op, orig_dport); } diff --git a/bpf/generictracer/k_tracer.c b/bpf/generictracer/k_tracer.c index 298718bb92..1744e9e753 100644 --- a/bpf/generictracer/k_tracer.c +++ b/bpf/generictracer/k_tracer.c @@ -344,6 +344,9 @@ int BPF_KRETPROBE(obi_kretprobe_sys_connect, int res) { static __always_inline void tcp_send_ssl_check(u64 id, void *ssl, pid_connection_info_t *p_conn, u16 orig_dport) { bpf_dbg_printk("id=%d, ssl=%llx", id, ssl); + if (!ssl) { + return; + } ssl_pid_connection_info_t *s_conn = bpf_map_lookup_elem(&ssl_to_conn, &ssl); if (s_conn) { finish_possible_delayed_tls_http_request(&s_conn->p_conn, ssl);