Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socketenricher: Print warning rather than error when problem with kal… #2270

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

eiffel-fl
Copy link
Member

…lsyms.

Fixes: f088401 ("socketenricher: Catch SpecUpdateAddresses() error.")

Copy link
Member

@alban alban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.
1 suggested comment, LGTM after that.

@@ -74,7 +74,7 @@ func (se *SocketEnricher) start() error {

err = kallsyms.SpecUpdateAddresses(specIter, []string{"socket_file_ops"})
if err != nil {
return fmt.Errorf("updating socket_file_ops address with ksyms: %w", err)
log.Warnf("updating socket_file_ops address with ksyms: %v\nThis may result in network related information missing. Possible cause can be lack access of /proc/kallsyms due to CAP_SYSLOG not being set.", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can also be due to a kernel that does not provide the symbol socket_file_ops in /proc/kallsyms because the constant is declared as static.

That's a too long explanation to add in the log.Warnf. But you can add a comment before.

…lsyms.

Fixes: f088401 ("socketenricher: Catch SpecUpdateAddresses() error.")
Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
Copy link
Member

@alban alban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (once the CI is green)

@eiffel-fl
Copy link
Member Author

For the record, here is the problem with v0.23.0:

$ ./kubectl-gadget trace dns -A
INFO[0000] Experimental features enabled                
K8S.NODE          K8S.NAMESPACE     K8S.POD           PID       TID       COMM      QR TYPE      QTYPE     NAME             RCODE    NUM…
^Z
zsh: suspended  ./kubectl-gadget trace dns -A
...
$ ../kubectl logs -n gadget gadget-dj428
...
time="2023-12-05T10:26:32Z" level=info msg="OS detected: Buildroot 2021.02.12"
time="2023-12-05T10:26:32Z" level=info msg="Kernel detected: 5.10.57"
time="2023-12-05T10:26:32Z" level=info msg="Gadget Image: ghcr.io/inspektor-gadget/inspektor-gadget:v0.23.0"
...
time="2023-12-05T10:26:32Z" level=info msg="Gadget Image: ghcr.io/inspektor-gadget/inspektor-gadget:v0.23.0"

And with this commit, everything is OK:

$ ./kubectl-gadget trace dns -A
INFO[0000] Experimental features enabled                
K8S.NODE          K8S.NAMESPACE     K8S.POD           PID       TID       COMM      QR TYPE      QTYPE     NAME             RCODE    NUM…
^Z
zsh: suspended  ./kubectl-gadget trace dns -A
$ ../kubectl logs -n gadget gadget-8wmhf
time="2023-12-05T10:34:45Z" level=info msg="OS detected: Buildroot 2021.02.12"
time="2023-12-05T10:34:45Z" level=info msg="Kernel detected: 5.10.57"
time="2023-12-05T10:34:45Z" level=info msg="Gadget Image: francis/gadget:francis-fix-kallsyms"
...
time="2023-12-05T10:34:51Z" level=warning msg="updating socket_file_ops address with ksyms: file does not exist\nEither you cannot access /proc/kallsyms or this file does not contain socket_file_ops"
...
$ bg
[1]  + continued  ./kubectl-gadget trace dns -A
$ ../kubectl run test-pod --image debian -- sleep inf       francis/fix-kallsyms *% u=
pod/test-pod created
francis@pwmachine:~/Codes/kinvolk/inspektor-gadget$ minikube                                              919       1125      dockerd   Q  OUTGOING  AAAA      registry-1.dock…          0   
minikube                                              919       1514      dockerd   Q  OUTGOING  A         registry-1.dock…          0   
minikube                                              919       1125      dockerd   R  HOST      AAAA      registry-1.dock… NoError  3   
minikube                                              919       1514      dockerd   R  HOST      A         registry-1.dock… NoError  3   
minikube                                              919       1125      dockerd   Q  OUTGOING  A         auth.docker.io.           0   

@alban
Copy link
Member

alban commented Dec 5, 2023

Issue #2268

@eiffel-fl eiffel-fl merged commit e9fbb95 into main Dec 5, 2023
50 checks passed
@eiffel-fl eiffel-fl deleted the francis/fix-kallsyms branch December 5, 2023 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants