-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add the "Prefix" operator for the "matchBinaries" selector #1278
Comments
I would also request adding support for
|
So I spent some time on this in the light of #1408. I think this is doable against a bit of work. This PR by Anastasios explains how matchBinaries work in details #774 (comment). But the tl;dr is that we need to retrieve the binary path at the exec stage and we need to transmit that information for later when the kprobe hits. As of now, we don't transmit the whole string of the binary from the execve stage to the kprobe matchBinaries but only an index because it's more efficient. This means that during the kprobe matchBinaries BPF code we only know yes or no if we matched but not really on what (since we don't have the string but only an ID). Regarding #1408, prefix old implementation needed the string, and was slow because we parsed the whole potential strings byte by byte to see if we had a match. The new implementation uses LPM_TRIE which is optimized for this but needs to be populated at map load time in userspace. We could do that in a new implementation but we would need the value, again, at the kprobe matchBinaries to perform the lookup into the trie. Here's what I proposed and may implement: In a new design, we could keep the old implem which is very efficient for Then in the case of execve = event_find_curr(&ppid, &walker);
if (!execve)
return 0;
trace_printk("%d", execve->process);
bin_key = execve->binary; We could still check if the pointer is NULL or not for |
Is there an existing issue for this?
Is your feature request related to a problem?
I would like to forbid network usage for every binaries in a specific folder. For example, binaries in
~/bin-no-network/
should not be able to create socket. This can be done with the following TracingPolicy:But we need to list every binary in this folder and keep this list up-to-date.
Describe the feature you would like
I can be nice to use the "Prefix" operator for this use-case but only "In" and "NotIn" operators are currently implemented
With this new feature, the TracingPolicy should look like :
Describe your proposed solution
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: