Skip to content

OpenExecutable permission check prevents uprobe attachment to shared libraries without execute bit #1964

@isubuz

Description

@isubuz

Describe the bug

OpenExecutable in v0.21.0 rejects files without the execute permission bit:

if info.Mode()&permExec == 0 {
    return nil, fmt.Errorf("file %s is not executable", path)
}

This breaks uprobe attachment to shared libraries that don't have +x. A common case is pip-installed CUDA libraries (e.g. libcudart.so.12) which ship with 0644 permissions.

PR #1938 moved ELF type validation into address() so that callers providing UprobeOptions.Address can skip it entirely, but the permExec check in OpenExecutable runs before Uprobe() is ever called, so the lazy validation is unreachable for these files.

Removing the permission check would match the intent described in #1938.

Or am I missing something?

How to reproduce

Calling link.OpenExecutable(<path to .so file w/o +x>)

Version information

github.com/cilium/ebpf v0.21.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions