Browse Source

Fixed #TSB-1234 test

ilucky.si 1 năm trước cách đây
mục cha
commit
530b91cd26
1 tập tin đã thay đổi với 11 bổ sung10 xóa
  1. 11 10
      ebpftracer/ebpf/l7/l7.c

+ 11 - 10
ebpftracer/ebpf/l7/l7.c

@@ -303,17 +303,18 @@ void perf_event_batch_output(void *ctx,  struct l7_event *e) {
     __u32 e_length = offsetof(typeof(struct l7_event), payload) + (e->payload_size);
     bpf_printk("IK...perf_event_batch_output...e->payload_size=%d, e_length=%d", e->payload_size, e_length);
     unsigned char *src = (unsigned char *)e;
-    unsigned char *dst = e_buff->data + e_buff->len;
-//    for (int i = 0; i < e_length; i++) {   //IK:ERROR: IK: BPF stack limit of 512 bytes is exceeded. Please move large on stack variables into BPF per-cpu array map.
-//        *dst++ = *src++;
-//    }
-    int remaining_space = sizeof(e_buff->data) - e_buff->len;
-    bpf_printk("IK...perf_event_batch_output...remaining_space=%d", remaining_space);
-    if (remaining_space >= e_length) {
-         *(unsigned int *)dst = *(unsigned int *)src;
-         dst += e_length;
-         src += e_length;
+    // unsigned char *dst = e_buff->data + e_buff->len;
+    for (int i = 0; i < e_length; i++) {   //IK:ERROR: IK: BPF stack limit of 512 bytes is exceeded. Please move large on stack variables into BPF per-cpu array map.
+        // *dst++ = *src++;
+        e_buff->data[i] = src[i]
     }
+//    int remaining_space = sizeof(e_buff->data) - e_buff->len;
+//    bpf_printk("IK...perf_event_batch_output...remaining_space=%d", remaining_space);
+//    if (remaining_space >= e_length) {
+//         *(unsigned int *)dst = *(unsigned int *)src;
+//         dst += e_length;
+//         src += e_length;
+//    }
 
 	// IK: 更新e_buff.
 	// __u32 e_length = sizeof(*e);