[PATCH v3 0/3] btf_encoder: do not encode functions consuming packed structs on stack

Alexis Lothoré (eBPF Foundation)
2025-07-07T14:02:11Z

Hello,
this is the v3 of the packed-struct-passed-on-stack series. This
revision follows on Ihor's comments on v2.

Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
---
Changes in v3:
- add uncertain param loc logic to saved_functions_combine to
deduplicate functions
- remove unneeded call to class__infer_holes
- bring a userspace binary instead of a OoT kernel module for testing
- consolidate paths used in the new test
- Link to v2: https://lore.kernel.org/r/20250703-btf_skip_structs_on_stack-v2-0-4767e3ba10c9@bootlin.com

Changes in v2:
- infer structs attributes
- skip function encoded if some consumed struct (passed on stack) is
marked as packed
- add some tests in btf_functions.sh
- drop RFC prefix
- Link to v1: https://lore.kernel.org/r/20250618-btf_skip_structs_on_stack-v1-1-e70be639cc53@bootlin.com

---
Alexis Lothoré (eBPF Foundation) (3):
btf_encoder: skip functions consuming packed structs passed by value on stack
tests: add some tests validating skipped functions due to uncertain arg location
gitignore: ignore all the test kmod build-related files

.gitignore | 3 ++
btf_encoder.c | 53 +++++++++++++++++++++++++++--
dwarves.h | 1 +
tests/bin/Makefile | 10 ++++++
tests/bin/test_bin.c | 66 ++++++++++++++++++++++++++++++++++++
tests/btf_functions.sh | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 221 insertions(+), 3 deletions(-)
---
base-commit: 042d73962d35fdd1466e056f1ea14590b1cdbb9b
change-id: 20250617-btf_skip_structs_on_stack-006adf457d50

Best regards,
--
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering