Repository navigation
fix(modulefinder): handle ENOSYS in read_safely for Kubernetes seccomp - #1654
Closed
HrMathematiker wants to merge 1 commit into
Closed
HrMathematiker wants to merge 1 commit into
HrMathematiker wants to merge 1 commit into
Conversation
Kubernetes RuntimeDefault seccomp profiles block `process_vm_readv` and return ENOSYS (errno=38). The existing fallback only handled EPERM and EINVAL, so every ELF module validation failed silently, leaving `debug_meta.images` empty in manually-captured events and causing all stack frames to show as `unknown_image` in Sentry. Add ENOSYS to the fallback so the memcpy path is taken when the syscall is unavailable, matching the behaviour already in place for EPERM/EINVAL.
Contributor
|
This PR has been automatically closed. All non-maintainer contributions must reference an existing GitHub issue. Next steps:
Please review our contributing guidelines for more details. |
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.
Fixes #1653.
Problem
When running under Kubernetes with the default
RuntimeDefaultseccomp profile,process_vm_readvis blocked and returnsENOSYS(errno 38). The existing fallback inread_safely()only handlesEPERMandEINVAL, so every ELF module validation fails silently.The result:
sentry_get_modules_list()returns 0 modules,debug_meta.imagesis absent from manually-captured events, and every stack frame shows asunknown_imagein Sentry — even when debug symbols have been uploaded correctly.When does this happen?
RuntimeDefaultseccomp profileEPERM, already handled)Crash events via crashpad are not affected because the out-of-process handler enumerates modules from
/proc/<pid>/mapsdirectly, independent ofsentry_get_modules_list().Root cause
read_safely()insentry_modulefinder_linux.c:Verification
Confirmed with a static test binary copied into a real K8s pod (Flatcar Linux, kernel 6.12,
Seccomp: 2):Also reproduced locally using Docker with a custom seccomp profile (
SCMP_ACT_ERRNO/errnoRet: 38) — the original code fails, the patched code falls back tomemcpyand succeeds.Fix
One-liner: add
|| errno == ENOSYSto the existing errno fallback. The address is valid in-process memory, somemcpyis safe.