b47063c49c
Core: Resolve plain-ctypes context parameter in helper args
...
process_func_body only entered the context parameter into local_sym_tab
when its annotation was a vmlinux struct, so a program declared as
`def prog(ctx: c_void_p)` had no `ctx` symbol at all. Passing `ctx` to a
helper that takes a raw pointer -- probe_read(dst, size, ctx) -- failed
with "Variable 'ctx' not found in local symbol table".
Register the parameter for plain ctypes annotations too, keeping `var`
as None: that is the established sentinel meaning "this symbol is the
context parameter, read it from func.args[0]" (see
VmlinuxHandler.handle_vmlinux_struct_field). Metadata holds the
annotated Python type, mirroring the vmlinux branch.
Teach the consumer side accordingly: get_or_create_ptr_from_arg now
recognises the sentinel and hands back the function's first argument
instead of an alloca. The special case lives at the call site rather
than inside get_var_ptr_from_name so that helper stays a pure symbol
table lookup -- the call site already has `func` and `builder` in scope,
and get_var_ptr_from_name has no other callers to update.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com >
2026-08-07 04:38:49 +05:30
3396d84e26
Core: Fix incompatible logic in helper/helper_utils
2026-03-28 19:58:26 +05:30
c22911daaf
Core: FIx inconsistent compilation_context usage in helper/printk_formatter
2026-03-28 19:02:16 +05:30
ec4a6852ec
PythonBPF: Add Compilation Context to allow parallel compilation of multiple bpf programs
2026-02-21 18:59:33 +05:30
8ad5fb8a3a
Janitorial: Remove useless comments
2025-11-23 06:29:44 +05:30
cbe365d760
Unify struct and pointer to struct handling, abstract null check in ir_ops
2025-11-23 06:26:09 +05:30
df981be095
Janitorial format
2025-11-11 21:08:06 +05:30
316c21c428
Fix char_array to pointer/int detection fallback in helper_utils
2025-11-11 21:00:42 +05:30
6c85b248ce
Init sz in get_or_create_ptr_from_arg
2025-11-07 19:03:21 +05:30
b5a3494cc6
Fix typo in get_or_create_ptr_from_arg
2025-11-07 19:01:40 +05:30
be62972974
Fix ScratchPoolManager::counter
2025-11-07 19:00:57 +05:30
2f4a7d2f90
Remove get_struct_char_array_ptr in favour of get_char_array_ptr_and_size, wrap it in get_or_crate_ptr_from_arg to use in bpf_helper_handler
2025-11-07 18:54:59 +05:30
2e37726922
Add signature relection for all helper handlers except print
2025-11-06 19:47:57 +05:30
3e6cea2b67
Move get_struct_char_array_ptr from helper/printk_formatter to helper/helper_utils, enable array to ptr conversion in skb_store_bytes
2025-11-05 19:10:58 +05:30
7d29790f00
Make use of new get_next_temp in helpers
2025-11-04 16:02:56 +05:30
963e2a8171
Change ScratchPoolManager to use typed scratch space
2025-11-04 14:16:44 +05:30
2257c175ed
Implement BPF_PROBE_READ helper
2025-11-01 13:14:50 +05:30
f9494c870b
Fix logical fallacy in get_char_array_ptr_and_size
2025-10-22 04:01:45 +05:30
009b11aca6
Implement bpf_probe_read_kernel_str helper, Allow i8* to i8 ArrayType conversion
2025-10-15 23:52:15 +05:30
13a804f7ac
Implement bpf_get_current_comm_emitter
2025-10-15 14:03:09 +05:30
6b41f1fb84
Move print logic to helper/printk_emitter.py
2025-10-13 18:32:51 +05:30
74d8014ade
Move HelperHandlerRegistry to helper_registry.py
2025-10-13 18:21:50 +05:30
158cc42e1e
Move binop handling logic to expr_pass, remove delayed imports of get_operand_value
2025-10-13 00:36:42 +05:30
e8026a13bf
Allow helpers to be called within themselves
2025-10-12 09:30:37 +05:30
2cf68f6473
Allow map-based helpers to be used as helper args / within binops which are helper args
2025-10-12 07:57:55 +05:30
d66e6a6aff
Allow struct members as helper args
2025-10-12 06:00:50 +05:30
cd74e896cf
Allow binops as args to helpers accepting int*
2025-10-12 04:20:46 +05:30
207f714027
Use scratch space to store consts passed to helpers
2025-10-12 04:17:37 +05:30
5dcf670f49
Add ScratchPoolManager and it's singleton
2025-10-12 01:47:11 +05:30
9febadffd3
Add pointer handling to helper_utils, finish pointer assignment
2025-10-10 15:01:15 +05:30
5f9eaff59c
Fix expr imports
2025-10-08 06:49:34 +05:30
86b9ec56d7
update formatter and pre-commit
...
Signed-off-by: varun-r-mallya <varunrmallya@gmail.com >
2025-10-02 22:43:05 +05:30
12ba3605e9
Fix local_sym_tab usage in helpers
2025-10-02 04:53:04 +05:30
9223d7b5c5
Remove local_var_metadata from helpers
2025-10-02 04:40:44 +05:30
23f3cbcea7
add type annotations
2025-10-02 01:43:05 +05:30
59b3d6514b
fix ruff errors
2025-10-02 01:23:55 +05:30
81807ace34
Fix simple_string_print docstring
2025-10-01 23:59:07 +05:30
690ff7ffbc
Remove unnecessary prints
2025-10-01 23:57:22 +05:30
9099b3eaec
Replace logger.warn with logger.warning
2025-10-01 23:55:16 +05:30
cecf45061c
Fix line length nitpicks
2025-10-01 23:51:25 +05:30
929eef31ef
Add has_handler to HelperHandlerRegistry
2025-10-01 23:38:38 +05:30
4f33db206c
Refactor bpf_perf_event_output_emitter
2025-10-01 22:49:50 +05:30
6ccbab402f
Complete printk refactor
2025-10-01 22:12:30 +05:30
7b01f1dde3
Complete helpers for fstrings in helper_utils
2025-10-01 21:43:11 +05:30
17f60d721b
Add _process_*_in_fval to helper_utils
2025-10-01 20:26:18 +05:30
d18c69fae1
Add _handle_fstring_print scaffolding
2025-10-01 19:56:20 +05:30
18f164bdec
Add get_flags_val to helper_utils
2025-10-01 18:35:11 +05:30
ffcd2de44d
Replace usage of get_key_ptr with get_or_create_ptr_from_arg
2025-10-01 18:25:22 +05:30
8dd2746411
rename get_key_ptr to get_or_create_ptr_from_arg
2025-10-01 18:21:42 +05:30
d2e0f17ca8
Use key_arg instead of call in get_key_ptr
2025-10-01 18:14:09 +05:30