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

improv: make errors more conclusive #1071

Merged
merged 1 commit into from
Jul 13, 2023

Conversation

kwakubiney
Copy link
Member

Fixes #891

@kwakubiney kwakubiney force-pushed the improv/make-errors-more-conclusive branch from 27a9b8f to 5ef8223 Compare June 22, 2023 15:08
@kwakubiney kwakubiney changed the title Improv: make errors more conclusive improv: make errors more conclusive Jun 22, 2023
Copy link
Collaborator

@lmb lmb left a comment

Choose a reason for hiding this comment

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

Looks nice, thanks for your PR! Left some comments, nothing major.

link/syscalls.go Outdated Show resolved Hide resolved
link/uprobe.go Outdated Show resolved Hide resolved
syscalls.go Outdated Show resolved Hide resolved
syscalls.go Outdated Show resolved Hide resolved
link/syscalls.go Outdated
@@ -47,10 +47,6 @@ var haveProgAttach = internal.NewFeatureTest("BPF_PROG_ATTACH", "4.10", func() e
})

var haveProgAttachReplace = internal.NewFeatureTest("BPF_PROG_ATTACH atomic replacement of MULTI progs", "5.5", func() error {
if err := haveProgAttach(); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ah, this is an interesting case. Here we have to call haveProgAttach first since it establishes a pre-condition for the feature test to be successful. If I remember correctly it's so that we can reliably get EBADF from the syscall below.

So I think this needs to stay where it is.

Copy link
Member Author

@kwakubiney kwakubiney Jun 28, 2023

Choose a reason for hiding this comment

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

I might have to dig into the why myself.

link/syscalls.go Outdated Show resolved Hide resolved
map.go Show resolved Hide resolved
@kwakubiney kwakubiney force-pushed the improv/make-errors-more-conclusive branch from 5647c44 to fe0b65a Compare July 3, 2023 18:42
@lmb
Copy link
Collaborator

lmb commented Jul 4, 2023

@lmb
Copy link
Collaborator

lmb commented Jul 4, 2023

link/syscalls.go Outdated
@@ -60,9 +60,11 @@ var haveProgAttachReplace = internal.NewFeatureTest("BPF_PROG_ATTACH atomic repl
asm.Return(),
},
})
if err != nil {

if errors.Is(err, unix.EINVAL) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You want to keep this change after all?

Copy link
Member Author

Choose a reason for hiding this comment

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

Snap, missed it when I was making the changes.

link/uprobe.go Outdated Show resolved Hide resolved
syscalls.go Outdated
@@ -87,9 +87,11 @@ var haveMapMutabilityModifiers = internal.NewFeatureTest("read- and write-only m
MaxEntries: 1,
MapFlags: unix.BPF_F_RDONLY_PROG,
})

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: gratuitous whitespace change. It's fine to change whitespace to your preference when you're editing a function anyways, but this just increases the diff.

syscalls.go Outdated
if err != nil {
return internal.ErrNotSupported
if errors.Is(err, unix.EINVAL) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto, do you want to keep EINVAL here after all?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

syscalls.go Show resolved Hide resolved
Copy link
Collaborator

@lmb lmb left a comment

Choose a reason for hiding this comment

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

Thanks for the update and sorry for the long delay. We currently have planning seesisons going on, and last week was really busy with trying to get the release out.

One final question, then we're good to go.

link/syscalls.go Show resolved Hide resolved
@kwakubiney kwakubiney requested a review from lmb July 12, 2023 10:59
Copy link
Collaborator

@lmb lmb left a comment

Choose a reason for hiding this comment

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

Thanks! Can you squash the commits please?

@kwakubiney kwakubiney force-pushed the improv/make-errors-more-conclusive branch 2 times, most recently from d8d8ece to db050b2 Compare July 12, 2023 17:09
Signed-off-by: kwakubiney <kebiney@hotmail.com>
@kwakubiney kwakubiney force-pushed the improv/make-errors-more-conclusive branch from db050b2 to 5c7f000 Compare July 12, 2023 17:10
@lmb lmb merged commit 02200f5 into cilium:main Jul 13, 2023
1 check passed
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.

haveXYZ feature probes are inconclusive
2 participants