fix: Use cgroup_skb programs for payload inspection #226
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this change, we were using LSM programs attached to
sock_recvmsg
andsock_sendmsg
hooks for this purpose. We were usingiov_iter
to read the payload.Unfortunately, torvalds/linux@747b1f6 (which landed in kernel 6.4) broke the
iov_iter
API in completely backwards-incompatible way, which can't be handled by any of CO-RE helpers while using aniov_iter
definition from any kernel.Initially, we aimed to handle this incompatibility by introducing a pre-6.4 compat header and trying to cast the types (#198). That seemed to work, but unfortunately, verifiers in 5.x kernels are unhappy about this solution.
Therefore, this change drops the idea of intercepting payloads with LSM all together and instead uses cgroup_skb for the same
purpose. There is no way
__sk_buff
is going to introduce any breaking changes in regards to accessing the packet data.