Issue
I am trying to modify the behaviour of a function from a shared library during runtime using eBPF uprobes. Is there any way to change a const char* parameter of the function when the function is called?
Solution
Is there any way to change a const char* parameter of the function when the function is called?
The const
qualifier is for the compiler; it doesn't impact how you can instrument the code at runtime.
You can write such parameters with the bpf_probe_write_user
BPF helper. See samples/bpf/test_probe_write_user.bpf.c
for a usage example of that helper (with kprobes but the principle should be the same for uprobes).
Answered By - pchaigno Answer Checked By - Willingham (WPSolving Volunteer)