Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse BPF programs in multi-process mode #471

Merged
merged 23 commits into from
Dec 1, 2023

Conversation

grcevski
Copy link
Contributor

@grcevski grcevski commented Nov 29, 2023

In version 1 we load multiple versions of the same kprobes and uprobes, and use the map filtering by PID to eliminate duplicates. This PR fixes that, allowing for more shared maps and reducing probes loaded to the minimum required. We reuse the kprobes and the probes on libssl.

Closes #395

TODO:

  • Integration tests with many processes
  • Revisit map sizings to make sure they are adequate with mulitple processes

// tracers returns Tracer implementer for each discovered eBPF traceable source: GRPC, HTTP...
func (pt *ProcessTracer) tracers() ([]Tracer, error) {
loadMux.Lock()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must be locked to force loading of eBPF programs one by one, otherwise we can't properly share the pinned maps, once in a while I get file already exists.

@grcevski
Copy link
Contributor Author

grcevski commented Nov 29, 2023

Here's some before and after data from running bpftool prog:

I'm running below 3 HTTPS services, Rust (shared libssl), Node (vendored libssl), Python (shared libssl), with the following configuration:

discovery:
  services:
    - namespace: multi-k
      name: rust-service
      open_ports: 8490
    - namespace: multi-k
      name: python-service
      open_ports: 8083 
    - namespace: multi-k
      name: nodejs-service
      open_ports: 3033  
Before (61 probes):
2458: kprobe  name kprobe_security_socket_bind  tag 98ba13692568d3eb  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 424B  jited 251B  memlock 4096B  map_ids 3177,3178
	btf_id 5247
	pids beyla(682382)
2460: kprobe  name kprobe_sys_exit  tag 97c5103a7efa6e92  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1808B  jited 960B  memlock 4096B  map_ids 3182,3183,3184,3185
	btf_id 5255
	pids beyla(682382)
2461: kprobe  name kprobe_tcp_connect  tag d9cbdfd640d89b00  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1776B  jited 945B  memlock 4096B  map_ids 3182,3183,3184,3189
	btf_id 5261
	pids beyla(682382)
2462: kprobe  name kprobe_sys_exit  tag 97c5103a7efa6e92  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1808B  jited 960B  memlock 4096B  map_ids 3186,3187,3188,3190
	btf_id 5262
	pids beyla(682382)
2463: kprobe  name kprobe_sys_exit  tag 97c5103a7efa6e92  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1808B  jited 960B  memlock 4096B  map_ids 3191,3192,3193,3194
	btf_id 5267
	pids beyla(682382)
2464: kprobe  name kprobe_tcp_connect  tag d9cbdfd640d89b00  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1776B  jited 945B  memlock 4096B  map_ids 3186,3187,3188,3195
	btf_id 5270
	pids beyla(682382)
2465: kprobe  name kprobe_tcp_rcv_established  tag b469e4c91b0915ca  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 3440B  jited 1838B  memlock 4096B  map_ids 3182,3183,3184,3196,3197
	btf_id 5272
	pids beyla(682382)
2466: kprobe  name kprobe_tcp_connect  tag d9cbdfd640d89b00  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1776B  jited 945B  memlock 4096B  map_ids 3191,3192,3193,3198
	btf_id 5275
	pids beyla(682382)
2467: kprobe  name kprobe_tcp_recvmsg  tag a63bb35d66316567  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 2408B  jited 1318B  memlock 4096B  map_ids 3182,3183,3184,3200
	btf_id 5279
	pids beyla(682382)
2468: kprobe  name kprobe_tcp_rcv_established  tag b469e4c91b0915ca  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 3440B  jited 1838B  memlock 4096B  map_ids 3186,3187,3188,3199,3201
	btf_id 5280
	pids beyla(682382)
2469: kprobe  name kprobe_tcp_rcv_established  tag b469e4c91b0915ca  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 3440B  jited 1838B  memlock 4096B  map_ids 3191,3192,3193,3202,3203
	btf_id 5282
	pids beyla(682382)
2470: kprobe  name kprobe_tcp_recvmsg  tag a63bb35d66316567  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 2408B  jited 1318B  memlock 4096B  map_ids 3186,3187,3188,3205
	btf_id 5286
	pids beyla(682382)
2471: kprobe  name kprobe_tcp_recvmsg  tag a63bb35d66316567  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 2408B  jited 1318B  memlock 4096B  map_ids 3191,3192,3193,3206
	btf_id 5288
	pids beyla(682382)
2472: kprobe  name kprobe_tcp_sendmsg  tag addc33bd524b2178  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 10088B  jited 6313B  memlock 12288B  map_ids 3182,3183,3184,3204,3207,3212,3196,3213,3214,3215,3216,3217
	btf_id 5298
	pids beyla(682382)
2473: kprobe  name kretprobe_sock_alloc  tag bb78c12296de2e9e  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1776B  jited 945B  memlock 4096B  map_ids 3182,3183,3184,3230
	btf_id 5312
	pids beyla(682382)
2474: kprobe  name kprobe_tcp_sendmsg  tag addc33bd524b2178  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 10088B  jited 6313B  memlock 12288B  map_ids 3191,3192,3193,3209,3211,3219,3202,3221,3223,3224,3226,3228
	btf_id 5309
	pids beyla(682382)
2475: kprobe  name kprobe_tcp_sendmsg  tag addc33bd524b2178  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 10088B  jited 6313B  memlock 12288B  map_ids 3186,3187,3188,3208,3210,3218,3199,3220,3222,3225,3227,3229
	btf_id 5310
	pids beyla(682382)
2476: kprobe  name kretprobe_sys_accept4  tag b67fc3ce4da2be62  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 3712B  jited 1964B  memlock 4096B  map_ids 3182,3183,3184,3230,3196,3197
	btf_id 5313
	pids beyla(682382)
2477: kprobe  name kretprobe_sock_alloc  tag bb78c12296de2e9e  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1776B  jited 945B  memlock 4096B  map_ids 3191,3192,3193,3231
	btf_id 5317
	pids beyla(682382)
2478: kprobe  name kretprobe_sock_alloc  tag bb78c12296de2e9e  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1776B  jited 945B  memlock 4096B  map_ids 3186,3187,3188,3232
	btf_id 5318
	pids beyla(682382)
2479: kprobe  name kretprobe_sys_connect  tag fda185ea2594337c  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 3744B  jited 1985B  memlock 4096B  map_ids 3182,3183,3184,3189,3196,3197
	btf_id 5316
	pids beyla(682382)
2480: kprobe  name kretprobe_sys_accept4  tag b67fc3ce4da2be62  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 3712B  jited 1964B  memlock 4096B  map_ids 3191,3192,3193,3231,3202,3203
	btf_id 5319
	pids beyla(682382)
2481: kprobe  name kretprobe_sys_accept4  tag b67fc3ce4da2be62  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 3712B  jited 1964B  memlock 4096B  map_ids 3186,3187,3188,3232,3199,3201
	btf_id 5320
	pids beyla(682382)
2482: kprobe  name kretprobe_sys_connect  tag fda185ea2594337c  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 3744B  jited 1985B  memlock 4096B  map_ids 3191,3192,3193,3198,3202,3203
	btf_id 5322
	pids beyla(682382)
2483: kprobe  name kretprobe_sys_connect  tag fda185ea2594337c  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 3744B  jited 1985B  memlock 4096B  map_ids 3186,3187,3188,3195,3199,3201
	btf_id 5323
	pids beyla(682382)
2484: kprobe  name kretprobe_tcp_recvmsg  tag cfbe229f9f55c6b8  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 9344B  jited 5846B  memlock 12288B  map_ids 3182,3183,3200,3184,3204,3207,3212,3196,3213,3214,3215
	btf_id 5321
	pids beyla(682382)
2485: kprobe  name uprobe_ssl_do_handshake  tag c2b1511c25580302  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1752B  jited 940B  memlock 4096B  map_ids 3182,3183,3216,3184
	btf_id 5326
	pids beyla(682382)
2486: kprobe  name uprobe_ssl_read  tag cf31d428f05f6600  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1880B  jited 997B  memlock 4096B  map_ids 3182,3183,3184,3233,3234
	btf_id 5329
	pids beyla(682382)
2487: kprobe  name kretprobe_tcp_recvmsg  tag cfbe229f9f55c6b8  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 9344B  jited 5846B  memlock 12288B  map_ids 3191,3192,3206,3193,3209,3211,3219,3202,3221,3223,3224
	btf_id 5324
	pids beyla(682382)
2488: kprobe  name kretprobe_tcp_recvmsg  tag cfbe229f9f55c6b8  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 9344B  jited 5846B  memlock 12288B  map_ids 3186,3187,3205,3188,3208,3210,3218,3199,3220,3222,3225
	btf_id 5325
	pids beyla(682382)
2489: kprobe  name uprobe_ssl_read_ex  tag de0b21be48ba7696  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1888B  jited 1000B  memlock 4096B  map_ids 3182,3183,3184,3233,3234
	btf_id 5330
	pids beyla(682382)
2490: kprobe  name uprobe_ssl_do_handshake  tag c2b1511c25580302  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1752B  jited 940B  memlock 4096B  map_ids 3191,3192,3226,3193
	btf_id 5331
	pids beyla(682382)
2491: kprobe  name uprobe_ssl_do_handshake  tag c2b1511c25580302  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1752B  jited 940B  memlock 4096B  map_ids 3186,3187,3227,3188
	btf_id 5332
	pids beyla(682382)
2492: kprobe  name uprobe_ssl_shutdown  tag 67b73dfc788820e5  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1768B  jited 953B  memlock 4096B  map_ids 3182,3183,3217,3197,3184
	btf_id 5333
	pids beyla(682382)
2493: kprobe  name uprobe_ssl_read  tag cf31d428f05f6600  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1880B  jited 997B  memlock 4096B  map_ids 3191,3192,3193,3235,3237
	btf_id 5339
	pids beyla(682382)
2494: kprobe  name uprobe_ssl_write  tag 2ef55aa2eeb20f9c  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1816B  jited 965B  memlock 4096B  map_ids 3182,3183,3184,3239
	btf_id 5341
	pids beyla(682382)
2495: kprobe  name uprobe_ssl_read  tag cf31d428f05f6600  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1880B  jited 997B  memlock 4096B  map_ids 3186,3187,3188,3236,3238
	btf_id 5340
	pids beyla(682382)
2496: kprobe  name uprobe_ssl_read_ex  tag de0b21be48ba7696  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1888B  jited 1000B  memlock 4096B  map_ids 3191,3192,3193,3235,3237
	btf_id 5342
	pids beyla(682382)
2497: kprobe  name uprobe_ssl_write_ex  tag 4bf1ec9e70fa5b78  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1824B  jited 968B  memlock 4096B  map_ids 3182,3183,3184,3239
	btf_id 5343
	pids beyla(682382)
2498: kprobe  name uprobe_ssl_read_ex  tag de0b21be48ba7696  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1888B  jited 1000B  memlock 4096B  map_ids 3186,3187,3188,3236,3238
	btf_id 5344
	pids beyla(682382)
2499: kprobe  name uprobe_ssl_shutdown  tag 67b73dfc788820e5  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1768B  jited 953B  memlock 4096B  map_ids 3191,3192,3228,3203,3193
	btf_id 5345
	pids beyla(682382)
2500: kprobe  name uprobe_ssl_shutdown  tag 67b73dfc788820e5  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1768B  jited 953B  memlock 4096B  map_ids 3186,3187,3229,3201,3188
	btf_id 5347
	pids beyla(682382)
2501: kprobe  name uretprobe_ssl_do_handshake  tag 2b0ec415ba83a870  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1704B  jited 919B  memlock 4096B  map_ids 3182,3183,3216,3184
	btf_id 5346
	pids beyla(682382)
2502: kprobe  name uprobe_ssl_write  tag 2ef55aa2eeb20f9c  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1816B  jited 965B  memlock 4096B  map_ids 3191,3192,3193,3240
	btf_id 5351
	pids beyla(682382)
2503: kprobe  name uprobe_ssl_write  tag 2ef55aa2eeb20f9c  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1816B  jited 965B  memlock 4096B  map_ids 3186,3187,3188,3241
	btf_id 5352
	pids beyla(682382)
2504: kprobe  name uprobe_ssl_write_ex  tag 4bf1ec9e70fa5b78  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1824B  jited 968B  memlock 4096B  map_ids 3191,3192,3193,3240
	btf_id 5353
	pids beyla(682382)
2505: kprobe  name uretprobe_ssl_read  tag 3b6c9b1c0ce91b48  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 9360B  jited 5859B  memlock 12288B  map_ids 3182,3183,3233,3217,3197,3234,3184,3204,3207,3212,3196,3213,3214,3215
	btf_id 5350
	pids beyla(682382)
2506: kprobe  name uprobe_ssl_write_ex  tag 4bf1ec9e70fa5b78  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1824B  jited 968B  memlock 4096B  map_ids 3186,3187,3188,3241
	btf_id 5354
	pids beyla(682382)
2507: kprobe  name uretprobe_ssl_do_handshake  tag 2b0ec415ba83a870  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1704B  jited 919B  memlock 4096B  map_ids 3191,3192,3226,3193
	btf_id 5355
	pids beyla(682382)
2508: kprobe  name uretprobe_ssl_do_handshake  tag 2b0ec415ba83a870  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 1704B  jited 919B  memlock 4096B  map_ids 3186,3187,3227,3188
	btf_id 5357
	pids beyla(682382)
2509: kprobe  name uretprobe_ssl_read_ex  tag 560c8628ea8ab55e  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 9456B  jited 5934B  memlock 12288B  map_ids 3182,3183,3184,3233,3217,3197,3234,3204,3207,3212,3196,3213,3214,3215
	btf_id 5356
	pids beyla(682382)
2510: kprobe  name uretprobe_ssl_read  tag 3b6c9b1c0ce91b48  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 9360B  jited 5859B  memlock 12288B  map_ids 3186,3187,3236,3229,3201,3238,3188,3208,3210,3218,3199,3220,3222,3225
	btf_id 5359
	pids beyla(682382)
2511: kprobe  name uretprobe_ssl_read  tag 3b6c9b1c0ce91b48  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 9360B  jited 5859B  memlock 12288B  map_ids 3191,3192,3235,3228,3203,3237,3193,3209,3211,3219,3202,3221,3223,3224
	btf_id 5358
	pids beyla(682382)
2512: kprobe  name uretprobe_ssl_write  tag 5e56f81b43aae03f  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 9360B  jited 5859B  memlock 12288B  map_ids 3182,3183,3239,3217,3197,3234,3184,3204,3207,3212,3196,3213,3214,3215
	btf_id 5360
	pids beyla(682382)
2513: kprobe  name uretprobe_ssl_read_ex  tag 560c8628ea8ab55e  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 9456B  jited 5934B  memlock 12288B  map_ids 3186,3187,3188,3236,3229,3201,3238,3208,3210,3218,3199,3220,3222,3225
	btf_id 5361
	pids beyla(682382)
2514: kprobe  name uretprobe_ssl_read_ex  tag 560c8628ea8ab55e  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 9456B  jited 5934B  memlock 12288B  map_ids 3191,3192,3193,3235,3228,3203,3237,3209,3211,3219,3202,3221,3223,3224
	btf_id 5362
	pids beyla(682382)
2515: kprobe  name uretprobe_ssl_write  tag 5e56f81b43aae03f  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 9360B  jited 5859B  memlock 12288B  map_ids 3186,3187,3241,3229,3201,3238,3188,3208,3210,3218,3199,3220,3222,3225
	btf_id 5364
	pids beyla(682382)
2516: kprobe  name uretprobe_ssl_write  tag 5e56f81b43aae03f  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 9360B  jited 5859B  memlock 12288B  map_ids 3191,3192,3240,3228,3203,3237,3193,3209,3211,3219,3202,3221,3223,3224
	btf_id 5365
	pids beyla(682382)
2517: kprobe  name uretprobe_ssl_write_ex  tag 771d455652c1048f  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 9456B  jited 5934B  memlock 12288B  map_ids 3182,3183,3184,3239,3217,3197,3234,3204,3207,3212,3196,3213,3214,3215
	btf_id 5363
	pids beyla(682382)
2518: kprobe  name uretprobe_ssl_write_ex  tag 771d455652c1048f  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 9456B  jited 5934B  memlock 12288B  map_ids 3186,3187,3188,3241,3229,3201,3238,3208,3210,3218,3199,3220,3222,3225
	btf_id 5366
	pids beyla(682382)
2519: kprobe  name uretprobe_ssl_write_ex  tag 771d455652c1048f  gpl
	loaded_at 2023-11-28T20:09:32-0500  uid 0
	xlated 9456B  jited 5934B  memlock 12288B  map_ids 3191,3192,3193,3240,3228,3203,3237,3209,3211,3219,3202,3221,3223,3224
	btf_id 5367
	pids beyla(682382)
After (19 probes):
2429: kprobe  name kprobe_tcp_connect  tag d9cbdfd640d89b00  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 1776B  jited 945B  memlock 4096B  map_ids 3138,3139,3140,3141
	btf_id 5190
	pids beyla(673232)
2430: kprobe  name kprobe_tcp_rcv_established  tag b469e4c91b0915ca  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 3440B  jited 1838B  memlock 4096B  map_ids 3138,3139,3140,3142,3143
	btf_id 5193
	pids beyla(673232)
2431: kprobe  name kprobe_tcp_recvmsg  tag a63bb35d66316567  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 2408B  jited 1318B  memlock 4096B  map_ids 3138,3139,3140,3144
	btf_id 5195
	pids beyla(673232)
2432: kprobe  name kprobe_tcp_sendmsg  tag addc33bd524b2178  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 10088B  jited 6313B  memlock 12288B  map_ids 3138,3139,3140,3145,3146,3147,3142,3148,3149,3150,3151,3152
	btf_id 5203
	pids beyla(673232)
2433: kprobe  name kretprobe_sock_alloc  tag bb78c12296de2e9e  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 1776B  jited 945B  memlock 4096B  map_ids 3138,3139,3140,3153
	btf_id 5205
	pids beyla(673232)
2434: kprobe  name kretprobe_sys_accept4  tag b67fc3ce4da2be62  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 3712B  jited 1964B  memlock 4096B  map_ids 3138,3139,3140,3153,3142,3143
	btf_id 5206
	pids beyla(673232)
2435: kprobe  name kretprobe_sys_connect  tag fda185ea2594337c  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 3744B  jited 1985B  memlock 4096B  map_ids 3138,3139,3140,3141,3142,3143
	btf_id 5207
	pids beyla(673232)
2436: kprobe  name kretprobe_tcp_recvmsg  tag cfbe229f9f55c6b8  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 9344B  jited 5846B  memlock 12288B  map_ids 3138,3139,3144,3140,3145,3146,3147,3142,3148,3149,3150
	btf_id 5208
	pids beyla(673232)
2438: kprobe  name uprobe_ssl_do_handshake  tag c2b1511c25580302  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 1752B  jited 940B  memlock 4096B  map_ids 3158,3139,3151,3140
	btf_id 5214
	pids beyla(673232)
2439: kprobe  name uprobe_ssl_read  tag cf31d428f05f6600  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 1880B  jited 997B  memlock 4096B  map_ids 3158,3139,3140,3159,3160
	btf_id 5217
	pids beyla(673232)
2440: kprobe  name uprobe_ssl_read_ex  tag de0b21be48ba7696  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 1888B  jited 1000B  memlock 4096B  map_ids 3158,3139,3140,3159,3160
	btf_id 5218
	pids beyla(673232)
2441: kprobe  name uprobe_ssl_shutdown  tag 67b73dfc788820e5  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 1768B  jited 953B  memlock 4096B  map_ids 3158,3139,3152,3143,3140
	btf_id 5219
	pids beyla(673232)
2442: kprobe  name uprobe_ssl_write  tag 2ef55aa2eeb20f9c  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 1816B  jited 965B  memlock 4096B  map_ids 3158,3139,3140,3161
	btf_id 5221
	pids beyla(673232)
2443: kprobe  name uprobe_ssl_write_ex  tag 4bf1ec9e70fa5b78  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 1824B  jited 968B  memlock 4096B  map_ids 3158,3139,3140,3161
	btf_id 5222
	pids beyla(673232)
2444: kprobe  name uretprobe_ssl_do_handshake  tag 2b0ec415ba83a870  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 1704B  jited 919B  memlock 4096B  map_ids 3158,3139,3151,3140
	btf_id 5223
	pids beyla(673232)
2445: kprobe  name uretprobe_ssl_read  tag 3b6c9b1c0ce91b48  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 9360B  jited 5859B  memlock 12288B  map_ids 3158,3139,3159,3152,3143,3160,3140,3162,3163,3164,3165,3166,3149,3167
	btf_id 5229
	pids beyla(673232)
2446: kprobe  name uretprobe_ssl_read_ex  tag 560c8628ea8ab55e  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 9456B  jited 5934B  memlock 12288B  map_ids 3158,3139,3140,3159,3152,3143,3160,3162,3163,3164,3165,3166,3149,3167
	btf_id 5230
	pids beyla(673232)
2447: kprobe  name uretprobe_ssl_write  tag 5e56f81b43aae03f  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 9360B  jited 5859B  memlock 12288B  map_ids 3158,3139,3161,3152,3143,3160,3140,3162,3163,3164,3165,3166,3149,3167
	btf_id 5231
	pids beyla(673232)
2448: kprobe  name uretprobe_ssl_write_ex  tag 771d455652c1048f  gpl
	loaded_at 2023-11-28T20:05:33-0500  uid 0
	xlated 9456B  jited 5934B  memlock 12288B  map_ids 3158,3139,3140,3161,3152,3143,3160,3162,3163,3164,3165,3166,3149,3167
	btf_id 5232
	pids beyla(673232)

Copy link
Contributor

@mariomac mariomac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a huge change! Maybe some parts could be refactored to reduce a bit of complexity of the usage of global variables, but I'd need to experiment a bit first 😅.

Once the integration tests are fixed, it's LGTM to merge and we can refine later.

@codecov-commenter
Copy link

codecov-commenter commented Nov 29, 2023

Codecov Report

Attention: 329 lines in your changes are missing coverage. Please review.

Comparison is base (26e3210) 77.17% compared to head (046a375) 40.42%.

Files Patch % Lines
pkg/internal/ebpf/httpssl/httpssl.go 0.00% 129 Missing ⚠️
pkg/internal/discover/attacher.go 0.00% 46 Missing ⚠️
pkg/internal/ebpf/httpfltr/httpfltr.go 15.55% 37 Missing and 1 partial ⚠️
pkg/internal/discover/attacher_linux.go 0.00% 34 Missing ⚠️
pkg/internal/ebpf/common/pids.go 38.70% 19 Missing ⚠️
pkg/internal/ebpf/instrumenter.go 0.00% 15 Missing ⚠️
pkg/internal/exec/file.go 0.00% 10 Missing ⚠️
pkg/internal/ebpf/tracer_linux.go 0.00% 9 Missing ⚠️
pkg/internal/discover/typer.go 0.00% 7 Missing ⚠️
pkg/internal/ebpf/goruntime/goruntime.go 0.00% 4 Missing ⚠️
... and 6 more
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #471       +/-   ##
===========================================
- Coverage   77.17%   40.42%   -36.75%     
===========================================
  Files          65       65               
  Lines        5183     5170       -13     
===========================================
- Hits         4000     2090     -1910     
- Misses        962     2945     +1983     
+ Partials      221      135       -86     
Flag Coverage Δ
integration-test ?
unittests 40.42% <6.53%> (-1.45%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@grcevski grcevski changed the title WIP: Reuse BPF programs in multi-process mode Reuse BPF programs in multi-process mode Nov 30, 2023
@grcevski grcevski marked this pull request as ready for review November 30, 2023 21:17
@grcevski grcevski merged commit fd1de8d into grafana:main Dec 1, 2023
4 checks passed
@grcevski grcevski deleted the share_bpf_maps branch December 1, 2023 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Figure out how to properly support TLS with multiple processes
3 participants