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

link: (u|k)probe: don't treat EINVAL as os.ErrNotExist #751

Merged
merged 2 commits into from Jul 29, 2022

Commits on Jul 29, 2022

  1. link: don't treat EINVAL from perf_event_open as ENOENT

    Running TestUprobeExtWithOpts on arm64 currently gives a weird error:
    
        uprobe_test.go:101: creating perf_uprobe PMU: symbol 'open+0x1' not found: file does not exist
    
    Investigating via strace shows that perf_event_open returns EINVAL:
    
        perf_event_open({type=0x7 /* PERF_TYPE_??? */, size=PERF_ATTR_SIZE_VER1, ...}, -1, 0, -1, PERF_FLAG_FD_CLOEXEC) = -1 EINVAL (Invalid argument)
    
    We map this to ENOENT since older kernels don't return a useful error
    when the target function doesn't exist. The example above shows that this is
    too broad.
    
    Stop mapping EINVAL to ENOENT.
    
    Co-authored-by: Timo Beckers <timo@isovalent.com>
    lmb and ti-mo committed Jul 29, 2022
    Copy the full SHA
    9bd82c7 View commit details
    Browse the repository at this point in the history
  2. link: sync PMU and tracefs error strings

    The tracefs probes have used a 'token' to represent their ksym:offset
    tuples for some time, but PMUs take those values as separate fields
    in the syscall. This commit harmonizes the two, making errors more consistent
    across both APIs.
    
    Also makes sure the token is included in all errors, regardless of the type.
    
    Signed-off-by: Timo Beckers <timo@isovalent.com>
    ti-mo committed Jul 29, 2022
    Copy the full SHA
    375841a View commit details
    Browse the repository at this point in the history