{"payload":{"feedbackUrl":"https://github.com/orgs/community/discussions/53140","repo":{"id":633030900,"defaultBranch":"main","name":"libbpf-bootstrap","ownerLogin":"acmel","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2023-04-26T16:21:12.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/1051254?v=4","public":true,"private":false,"isOrgOwned":false},"refInfo":{"name":"","listCacheKey":"v0:1682542051.0","currentOid":""},"activityList":{"items":[{"before":"ff9ada9ad16ee8f1aa8f980bfe2363d4e4271e7a","after":"e41ae79312f9921c4f8ce1de06319c024481ddbc","ref":"refs/heads/prometheusnoop","pushedAt":"2023-05-22T20:47:21.759Z","pushType":"push","commitsCount":2,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"Revert \"prometheusnoop: Add support for BPF timers to defer reading internal state\"\n\nThis reverts commit a23f28d12687ea376b5d609554a17d19f646bc78.\n\nJust so that the generated bytecode doesn't get bigger with a\nnon-feature, as BPF timers are not supported in tracing programs.\n\nThis will remain in the repository history, so we can refer to it later\nor try again when/if this gets supported.\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"Revert \"prometheusnoop: Add support for BPF timers to defer reading i…"}},{"before":"9603a936b97944a1c821a05fb3d93bc2035786c8","after":"ff9ada9ad16ee8f1aa8f980bfe2363d4e4271e7a","ref":"refs/heads/prometheusnoop","pushedAt":"2023-05-19T18:16:32.164Z","pushType":"push","commitsCount":2,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnoop.bpf: Zero out the description on the stack when using the perf ring buffer\n\nOtherwise the verifier will complain when the description lenghts are\nless than what is available for the event description:\n\n # ./prometheusnoop -db tests/prometheus/main\n libbpf: prog 'counter': BPF program load failed: Permission denied\n libbpf: prog 'counter': -- BEGIN PROG LOAD LOG --\n 0: R1=ctx(off=0,imm=0) R10=fp0\n ; prometheus_metric_uprobe(counter, valInt, false);\n 0: (bf) r5 = r1 ; R1=ctx(off=0,imm=0) R5_w=ctx(off=0,imm=0)\n ; prometheus_metric_uprobe(counter, valInt, false);\n 1: (79) r4 = *(u64 *)(r5 +80) ; R4_w=scalar() R5_w=ctx(off=0,imm=0)\n 2: (b7) r1 = 8 ; R1_w=8\n 3: (b7) r2 = 32 ; R2_w=32\n 4: (b7) r3 = 0 ; R3_w=0\n 5: (85) call pc+2\n reg type unsupported for arg#3 function metric_event#20\n caller:\n R10=fp0\n callee:\n frame1: R1_w=8 R2_w=32 R3_w=0 R4_w=scalar() R5_w=ctx(off=0,imm=0) R10=fp0\n ; static int metric_event(int value_offset, int desc_offset, bool float_value, void *object, void *ctx)\n 8: (7b) *(u64 *)(r10 -120) = r5 ; frame1: R5_w=ctx(off=0,imm=0) R10=fp0 fp-120_w=ctx\n 9: (bf) r8 = r4 ; frame1: R4_w=scalar(id=1) R8_w=scalar(id=1)\n 10: (7b) *(u64 *)(r10 -136) = r3 ; frame1: R3_w=0 R10=fp0 fp-136_w=00000000\n 11: (bf) r9 = r2 ; frame1: R2_w=32 R9_w=32\n 12: (bf) r7 = r1 ; frame1: R1_w=8 R7_w=8\n ; pid_t pid = bpf_get_current_pid_tgid() >> 32;\n 13: (85) call bpf_get_current_pid_tgid#14 ; frame1: R0=scalar()\n ; const size_t event_size = offsetof(typeof(*e), description) + (include_description ? sizeof(e->description) : 0);\n 14: (18) r6 = 0xffff9d8280670000 ; frame1: R6_w=map_value(off=0,ks=4,vs=1,imm=0)\n 16: (71) r1 = *(u8 *)(r6 +0) ; frame1: R1_w=1 R6_w=map_value(off=0,ks=4,vs=1,imm=0)\n ; pid_t pid = bpf_get_current_pid_tgid() >> 32;\n 17: (7b) *(u64 *)(r10 -128) = r1 ; frame1: R1_w=1 R10=fp0 fp-128_w=1\n 18: (77) r0 >>= 32 ; frame1: R0_w=scalar(umax=4294967295,var_off=(0x0; 0xffffffff))\n ; e->pid = pid;\n 19: (63) *(u32 *)(r10 -96) = r0 ; frame1: R0_w=scalar(umax=4294967295,var_off=(0x0; 0xffffffff)) R10=fp0 fp-96=\n ; e->object = object;\n 20: (7b) *(u64 *)(r10 -112) = r8 ; frame1: R8=scalar(id=1) R10=fp0 fp-112_w=mmmmmmmm\n ; if (bpf_probe_read_user(&e->value, sizeof(e->value), object + value_offset) < 0)\n 21: (67) r7 <<= 32 ; frame1: R7_w=34359738368\n 22: (c7) r7 s>>= 32 ; frame1: R7_w=8\n 23: (bf) r3 = r8 ; frame1: R3_w=scalar(id=1) R8=scalar(id=1)\n 24: (0f) r3 += r7 ; frame1: R3_w=scalar() R7_w=8\n ; if (bpf_probe_read_user(&e->value, sizeof(e->value), object + value_offset) < 0)\n 25: (bf) r1 = r10 ; frame1: R1_w=fp0 R10=fp0\n 26: (07) r1 += -104 ; frame1: R1_w=fp-104\n ; if (bpf_probe_read_user(&e->value, sizeof(e->value), object + value_offset) < 0)\n 27: (b7) r2 = 8 ; frame1: R2_w=8\n 28: (85) call bpf_probe_read_user#112 ; frame1: R0_w=scalar() fp-104=mmmmmmmm\n 29: (b7) r1 = -11111111 ; frame1: R1_w=-11111111\n 30: (b7) r2 = 0 ; frame1: R2_w=0\n ; if (bpf_probe_read_user(&e->value, sizeof(e->value), object + value_offset) < 0)\n 31: (6d) if r2 s> r0 goto pc+98 ; frame1: R0_w=scalar(umax=9223372036854775807,var_off=(0x0; 0x7fffffffffffffff)) R2_w=0\n ; if (!include_description)\n 32: (71) r1 = *(u8 *)(r6 +0) ; frame1: R1=1 R6=map_value(off=0,ks=4,vs=1,imm=0)\n ; if (!include_description)\n 33: (15) if r1 == 0x0 goto pc+143 ; frame1: R1=1\n ; if (bpf_probe_read_user(&prometheus_counter_desc_ptr, sizeof(prometheus_counter_desc_ptr), object + desc_offset) < 0)\n 34: (67) r9 <<= 32 ; frame1: R9_w=137438953472\n 35: (c7) r9 s>>= 32 ; frame1: R9_w=32\n 36: (0f) r8 += r9 ; frame1: R8_w=scalar() R9_w=32\n 37: (bf) r1 = r10 ; frame1: R1_w=fp0 R10=fp0\n 38: (07) r1 += -8 ; frame1: R1_w=fp-8\n ; if (bpf_probe_read_user(&prometheus_counter_desc_ptr, sizeof(prometheus_counter_desc_ptr), object + desc_offset) < 0)\n 39: (b7) r2 = 8 ; frame1: R2_w=8\n 40: (bf) r3 = r8 ; frame1: R3_w=scalar(id=4) R8_w=scalar(id=4)\n 41: (85) call bpf_probe_read_user#112 ; frame1: R0=scalar() fp-8=mmmmmmmm\n ; if (bpf_probe_read_user(&prometheus_counter_desc_ptr, sizeof(prometheus_counter_desc_ptr), object + desc_offset) < 0)\n 42: (65) if r0 s> 0xffffffff goto pc+2 ; frame1: R0=scalar(umin=9223372036854775808,var_off=(0x8000000000000000; 0x7fffffffffffffff))\n 43: (b7) r1 = -55555555 ; frame1: R1_w=-55555555\n 44: (05) goto pc+85\n ; if (include_description)\n 130: (71) r2 = *(u8 *)(r6 +0) ; frame1: R2_w=1 R6=map_value(off=0,ks=4,vs=1,imm=0)\n ; if (include_description)\n 131: (15) if r2 == 0x0 goto pc+35 ; frame1: R2_w=1\n 132: (b7) r2 = 0 ; frame1: R2_w=0\n ; __builtin_memcpy(e->description, unknown_description, sizeof(unknown_description));\n 133: (73) *(u8 *)(r10 -72) = r2 ; frame1: R2_w=0 R10=fp0 fp-72=???????0\n 134: (b7) r2 = 116 ; frame1: R2_w=116\n 135: (73) *(u8 *)(r10 -76) = r2 ; frame1: R2_w=116 R10=fp0 fp-80=???m????\n 136: (b7) r2 = 112 ; frame1: R2_w=112\n 137: (73) *(u8 *)(r10 -77) = r2 ; frame1: R2_w=112 R10=fp0 fp-80=???mm???\n 138: (b7) r2 = 105 ; frame1: R2_w=105\n 139: (73) *(u8 *)(r10 -75) = r2 ; frame1: R2_w=105 R10=fp0 fp-80=??mmm???\n 140: (73) *(u8 *)(r10 -78) = r2 ; frame1: R2_w=105 R10=fp0 fp-80=??mmmm??\n 141: (b7) r2 = 114 ; frame1: R2_w=114\n 142: (73) *(u8 *)(r10 -79) = r2 ; frame1: R2_w=114 R10=fp0 fp-80=??mmmmm?\n 143: (b7) r2 = 99 ; frame1: R2_w=99\n 144: (73) *(u8 *)(r10 -80) = r2 ; frame1: R2_w=99 R10=fp0 fp-80=99\n 145: (b7) r2 = 115 ; frame1: R2_w=115\n 146: (73) *(u8 *)(r10 -81) = r2 ; frame1: R2_w=115 R10=fp0 fp-88=m???????\n 147: (b7) r2 = 101 ; frame1: R2_w=101\n 148: (73) *(u8 *)(r10 -82) = r2 ; frame1: R2_w=101 R10=fp0 fp-88=mm??????\n 149: (b7) r2 = 100 ; frame1: R2_w=100\n 150: (73) *(u8 *)(r10 -83) = r2 ; frame1: R2_w=100 R10=fp0 fp-88=mmm?????\n 151: (b7) r2 = 32 ; frame1: R2_w=32\n 152: (73) *(u8 *)(r10 -84) = r2 ; frame1: R2_w=32 R10=fp0 fp-88=mmmm????\n 153: (b7) r2 = 119 ; frame1: R2_w=119\n 154: (73) *(u8 *)(r10 -86) = r2 ; frame1: R2_w=119 R10=fp0 fp-88=mmmm?m??\n 155: (b7) r2 = 111 ; frame1: R2_w=111\n 156: (73) *(u8 *)(r10 -74) = r2 ; frame1: R2_w=111 R10=fp0 fp-80=?mmmmmmm\n 157: (73) *(u8 *)(r10 -87) = r2 ; frame1: R2_w=111 R10=fp0 fp-88=mmmm?mm?\n 158: (b7) r2 = 107 ; frame1: R2_w=107\n 159: (73) *(u8 *)(r10 -89) = r2 ; frame1: R2_w=107 R10=fp0 fp-96=m???mmmm\n 160: (b7) r2 = 110 ; frame1: R2_w=110\n 161: (73) *(u8 *)(r10 -73) = r2 ; frame1: R2_w=110 R10=fp0 fp-80=mmmmmmmm\n 162: (73) *(u8 *)(r10 -85) = r2 ; frame1: R2_w=110 R10=fp0 fp-88=mmmmmmm?\n 163: (73) *(u8 *)(r10 -88) = r2 ; frame1: R2_w=110 R10=fp0 fp-88=110\n 164: (73) *(u8 *)(r10 -90) = r2 ; frame1: R2_w=110 R10=fp0 fp-96=mm??mmmm\n 165: (b7) r2 = 117 ; frame1: R2_w=117\n 166: (73) *(u8 *)(r10 -91) = r2 ; frame1: R2=117 R10=fp0 fp-96=mmm?mmmm\n ; e->value = ret;\n 167: (7b) *(u64 *)(r10 -104) = r1 ; frame1: R1=-55555555 R10=fp0 fp-104_w=-55555555\n 168: (b7) r1 = 0 ; frame1: R1_w=0\n 169: (05) goto pc+8\n ;\n 178: (73) *(u8 *)(r10 -92) = r1 ; frame1: R1_w=0 R10=fp0 fp-96=mmm0mmmm\n ; const size_t event_size = offsetof(typeof(*e), description) + (include_description ? sizeof(e->description) : 0);\n 179: (79) r1 = *(u64 *)(r10 -128) ; frame1: R1_w=1 R10=fp0\n 180: (b7) r5 = 21 ; frame1: R5_w=21\n ; const size_t event_size = offsetof(typeof(*e), description) + (include_description ? sizeof(e->description) : 0);\n 181: (15) if r1 == 0x0 goto pc+1 ; frame1: R1_w=1\n 182: (b7) r5 = 85 ; frame1: R5=85\n 183: (bf) r4 = r10 ; frame1: R4_w=fp0 R10=fp0\n ;\n 184: (07) r4 += -112 ; frame1: R4_w=fp-112\n ; bpf_perf_event_output(ctx, &rb, BPF_F_CURRENT_CPU, e, event_size);\n 185: (79) r1 = *(u64 *)(r10 -120) ; frame1: R1_w=ctx(off=0,imm=0) R10=fp0\n 186: (18) r2 = 0xffff8e67ec101600 ; frame1: R2_w=map_ptr(off=0,ks=4,vs=4,imm=0)\n 188: (18) r3 = 0xffffffff ; frame1: R3_w=4294967295\n 190: (85) call bpf_perf_event_output#25\n invalid indirect read from stack R4 off -112+41 size 85\n processed 93 insns (limit 1000000) max_states_per_insn 0 total_states 5 peak_states 5 mark_read 5\n -- END PROG LOAD LOG --\n libbpf: prog 'counter': failed to load: -13\n libbpf: failed to load object 'prometheusnoop_bpf'\n libbpf: failed to load BPF skeleton 'prometheusnoop_bpf': -13\n Failed to load and verify BPF skeleton\n #\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnoop.bpf: Zero out the description on the stack when using …"}},{"before":"a3a6fc5436b14f3693777ad9fbf9168babfb5a9f","after":"9603a936b97944a1c821a05fb3d93bc2035786c8","ref":"refs/heads/prometheusnoop","pushedAt":"2023-05-19T17:23:31.479Z","pushType":"push","commitsCount":1,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnoop: Fix calculation of event size without description\n\n $ pahole -C event prometheusnoop\n struct event {\n \tvoid * object; /* 0 8 */\n \tuint64_t value; /* 8 8 */\n \tint pid; /* 16 4 */\n \t_Bool float_value; /* 20 1 */\n \tchar description[64]; /* 21 64 */\n\n \t/* size: 88, cachelines: 2, members: 5 */\n \t/* padding: 3 */\n \t/* last cacheline: 24 bytes */\n };\n\n $\n\nThere is padding, so if we subtract 88 - 64 we'll get 24 bytes when what\nwe want is to read just the first 21 bytes, up to the 'float_value'\nfield.\n\nBecause of that we end up not initializing the last 3 bytes that we were\npassing to bpf_perf_event_output() and the BPF verifier catch this and\nrefused to load the BPF bytecode.\n\nThen the first attempt at getting past the verifier is to use the '= {}'\nC idiom to ask the compiler to zero all 88 bytes (sizeof(struct event)).\n\nBut if we use offsetof(struct event, description) instead we get the\nright size, 21, and since all the other fields are explicitely\ninitialized, we don't have to have the extra memset done by the\ncompiler.\n\nHere is the verifier complaining:\n\n[root@quaco c]# ./prometheusnoop -b tests/prometheus/main\nlibbpf: prog 'counter': BPF program load failed: Permission denied\nlibbpf: prog 'counter': -- BEGIN PROG LOAD LOG --\n0: R1=ctx(off=0,imm=0) R10=fp0\n; prometheus_metric_uprobe(counter, valInt, false);\n0: (bf) r5 = r1 ; R1=ctx(off=0,imm=0) R5_w=ctx(off=0,imm=0)\n; prometheus_metric_uprobe(counter, valInt, false);\n1: (79) r4 = *(u64 *)(r5 +80) ; R4_w=scalar() R5_w=ctx(off=0,imm=0)\n2: (b7) r1 = 8 ; R1_w=8\n3: (b7) r2 = 32 ; R2_w=32\n4: (b7) r3 = 0 ; R3_w=0\n5: (85) call pc+2\nreg type unsupported for arg#3 function metric_event#20\ncaller:\n R10=fp0\ncallee:\n frame1: R1_w=8 R2_w=32 R3_w=0 R4_w=scalar() R5_w=ctx(off=0,imm=0) R10=fp0\n; static int metric_event(int value_offset, int desc_offset, bool float_value, void *object, void *ctx)\n8: (7b) *(u64 *)(r10 -120) = r5 ; frame1: R5_w=ctx(off=0,imm=0) R10=fp0 fp-120_w=ctx\n9: (bf) r8 = r4 ; frame1: R4_w=scalar(id=1) R8_w=scalar(id=1)\n10: (7b) *(u64 *)(r10 -136) = r3 ; frame1: R3_w=0 R10=fp0 fp-136_w=00000000\n11: (bf) r9 = r2 ; frame1: R2_w=32 R9_w=32\n12: (bf) r6 = r1 ; frame1: R1_w=8 R6_w=8\n; pid_t pid = bpf_get_current_pid_tgid() >> 32;\n13: (85) call bpf_get_current_pid_tgid#14 ; frame1: R0=scalar()\n; const size_t event_size = sizeof(*e) - (include_description ? 0 : sizeof(e->description));\n14: (18) r7 = 0xffff9d8280aa7000 ; frame1: R7_w=map_value(off=0,ks=4,vs=1,imm=0)\n16: (71) r1 = *(u8 *)(r7 +0) ; frame1: R1_w=0 R7_w=map_value(off=0,ks=4,vs=1,imm=0)\n; pid_t pid = bpf_get_current_pid_tgid() >> 32;\n17: (7b) *(u64 *)(r10 -128) = r1 ; frame1: R1_w=0 R10=fp0 fp-128_w=00000000\n18: (77) r0 >>= 32 ; frame1: R0_w=scalar(umax=4294967295,var_off=(0x0; 0xffffffff))\n; e->pid = pid;\n19: (63) *(u32 *)(r10 -96) = r0 ; frame1: R0_w=scalar(umax=4294967295,var_off=(0x0; 0xffffffff)) R10=fp0 fp-96=\n; e->object = object;\n20: (7b) *(u64 *)(r10 -112) = r8 ; frame1: R8=scalar(id=1) R10=fp0 fp-112_w=mmmmmmmm\n; if (bpf_probe_read_user(&e->value, sizeof(e->value), object + value_offset) < 0)\n21: (67) r6 <<= 32 ; frame1: R6_w=34359738368\n22: (c7) r6 s>>= 32 ; frame1: R6_w=8\n23: (bf) r3 = r8 ; frame1: R3_w=scalar(id=1) R8=scalar(id=1)\n24: (0f) r3 += r6 ; frame1: R3_w=scalar() R6_w=8\n; if (bpf_probe_read_user(&e->value, sizeof(e->value), object + value_offset) < 0)\n25: (bf) r1 = r10 ; frame1: R1_w=fp0 R10=fp0\n26: (07) r1 += -104 ; frame1: R1_w=fp-104\n; if (bpf_probe_read_user(&e->value, sizeof(e->value), object + value_offset) < 0)\n27: (b7) r2 = 8 ; frame1: R2_w=8\n28: (85) call bpf_probe_read_user#112 ; frame1: R0_w=scalar() fp-104=mmmmmmmm\n29: (b7) r1 = -11111111 ; frame1: R1_w=-11111111\n30: (b7) r2 = 0 ; frame1: R2_w=0\n; if (bpf_probe_read_user(&e->value, sizeof(e->value), object + value_offset) < 0)\n31: (6d) if r2 s> r0 goto pc+34 ; frame1: R0_w=scalar(umax=9223372036854775807,var_off=(0x0; 0x7fffffffffffffff)) R2_w=0\n; if (!include_description)\n32: (71) r1 = *(u8 *)(r7 +0) ; frame1: R1=0 R7=map_value(off=0,ks=4,vs=1,imm=0)\n; if (!include_description)\n33: (15) if r1 == 0x0 goto pc+79 ; frame1: R1=0\n; e->float_value = float_value;\n113: (79) r1 = *(u64 *)(r10 -136) ; frame1: R1_w=P0 R10=fp0\n;\n114: (73) *(u8 *)(r10 -92) = r1 ; frame1: R1_w=P0 R10=fp0 fp-96=???0mmmm\n; const size_t event_size = sizeof(*e) - (include_description ? 0 : sizeof(e->description));\n115: (79) r1 = *(u64 *)(r10 -128) ; frame1: R1_w=P0 R10=fp0\n116: (b7) r5 = 24 ; frame1: R5_w=24\n; const size_t event_size = sizeof(*e) - (include_description ? 0 : sizeof(e->description));\n117: (15) if r1 == 0x0 goto pc+1 ; frame1: R1_w=P0\n119: (bf) r4 = r10 ; frame1: R4_w=fp0 R10=fp0\n;\n120: (07) r4 += -112 ; frame1: R4_w=fp-112\n; bpf_perf_event_output(ctx, &rb, BPF_F_CURRENT_CPU, e, event_size);\n121: (79) r1 = *(u64 *)(r10 -120) ; frame1: R1_w=ctx(off=0,imm=0) R10=fp0\n122: (18) r2 = 0xffff8e68a7463a00 ; frame1: R2_w=map_ptr(off=0,ks=4,vs=4,imm=0)\n124: (18) r3 = 0xffffffff ; frame1: R3_w=4294967295\n126: (85) call bpf_perf_event_output#25\ninvalid indirect read from stack R4 off -112+21 size 24\nprocessed 42 insns (limit 1000000) max_states_per_insn 0 total_states 2 peak_states 2 mark_read 2\n-- END PROG LOAD LOG --\nlibbpf: prog 'counter': failed to load: -13\nlibbpf: failed to load object 'prometheusnoop_bpf'\nlibbpf: failed to load BPF skeleton 'prometheusnoop_bpf': -13\nFailed to load and verify BPF skeleton\n[root@quaco c]# fg\n\nSee that \"invalid indirect read from stack R4 off -112+21 size 24\", now\nits size 21 and no more extra 88 bytes clearing.\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnoop: Fix calculation of event size without description"}},{"before":"cacfc02486a7695bdd7e3cce6535a1ce255a5a15","after":"a3a6fc5436b14f3693777ad9fbf9168babfb5a9f","ref":"refs/heads/prometheusnoop","pushedAt":"2023-05-19T15:04:09.500Z","pushType":"push","commitsCount":1,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"examples/c/Makefile: Rename EXTRA_USER_CFLAGS to EXTRA_COMMON_CFLAGS\n\nAs for the use case at hand we need to pass the same defines to both the\nuserspace component and the BPF one.\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"examples/c/Makefile: Rename EXTRA_USER_CFLAGS to EXTRA_COMMON_CFLAGS"}},{"before":"d01232a8ea4321ece63fed0869cc61211bd5573e","after":"cacfc02486a7695bdd7e3cce6535a1ce255a5a15","ref":"refs/heads/prometheusnoop","pushedAt":"2023-05-19T14:56:37.290Z","pushType":"push","commitsCount":4,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnoop: Allow selecting the ring buffer type\n\nWe can build with the default BPF ring buffer or use this:\n\n $ make EXTRA_USER_CFLAGS=-DUSE_PERF_RING_BUFFER prometheusnoop\n\nTo build with the perf ring buffer. This is to test the overhead of\nboth in this specific workflow.\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnoop: Allow selecting the ring buffer type"}},{"before":"50483c26c3cd2ef195a71312bfae2b58b719f648","after":"d01232a8ea4321ece63fed0869cc61211bd5573e","ref":"refs/heads/prometheusnoop","pushedAt":"2023-05-19T13:44:48.683Z","pushType":"push","commitsCount":1,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"gitignore: Add mallocsnoop and prometheusnoop\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"gitignore: Add mallocsnoop and prometheusnoop"}},{"before":"00cf215862af5479789e7aa81d905e0879d36638","after":"50483c26c3cd2ef195a71312bfae2b58b719f648","ref":"refs/heads/prometheusnoop","pushedAt":"2023-05-19T12:51:13.728Z","pushType":"push","commitsCount":1,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnoop: Make the reading of the metric description per event to be selectable\n\nIn a real world app we want just the object + the mutable metric, not\nrepeating the description on each event, so make this selectable in this\nsimple proof of concept so that we can make measurements that reflect\nthe end result a bit more realistically.\n\n [root@quaco c]# ./prometheusnoop -d -b tests/prometheus/main\n TIME EVENT(Object) PID\n 09:48:13 (0xc00012a120) 1633233: desc: \"another_fake_counter\" value: 740\n 09:48:13 (0xc00012a120) 1633233: desc: \"another_fake_counter\" value: 741\n 09:48:14 (0xc00013a380) 1633233: desc: \"fake_gauge\" value: 370.000000\n 09:48:15 (0xc00013a3c0) 1633233: desc: \"another_fake_gauge\" value: 1855.000000\n 09:48:15 (0xc00013a440) 1633233: desc: \"sub_fake_gauge\" value: -2597.000000\n 09:48:15 (0xc00013a400) 1633233: desc: \"dec_fake_gauge\" value: -371.000000\n 09:48:16 (0xc00012a0c0) 1633233: desc: \"fake_counter\" value: 371\n 09:48:17 (0xc00012a120) 1633233: desc: \"another_fake_counter\" value: 742\n 09:48:17 (0xc00012a120) 1633233: desc: \"another_fake_counter\" value: 743\n 09:48:18 (0xc00013a380) 1633233: desc: \"fake_gauge\" value: 371.000000\n ^C[root@quaco c]#\n [root@quaco c]# ./prometheusnoop -b tests/prometheus/main\n TIME EVENT(Object) PID\n 09:48:25 (0xc00012a120) 1633233: value: 746\n 09:48:25 (0xc00012a120) 1633233: value: 747\n 09:48:26 (0xc00013a380) 1633233: value: 373.000000\n 09:48:27 (0xc00013a3c0) 1633233: value: 1870.000000\n 09:48:27 (0xc00013a440) 1633233: value: -2618.000000\n 09:48:27 (0xc00013a400) 1633233: value: -374.000000\n 09:48:28 (0xc00012a0c0) 1633233: value: 374\n 09:48:29 (0xc00012a120) 1633233: value: 748\n 09:48:29 (0xc00012a120) 1633233: value: 749\n 09:48:30 (0xc00013a380) 1633233: value: 374.000000\n ^C[root@quaco c]#\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnoop: Make the reading of the metric description per event …"}},{"before":"fc40e3a939050b08fd89fdb78ff464e1ec6133a4","after":"00cf215862af5479789e7aa81d905e0879d36638","ref":"refs/heads/prometheusnoop","pushedAt":"2023-05-19T12:36:17.002Z","pushType":"push","commitsCount":2,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnoop: Do not filter by pid in the BPF code, tell libbpf to do it\n\nIn bpf_program__attach_uprobe_opts() we can pass the pid to use, letting\nlibbpf to use the most appropriate way to set up the uprobe, that can\nreduce overhead, i.e. no system wide uprobes, just on the specific\nprocess.\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnoop: Do not filter by pid in the BPF code, tell libbpf to …"}},{"before":"b5aef347801a99613c752670238992aa8c57de93","after":"fc40e3a939050b08fd89fdb78ff464e1ec6133a4","ref":"refs/heads/prometheusnoop","pushedAt":"2023-05-19T12:28:26.436Z","pushType":"push","commitsCount":1,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnoop: Remove exclude_pid, mallocsnoop leftover\n\nSince prometheusnoop doesn't itself uses the functions that are being\nobserved, no loop takes place.\n\nThis is the start of a series of patches to reduce the overhead per\nuprobe to the minimum needed to get just object + mutable internal\nstate (the counter).\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnoop: Remove exclude_pid, mallocsnoop leftover"}},{"before":"db99ca5f1b9149c5be5454d800af7418acb76654","after":"b5aef347801a99613c752670238992aa8c57de93","ref":"refs/heads/prometheusnoop","pushedAt":"2023-05-18T19:22:57.739Z","pushType":"push","commitsCount":3,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnoop.bpf: Split queuing the event from the uprobe handler\n\nAs we'll use the queueing of events from the timer callback as well.\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnoop.bpf: Split queuing the event from the uprobe handler"}},{"before":"73a71e10a16341af831eafc28da7fc1a9b64f646","after":"db99ca5f1b9149c5be5454d800af7418acb76654","ref":"refs/heads/prometheusnoop","pushedAt":"2023-05-18T18:54:04.136Z","pushType":"push","commitsCount":2,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnoop.bpf: Use a template for the uprobes\n\nReduce the boilerplate further, now just the essential details are\nthere, class name and value field:\n\n prometheus_metric_uprobe(counter, valInt);\n prometheus_metric_uprobe(gauge, valBits);\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnoop.bpf: Use a template for the uprobes"}},{"before":"b59d46cb537ce549d9092c29edde7eb1deb23dd2","after":"73a71e10a16341af831eafc28da7fc1a9b64f646","ref":"refs/heads/prometheusnoop","pushedAt":"2023-05-18T18:36:41.661Z","pushType":"push","commitsCount":1,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnoop: Use a generic metric reader\n\nSo far we want just to read the counter value and its description, so\njust pass those offsets and read them instead of the a chunk of the\ncounter containing both the counter and the description.\n\nBefore:\n\n $ size .output/prometheusnoop.bpf.o\n text\t data\t bss\t dec\t hex\tfilename\n 1940\t 29\t 0\t 1969\t 7b1\t.output/prometheusnoop.bpf.o\n $\n\nAfter:\n\n $ size .output/prometheusnoop.bpf.o\n text\t data\t bss\t dec\t hex\tfilename\n 1916\t 29\t 0\t 1945\t 799\t.output/prometheusnoop.bpf.o\n $\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnoop: Use a generic metric reader"}},{"before":"823dc03436658f2eef9888517fc2a811957c3b2e","after":"b59d46cb537ce549d9092c29edde7eb1deb23dd2","ref":"refs/heads/prometheusnoop","pushedAt":"2023-05-18T16:56:03.162Z","pushType":"push","commitsCount":2,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnoop: Use just one BPF program for all methods of a class\n\nSince what all the methods do is to just copy the internal Metric state,\nuse just one BPF program per Metric class, since its internal state is\ndifferent.\n\nBefore:\n\n # size .output/prometheusnoop.bpf.o\n text\t data\t bss\t dec\t hex\tfilename\n 2028\t 29\t 0\t 2057\t 809\t.output/prometheusnoop.bpf.o\n #\n\nAfter:\n\n # size .output/prometheusnoop.bpf.o\n text\t data\t bss\t dec\t hex\tfilename\n 1940\t 29\t 0\t 1969\t 7b1\t.output/prometheusnoop.bpf.o\n #\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnoop: Use just one BPF program for all methods of a class"}},{"before":"f98ff746d17947d8bde2248b1bb42f71b8945666","after":"823dc03436658f2eef9888517fc2a811957c3b2e","ref":"refs/heads/prometheusnoop","pushedAt":"2023-05-11T18:19:32.880Z","pushType":"push","commitsCount":8,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnoop: Support gauge's Dec and Sub methods\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnoop: Support gauge's Dec and Sub methods"}},{"before":"d2f2739fb68aff71890fadf84e2eb1b184492253","after":"f98ff746d17947d8bde2248b1bb42f71b8945666","ref":"refs/heads/prometheusnoop","pushedAt":"2023-05-11T13:46:07.000Z","pushType":"push","commitsCount":4,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnoop: Hook into gauge.Add\n\nAdd another gauge example in the test go app and bump its value by 5\nevery second:\n\n[root@quaco c]# ./prometheusnoop -b tests/prometheus/main\nTIME EVENT(Object) PID\n09:47:57 GAUGE_ADD(0xc00021a3c0) 1282951: desc: \"another_fake_gauge\" value: 0.000000\n09:47:58 COUNTER_INC(0xc000218060) 1282951: desc: \"fake_counter\" value: 1\n09:47:59 COUNTER_INC(0xc0002180c0) 1282951: desc: \"another_fake_counter\" value: 1\n09:47:59 COUNTER_INC(0xc0002180c0) 1282951: desc: \"another_fake_counter\" value: 2\n09:48:00 GAUGE_INC(0xc00021a380) 1282951: desc: \"fake_gauge\" value: 0.000000\n09:48:01 GAUGE_ADD(0xc00021a3c0) 1282951: desc: \"another_fake_gauge\" value: 5.000000\n09:48:02 COUNTER_INC(0xc000218060) 1282951: desc: \"fake_counter\" value: 2\n09:48:03 COUNTER_INC(0xc0002180c0) 1282951: desc: \"another_fake_counter\" value: 3\n09:48:03 COUNTER_INC(0xc0002180c0) 1282951: desc: \"another_fake_counter\" value: 4\n09:48:04 GAUGE_INC(0xc00021a380) 1282951: desc: \"fake_gauge\" value: 1.000000\n09:48:05 GAUGE_ADD(0xc00021a3c0) 1282951: desc: \"another_fake_gauge\" value: 10.000000\n09:48:06 COUNTER_INC(0xc000218060) 1282951: desc: \"fake_counter\" value: 3\n09:48:07 COUNTER_INC(0xc0002180c0) 1282951: desc: \"another_fake_counter\" value: 5\n09:48:07 COUNTER_INC(0xc0002180c0) 1282951: desc: \"another_fake_counter\" value: 6\n09:48:08 GAUGE_INC(0xc00021a380) 1282951: desc: \"fake_gauge\" value: 2.000000\n^C[root@quaco c]#\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnoop: Hook into gauge.Add"}},{"before":"9cee915fdf04f497860459af11e30a3f0db95141","after":"d2f2739fb68aff71890fadf84e2eb1b184492253","ref":"refs/heads/prometheusnoop","pushedAt":"2023-04-27T18:19:26.000Z","pushType":"push","commitsCount":4,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnoop: Rename the \"ADDR\" header to \"Object\"\n\nADDR made sense in mallocsnoop, from where prometheusnoop was based.\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnoop: Rename the \"ADDR\" header to \"Object\""}},{"before":"b3162192da7bafb54f0d99c3640153bcdd3a5a9f","after":"9cee915fdf04f497860459af11e30a3f0db95141","ref":"refs/heads/prometheusnoop","pushedAt":"2023-04-27T12:28:23.000Z","pushType":"push","commitsCount":2,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnoop test: Add another counter, increment it twice in a 2nd goroutine\n\nTo make sure we're catching more than one, that increment at different\nrates, in different goroutines.\n\n # ./prometheusnoop -b tests/prometheus/main\n TIME EVENT(ADDR) PID\n 09:26:36 COUNTER_INC(0xc00021c0c0) 621119 : desc: \"another_fake_counter\" value: 1\n 09:26:36 COUNTER_INC(0xc00021c0c0) 621119 : desc: \"another_fake_counter\" value: 2\n 09:26:37 COUNTER_INC(0xc00021c060) 621119 : desc: \"fake_counter\" value: 1\n 09:26:38 COUNTER_INC(0xc00021c0c0) 621119 : desc: \"another_fake_counter\" value: 3\n 09:26:38 COUNTER_INC(0xc00021c0c0) 621119 : desc: \"another_fake_counter\" value: 4\n 09:26:39 COUNTER_INC(0xc00021c060) 621119 : desc: \"fake_counter\" value: 2\n 09:26:40 COUNTER_INC(0xc00021c0c0) 621119 : desc: \"another_fake_counter\" value: 5\n 09:26:40 COUNTER_INC(0xc00021c0c0) 621119 : desc: \"another_fake_counter\" value: 6\n 09:26:41 COUNTER_INC(0xc00021c060) 621119 : desc: \"fake_counter\" value: 3\n 09:26:42 COUNTER_INC(0xc00021c0c0) 621119 : desc: \"another_fake_counter\" value: 7\n 09:26:42 COUNTER_INC(0xc00021c0c0) 621119 : desc: \"another_fake_counter\" value: 8\n 09:26:43 COUNTER_INC(0xc00021c060) 621119 : desc: \"fake_counter\" value: 4\n 09:26:44 COUNTER_INC(0xc00021c0c0) 621119 : desc: \"another_fake_counter\" value: 9\n 09:26:44 COUNTER_INC(0xc00021c0c0) 621119 : desc: \"another_fake_counter\" value: 10\n 09:26:45 COUNTER_INC(0xc00021c060) 621119 : desc: \"fake_counter\" value: 5\n 09:26:46 COUNTER_INC(0xc00021c0c0) 621119 : desc: \"another_fake_counter\" value: 11\n 09:26:46 COUNTER_INC(0xc00021c0c0) 621119 : desc: \"another_fake_counter\" value: 12\n 09:26:47 COUNTER_INC(0xc00021c060) 621119 : desc: \"fake_counter\" value: 6\n 09:26:48 COUNTER_INC(0xc00021c0c0) 621119 : desc: \"another_fake_counter\" value: 13\n 09:26:48 COUNTER_INC(0xc00021c0c0) 621119 : desc: \"another_fake_counter\" value: 14\n ^C#\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnoop test: Add another counter, increment it twice in a 2nd…"}},{"before":"8076a3202cbb0c885104fe9994b2f19e55edd425","after":"b3162192da7bafb54f0d99c3640153bcdd3a5a9f","ref":"refs/heads/prometheusnoop","pushedAt":"2023-04-27T12:14:04.000Z","pushType":"push","commitsCount":6,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnopp: Add comment about possible future optimization for the event length\n\nWe can further optimize ring buffer usage by doing what the Linux perf\nsubsystem does and have variable length records, interesting for things\nlike counter descriptions.\n\nBut then we can have a EV_COUNTER_NEW the first time we see a metric\nthat only then sends the object pointer + description, the INC events\nwould just send object + new value (and this even to double check if we\nmissed some event :-) ).\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnopp: Add comment about possible future optimization for th…"}},{"before":null,"after":"8076a3202cbb0c885104fe9994b2f19e55edd425","ref":"refs/heads/prometheusnoop","pushedAt":"2023-04-26T20:47:31.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnoop: New snooper, prometheus specific\n\nNow one can specify a different binary name, since the association of\nthe BPF programs with the path/binary + function is done in the\nuserspace component:\n\n # ./prometheusnoop --help\n Usage: prometheusnoop [OPTION...]\n BPF prometheusnoop application.\n\n It traces prometheus metric updates\n\n USAGE: ./prometheusnoop [-v]\n\n -b, --binary=BINARY pathname or binary name in $PATH\n -p, --pid=PID pid to trace\n -v, --verbose Verbose debug output\n -X, --exclude_pid=PID pid to filter\n -?, --help Give this help list\n --usage Give a short usage message\n -V, --version Print program version\n\n Mandatory or optional arguments to long options are also mandatory or optional\n for any corresponding short options.\n\n Report bugs to .\n #\n\n # ./prometheusnoop -b main\n TIME EVENT(ADDR) COMM PID\n 17:44:52 NEW_COUNTER(0x94da70) main 594420\n 17:44:53 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 1\n 17:44:54 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 2\n 17:44:55 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 3\n 17:44:56 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 4\n 17:44:57 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 5\n 17:44:58 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 6\n 17:44:59 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 7\n 17:45:00 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 8\n 17:45:01 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 9\n 17:45:02 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 10\n 17:45:03 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 11\n ^C#\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnoop: New snooper, prometheus specific"}},{"before":"4d9fd4b79d320805eecf158d01df3ab8d3b67037","after":"8076a3202cbb0c885104fe9994b2f19e55edd425","ref":"refs/heads/mallocsnoop","pushedAt":"2023-04-26T20:47:16.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"prometheusnoop: New snooper, prometheus specific\n\nNow one can specify a different binary name, since the association of\nthe BPF programs with the path/binary + function is done in the\nuserspace component:\n\n # ./prometheusnoop --help\n Usage: prometheusnoop [OPTION...]\n BPF prometheusnoop application.\n\n It traces prometheus metric updates\n\n USAGE: ./prometheusnoop [-v]\n\n -b, --binary=BINARY pathname or binary name in $PATH\n -p, --pid=PID pid to trace\n -v, --verbose Verbose debug output\n -X, --exclude_pid=PID pid to filter\n -?, --help Give this help list\n --usage Give a short usage message\n -V, --version Print program version\n\n Mandatory or optional arguments to long options are also mandatory or optional\n for any corresponding short options.\n\n Report bugs to .\n #\n\n # ./prometheusnoop -b main\n TIME EVENT(ADDR) COMM PID\n 17:44:52 NEW_COUNTER(0x94da70) main 594420\n 17:44:53 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 1\n 17:44:54 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 2\n 17:44:55 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 3\n 17:44:56 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 4\n 17:44:57 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 5\n 17:44:58 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 6\n 17:44:59 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 7\n 17:45:00 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 8\n 17:45:01 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 9\n 17:45:02 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 10\n 17:45:03 COUNTER_INC(0xc00012a0c0) main 594420 : desc: \"fake_metric\" value: 11\n ^C#\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"prometheusnoop: New snooper, prometheus specific"}},{"before":"a4c4ab575a7928702f84a7b8c4701c95227376b7","after":"4d9fd4b79d320805eecf158d01df3ab8d3b67037","ref":"refs/heads/mallocsnoop","pushedAt":"2023-04-26T18:49:56.000Z","pushType":"push","commitsCount":2,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"mallocsnoop.bpf: Copy the counter description\n\nRebuilding the prometheus counter, Desc and go's string types from DWARF\nusing pahole and then doing the series of bpf_probe_read_user().\n\nToo much boilerplate, we need to automate this somehow, perhaps BTF for\ngo? Or even make libbpf do DWARF magic for SEC(\"uprobe.btf\")? :-)\n\nBut now we get:\n\n # ./mallocsnoop -m 131073\n TIME EVENT(ADDR) COMM PID\n 15:45:30 NEW_COUNTER(0x94da70) main 588404\n 15:45:31 COUNTER_INC(0xc000088420) main 588404 : desc: \"fake_metric\" value: 1\n 15:45:32 COUNTER_INC(0xc000088420) main 588404 : desc: \"fake_metric\" value: 2\n 15:45:33 COUNTER_INC(0xc000088420) main 588404 : desc: \"fake_metric\" value: 3\n 15:45:34 COUNTER_INC(0xc000088420) main 588404 : desc: \"fake_metric\" value: 4\n 15:45:35 COUNTER_INC(0xc000088420) main 588404 : desc: \"fake_metric\" value: 5\n 15:45:36 COUNTER_INC(0xc000088420) main 588404 : desc: \"fake_metric\" value: 6\n ^C#\n\nFor this prometheus counter in that main binary, built from main.go:\n\nvar fake_metric = prometheus.NewCounter(prometheus.CounterOpts{\n\tName: \"fake_metric\",\n\tHelp: \"every-tick\",\n})\n\nI'll add the main.go example so this gets reproduceable.\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"mallocsnoop.bpf: Copy the counter description"}},{"before":null,"after":"be15d32fec262e950fbdbb2887ae9a9b066a5cbf","ref":"refs/heads/master","pushedAt":"2023-04-26T16:47:14.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"Upgrade x86-64 and arm64 vmlinux.h headers\n\nRegenerate vmlinux.h header for both x86-64 and arm64 architectures\nbased on latest 6.1 kernel.\n\nSigned-off-by: Andrii Nakryiko ","shortMessageHtmlLink":"Upgrade x86-64 and arm64 vmlinux.h headers"}},{"before":null,"after":"a4c4ab575a7928702f84a7b8c4701c95227376b7","ref":"refs/heads/mallocsnoop","pushedAt":"2023-04-26T16:47:04.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"mallocsnoop: Read the prometheus counter value\n\nStill not looking at the DWARF info to figure out where the function\narguments are, instead looking at a disassembly of the monitored app:\n\n [root@quaco prometheus-uprobes]# objdump --disassemble='github.com/prometheus/client_golang/prometheus.(*counter).Inc' -S main\n\n main: file format elf64-x86-64\n\n Disassembly of section .text:\n\n 0000000000798640 :\n \tc.Add(v)\n \tc.updateExemplar(v, e)\n }\n\n func (c *counter) Inc() {\n \tatomic.AddUint64(&c.valInt, 1)\n 798640:\tb9 01 00 00 00 \tmov $0x1,%ecx\n 798645:\tf0 48 0f c1 48 08 \tlock xadd %rcx,0x8(%rax)\n }\n 79864b:\tc3 \tret\n\n Disassembly of section .plt:\n [root@quaco prometheus-uprobes]#\n\nSo ax it is:\n\n [root@quaco c]# ./mallocsnoop -m 131073\n TIME EVENT(ADDR) COMM PID\n 13:16:16 NEW_COUNTER(0x94da70) main 577539\n 13:16:17 COUNTER_INC(0xc00012a120) main 577539 : desc: \"unknown description\" value: 0\n 13:16:18 COUNTER_INC(0xc00012a120) main 577539 : desc: \"unknown description\" value: 1\n 13:16:19 COUNTER_INC(0xc00012a120) main 577539 : desc: \"unknown description\" value: 2\n 13:16:20 COUNTER_INC(0xc00012a120) main 577539 : desc: \"unknown description\" value: 3\n 13:16:21 COUNTER_INC(0xc00012a120) main 577539 : desc: \"unknown description\" value: 4\n 13:16:22 COUNTER_INC(0xc00012a120) main 577539 : desc: \"unknown description\" value: 5\n 13:16:23 COUNTER_INC(0xc00012a120) main 577539 : desc: \"unknown description\" value: 6\n 13:16:24 COUNTER_INC(0xc00012a120) main 577539 : desc: \"unknown description\" value: 7\n 13:16:25 COUNTER_INC(0xc00012a120) main 577539 : desc: \"unknown description\" value: 8\n 13:16:26 COUNTER_INC(0xc00012a120) main 577539 : desc: \"unknown description\" value: 9\n ^C[root@quaco c]#\n\nSigned-off-by: Arnaldo Carvalho de Melo ","shortMessageHtmlLink":"mallocsnoop: Read the prometheus counter value"}},{"before":null,"after":"9051e70af34f5085610c765819aa4d6c5795a00e","ref":"refs/heads/main","pushedAt":"2023-04-26T16:21:13.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"acmel","name":"Arnaldo Carvalho de Melo","path":"/acmel","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/1051254?s=80&v=4"},"commit":{"message":"Initial commit","shortMessageHtmlLink":"Initial commit"}}],"hasNextPage":false,"hasPreviousPage":false,"activityType":"all","actor":null,"timePeriod":"all","sort":"DESC","perPage":30,"startCursor":"Y3Vyc29yOnYyOpK7MjAyMy0wNS0yMlQyMDo0NzoyMS43NTk1ODlazwAAAAMx5xYc","endCursor":"Y3Vyc29yOnYyOpK7MjAyMy0wNC0yNlQxNjoyMToxMy4wMDAwMDBazwAAAAMg1xD5"}},"title":"Activity · acmel/libbpf-bootstrap"}