fix(ebpf): correct logical operator bugs in protocol_inference.h#11510
Open
kalakotima wants to merge 2 commits intodeepflowio:mainfrom
Open
fix(ebpf): correct logical operator bugs in protocol_inference.h#11510kalakotima wants to merge 2 commits intodeepflowio:mainfrom
kalakotima wants to merge 2 commits intodeepflowio:mainfrom
Conversation
Signed-off-by: kalakotima@gmail.com <manojreddy@Manojs-MacBook-Air.local>
|
kalakotima@gmail.com seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Signed-off-by: kalakotima@gmail.com <manojreddy@Manojs-MacBook-Air.local> Signed-off-by: kalakotima@gmail.com <kalakotima@gmail.com>
cfde1e4 to
29ea989
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR fixes multiple critical logical operator bugs in
agent/src/ebpf/kernel/include/protocol_inference.hthat affectprotocol identification for HTTP/1.x, PostgreSQL, ISO8583, Redis,
and NATS protocols.
Root Cause
Several functions contained two categories of operator errors:
These errors cause silent logic failures — the eBPF program loads
and runs but produces "wrong protocol inference results" at runtime.
The following bugs were identified and fixed:
__protocol_port_check(): comma operator ',' used instead of '||'
in the L7_PROTO_INFER_PROG_1 branch, causing the first
is_set_bitmap() result to be silently discarded, leading to
incorrect port-based protocol filtering.
is_http_request(): array close bracket ']' used instead of '||'
combined with proper array indexing 'data[N]' across all HTTP
method checks (DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT),
breaking all multi-character method validation.
infer_pgsql_startup_message(): array close bracket ']' used
instead of '||' in the "user" string validation check for
buf[8..11], breaking PostgreSQL startup message detection.
infer_iso8583_message(): array close bracket ']' used instead
of '||' in CUPS header flag checks and buffer content validation,
breaking ISO8583 protocol identification entirely.
infer_redis_message(): array close bracket ']' used instead of
'||' in the error prefix validation (buf[2] check), causing
valid Redis error responses to be incorrectly dropped.
infer_nats_message(): array close bracket ']' used instead of
'||' in the CRLF terminator check, causing all NATS protocol
messages to be rejected during initial socket inference.
These bugs collectively affect HTTP/1.x, PostgreSQL, ISO8583, Redis,
and NATS protocol inference, causing silent misidentification or
complete failure to detect these protocols in production environments.