From the 'language features' brainstorm: # Loading kernel_string(addr) or user_string(addr) onto the stack offset = 80 unrolled loop { *(u64 *)(r10-offset) = *(u64 *)addr addr += 8; offset -= 8 } until '\0' encountered or BPF_MAXSTRINGLEN bytes copied /* loading kernel_string(addr) or user_string(addr) into an eBPF map is similar */
kernel_string() has been implemented using the newly merged experimental eBPF embedded-code assembler. The assembler is a bit raw for a user-facing feature, but should work well for implementing further eBPF tapsets. There is no bpf_probe_read_user or bpf_probe_read_str user helper for implementing user_string() at the moment. Hence closing the PR as further work would require upstream kernel cooperation in adding the helper. (Interestingly, there is a bpf_probe_write_user() helper.)