Skip to content

[0/2] Refactor Logging Infrastructure#485

Open
yaakov-stein wants to merge 2 commits intofacebook:mainfrom
yaakov-stein:refactor-log-infrastructure
Open

[0/2] Refactor Logging Infrastructure#485
yaakov-stein wants to merge 2 commits intofacebook:mainfrom
yaakov-stein:refactor-log-infrastructure

Conversation

@yaakov-stein
Copy link
Copy Markdown
Contributor

@yaakov-stein yaakov-stein commented Mar 20, 2026

Stack:

Summary

This sets the stage for adding logging support for CGROUP_SOCK_ADDR. The first step is renaming the logging infrastructure in a way that isn't packet-specific (or making it clear that certain parts are packet-specific and naming accordingly), and adding a union that allows us to add the necessary fields to bf_log to support this change.

No functional change (besides the bf_log_type enum helper methods).

@meta-cla meta-cla bot added the cla signed label Mar 20, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 20, 2026

Claude review of PR #485 (bbb165c)

Suggestions

  • Add static_assert for struct bf_log sizesrc/libbpfilter/include/bpfilter/runtime.h:195 — struct grew from 112 to 120 bytes due to union layout; a static_assert would guard the ABI boundary and catch accidental regressions
  • Zero ring buffer memory after reservesrc/libbpfilter/bpf/pkt_log.bpf.c:36 — bpf_ringbuf_reserve returns uninitialized memory; padding gaps and partially-filled header slices could leak kernel data to userspace (pre-existing, but natural to fix here)

Nits

  • BF_LOG_TYPE_PACKET = 0 ambiguous with uninitialized datasrc/libbpfilter/include/bpfilter/runtime.h:100 — starting the enum at 1 would distinguish valid entries from uninitialized ring buffer memory
  • Group common-header writes separately from pkt fieldssrc/libbpfilter/bpf/pkt_log.bpf.c:33 — a blank line between common-header assignments and pkt-specific writes would mirror the struct layout separation

Workflow run

@yaakov-stein yaakov-stein changed the title [0/2] Refactor Log Infrastructure [0/2][CGROUP_SOCK_ADDR Logging] Refactor Log Infrastructure Mar 20, 2026
@yaakov-stein yaakov-stein force-pushed the refactor-log-infrastructure branch from c911410 to 7aeeab0 Compare March 27, 2026 17:06
@yaakov-stein yaakov-stein marked this pull request as ready for review March 27, 2026 19:07
@yaakov-stein yaakov-stein force-pushed the refactor-log-infrastructure branch from 7aeeab0 to 4a18e6d Compare March 27, 2026 19:45
@yaakov-stein yaakov-stein force-pushed the refactor-log-infrastructure branch from 4a18e6d to 4c82f48 Compare March 27, 2026 20:26
@yaakov-stein yaakov-stein force-pushed the refactor-log-infrastructure branch from 4c82f48 to fe77c33 Compare March 27, 2026 20:59
@yaakov-stein yaakov-stein marked this pull request as draft March 29, 2026 03:53
@yaakov-stein yaakov-stein force-pushed the refactor-log-infrastructure branch 2 times, most recently from 5c7c805 to 61e87f4 Compare March 29, 2026 19:25
@yaakov-stein yaakov-stein force-pushed the refactor-log-infrastructure branch from 61e87f4 to 3634fd4 Compare March 29, 2026 19:46
@yaakov-stein yaakov-stein marked this pull request as ready for review March 29, 2026 20:01
@yaakov-stein yaakov-stein changed the title [0/2][CGROUP_SOCK_ADDR Logging] Refactor Log Infrastructure [0/2] Refactor Logging Infrastructure Mar 29, 2026
@yaakov-stein yaakov-stein force-pushed the refactor-log-infrastructure branch from 3634fd4 to 12b8bcf Compare March 29, 2026 22:05
@yaakov-stein yaakov-stein force-pushed the refactor-log-infrastructure branch 2 times, most recently from 3a1fe85 to ddb6fb5 Compare March 30, 2026 16:06
@yaakov-stein yaakov-stein force-pushed the refactor-log-infrastructure branch from ddb6fb5 to a7bc7c5 Compare March 30, 2026 20:05
@yaakov-stein yaakov-stein requested a review from qdeslandes March 30, 2026 20:26
@yaakov-stein yaakov-stein force-pushed the refactor-log-infrastructure branch from a7bc7c5 to ed6e84f Compare April 1, 2026 23:46
Rename the packet logging ELF stub from `log` to `pkt_log` to
establish naming symmetry with the upcoming `sock_log` stub for
socket-based hooks.
Restructure bf_log as a tagged union with packet and socket address
variants, discriminated by bf_log_type.
@yaakov-stein yaakov-stein force-pushed the refactor-log-infrastructure branch from ed6e84f to bbb165c Compare April 1, 2026 23:48
@yaakov-stein yaakov-stein requested a review from qdeslandes April 1, 2026 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants