Skip to content

Commit

Permalink
feat: agent - eBPF Support for the ARM version of Kylin v10 SP2
Browse files Browse the repository at this point in the history
  • Loading branch information
yinjiping authored and sharang committed Nov 2, 2024
1 parent 1928801 commit 2efa913
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
16 changes: 13 additions & 3 deletions agent/src/ebpf/kernel/include/protocol_inference.h
Original file line number Diff line number Diff line change
Expand Up @@ -1509,16 +1509,26 @@ static __inline bool mqtt_decoding_length(const __u8 * buffer, int *length,
buffer += 1;
*length = 0;
*lensize = 0;
do {

/*
* Limit the number of loop iterations, ensuring the byte usage remains
* within 32 bytes. This also resolves the issue of loading eBPF bytecode
* on the 4.19.90-25.24.v2101.ky10.aarch64 kernel.
*/
static const int loop_count = 32;
for (int i = 0; i < loop_count; i++) {
digit = buffer[(*lensize)++];
*length += (digit & 127) * multiplier;
multiplier *= 128;

// mqtt 最多用4个字节表示长度
if ((*lensize) > 4)
return false;
} while ((digit & 128) != 0);
return true;
if((digit & 128) == 0)
return true;
}

return false;
}

static __inline bool mqtt_decoding_message_type(const __u8 * buffer,
Expand Down
3 changes: 2 additions & 1 deletion agent/src/ebpf/kernel/include/task_struct_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,13 @@ static __inline void *infer_and_get_socket_from_fd(int fd_num, struct member_fie
// 0x6b8 for 4.19.117.business.1-amd64
// 0xb88 for 4.19.0-91.77.112.uelc20.x86_64, 4.19.0-91.82.65.uelc20.x86_64
// 0xcd8 for 4.14.105-1-tlinux3-0023.1
// 0x7c8 for 4.19.90-25.24.v2101.ky10.aarch64
int files_offset_array[] = {
0x6c0, 0x790, 0x7b0, 0xa80, 0xa88, 0xaa0, 0xaa8, 0xab0, 0xab8, 0xac0,
0xac8, 0xad0, 0xad8, 0xae0, 0xae8, 0xaf0, 0xaf8, 0xb00, 0xb08, 0xb10,
0xb18, 0xb20, 0xb48, 0xb50, 0xb58, 0xb60, 0xb68, 0xb70, 0xb78, 0xb90,
0xb98, 0xba0, 0xbb0, 0x740, 0xbc0, 0xbc8, 0xbd0, 0xbd8, 0xbe0, 0xbe8,
0xbf0, 0xbf8, 0xc00, 0xc08, 0xcc8, 0xd08, 0x6b8, 0xb88, 0xcd8
0xbf0, 0xbf8, 0xc00, 0xc08, 0xcc8, 0xd08, 0x6b8, 0xb88, 0xcd8, 0x7c8
};
#endif
/* *INDENT-ON* */
Expand Down

0 comments on commit 2efa913

Please sign in to comment.