Set all buffer sizes to CHUNK_SIZE

This commit is contained in:
M. Mert Yildiran 2022-06-02 05:19:36 +03:00
parent 3e7d08bf2c
commit 3f4e03d381
No known key found for this signature in database
GPG Key ID: D42ADB236521BF7A
5 changed files with 5 additions and 8 deletions

View File

@ -9,9 +9,6 @@ Copyright (C) UP9 Inc.
#include "include/headers.h"
#include "include/maps.h"
#define BUFFER_SIZE_READ_WRITE (1 << 19) // 512 KiB
#define CRYPTO_TLS_READ_LEN (1 << 12) // constant 4KiB is observed
struct golang_read_write {
__u32 pid;
@ -20,7 +17,7 @@ struct golang_read_write {
bool is_request;
__u32 len;
__u32 cap;
__u8 data[BUFFER_SIZE_READ_WRITE];
__u8 data[CHUNK_SIZE];
};
const struct golang_read_write *unused __attribute__((unused));
@ -60,7 +57,7 @@ static __always_inline int golang_crypto_tls_write_uprobe(struct pt_regs *ctx) {
b->len = ctx->rcx;
b->cap = ctx->rdi;
status = bpf_probe_read(&b->data, CRYPTO_TLS_READ_LEN, (void*)ctx->rbx);
status = bpf_probe_read(&b->data, CHUNK_SIZE, (void*)ctx->rbx);
if (status < 0) {
bpf_printk("[golang_crypto_tls_write_uprobe] error reading data: %d", status);
bpf_ringbuf_discard(b, BPF_RB_FORCE_WAKEUP);
@ -98,7 +95,7 @@ static __always_inline int golang_crypto_tls_read_uprobe(struct pt_regs *ctx) {
return 0;
}
status = bpf_probe_read(&b->data, CRYPTO_TLS_READ_LEN, (void*)(data_p));
status = bpf_probe_read(&b->data, CHUNK_SIZE, (void*)(data_p));
if (status < 0) {
bpf_printk("[golang_crypto_tls_read_uprobe] error reading data: %d", status);
bpf_ringbuf_discard(b, BPF_RB_FORCE_WAKEUP);

View File

@ -21,7 +21,7 @@ type tlsTapperGolangReadWrite struct {
_ [3]byte
Len uint32
Cap uint32
Data [524288]uint8
Data [4096]uint8
}
type tlsTapperTlsChunk struct {

Binary file not shown.

View File

@ -21,7 +21,7 @@ type tlsTapperGolangReadWrite struct {
_ [3]byte
Len uint32
Cap uint32
Data [524288]uint8
Data [4096]uint8
}
type tlsTapperTlsChunk struct {

Binary file not shown.