mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2026-12-06 01:48:35 +00:00
Without a LICENSE, @llvm.compiler.used still named one, and opt stopped on "use of undefined value @LICENSE". A program with no LICENSE now gets "GPL", the kernel's own license, and a warning that says so; an explicit LICENSE is emitted as written. The old failing license test becomes passing_tests/license_default.py: it calls print, which lowers to the GPL-only bpf_trace_printk, so the verifier accepts it only if the default reaches the kernel. license_non_gpl.py is the counterpart, a verifier-level negative fixture pinned to the kernel's GPL rejection, and test_license_ir.py checks both license sections and the warning. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
18 lines
441 B
Python
18 lines
441 B
Python
# No LICENSE: the program gets "GPL", with a warning. `print` lowers to
|
|
# bpf_trace_printk, which is GPL-only, so the verifier only accepts this
|
|
# program if the default license reaches the kernel.
|
|
|
|
from pythonbpf import compile, bpf, section
|
|
from ctypes import c_void_p, c_int64
|
|
|
|
|
|
@bpf
|
|
@section("tracepoint/syscalls/sys_enter_getpid")
|
|
def sometag(ctx: c_void_p) -> c_int64:
|
|
a = 1 + 2
|
|
print(f"{a}")
|
|
return c_int64(0)
|
|
|
|
|
|
compile()
|