From 85d53688fb4031726dfb361cf40628f2e99f8b59 Mon Sep 17 00:00:00 2001 From: cfc4n Date: Fri, 6 Oct 2023 23:02:45 +0800 Subject: [PATCH] fix: veristat verify failed. sudo ../veristat/src/veristat -d user/bytecode/openssl_3_0_0_kern.o Signed-off-by: cfc4n --- kern/openssl.h | 25 +++++++++++++++++-------- kern/openssl_masterkey.h | 3 +++ kern/openssl_masterkey_3.0.h | 3 +++ kern/tc.h | 2 ++ 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/kern/openssl.h b/kern/openssl.h index cad4f12ce..590291873 100644 --- a/kern/openssl.h +++ b/kern/openssl.h @@ -35,10 +35,6 @@ struct ssl_data_event_t { s32 version; }; -struct { - __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); -} tls_events SEC(".maps"); - struct connect_event_t { u64 timestamp_ns; u32 pid; @@ -48,10 +44,6 @@ struct connect_event_t { char comm[TASK_COMM_LEN]; }; -struct { - __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); -} connect_events SEC(".maps"); - struct active_ssl_buf { /* * protocol version (one of SSL2_VERSION, SSL3_VERSION, TLS1_VERSION, @@ -67,6 +59,23 @@ struct active_ssl_buf { * BPF MAPS ***********************************************************/ + +struct { + __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); + __uint(key_size, sizeof(u32)); + __uint(value_size, sizeof(u32)); + __uint(max_entries, 1024); +} tls_events SEC(".maps"); + + +struct { + __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); + __uint(key_size, sizeof(u32)); + __uint(value_size, sizeof(u32)); + __uint(max_entries, 1024); +} connect_events SEC(".maps"); + + // Key is thread ID (from bpf_get_current_pid_tgid). // Value is a pointer to the data buffer argument to SSL_write/SSL_read. struct { diff --git a/kern/openssl_masterkey.h b/kern/openssl_masterkey.h index 97fc626f8..db0ba3de6 100644 --- a/kern/openssl_masterkey.h +++ b/kern/openssl_masterkey.h @@ -57,6 +57,9 @@ struct ssl3_state_st { // bpf map struct { __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); + __uint(key_size, sizeof(u32)); + __uint(value_size, sizeof(u32)); + __uint(max_entries, 1024); } mastersecret_events SEC(".maps"); struct { diff --git a/kern/openssl_masterkey_3.0.h b/kern/openssl_masterkey_3.0.h index 1c9f5daa0..dcdee6b0b 100644 --- a/kern/openssl_masterkey_3.0.h +++ b/kern/openssl_masterkey_3.0.h @@ -46,6 +46,9 @@ struct mastersecret_t { // bpf map struct { __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); + __uint(key_size, sizeof(u32)); + __uint(value_size, sizeof(u32)); + __uint(max_entries, 1024); } mastersecret_events SEC(".maps"); struct { diff --git a/kern/tc.h b/kern/tc.h index d62275e6c..184f9da8b 100644 --- a/kern/tc.h +++ b/kern/tc.h @@ -50,6 +50,8 @@ struct net_ctx_t { ////////////////////// ebpf maps ////////////////////// struct { __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY); + __uint(key_size, sizeof(u32)); + __uint(value_size, sizeof(u32)); __uint(max_entries, 10240); } skb_events SEC(".maps");