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

program: block SIGPROF during BPF_PROG_RUN #887

Merged
merged 2 commits into from
Dec 13, 2022
Merged

Conversation

lmb
Copy link
Collaborator

@lmb lmb commented Dec 12, 2022

Extend the profiler blocking we introduced for BPF_PROG_LOAD to BPF_PROG_RUN, with the difference that EINTR is not handled in the syscall wrapper itself. This allows us to have PROG_RUN specific retry logic.

Deprecate RunOptions.Reset since its main motivation was to account for profiler skew. Interruptions from the runtime are only possible via runtime.AllThreadSyscall, which is very specialised anyways. This doesn't protect from interruptions due to signals that are being sent from "outside" the process, which will still skew results and cause retries.

Document that RunOptions.Repeat is a lower bound for how often a program is run due to the retry behaviour. Also add a workaround that makes the common case of repeat == 1 not suffer from interruptions.

Fixes #853

@lmb lmb requested a review from ti-mo December 12, 2022 11:40
Copy link
Collaborator

@ti-mo ti-mo left a comment

Choose a reason for hiding this comment

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

Thanks, split the testRun rename into another commit, please. 🙏

prog.go Outdated Show resolved Hide resolved
internal/sys/syscall.go Show resolved Hide resolved
prog.go Outdated Show resolved Hide resolved
prog.go Show resolved Hide resolved
@lmb lmb force-pushed the prog-run-signals branch from 1bc39e8 to 18135d1 Compare December 12, 2022 14:39
prog.go Show resolved Hide resolved
lmb added 2 commits December 13, 2022 11:04
Extend the profiler blocking we introduced for BPF_PROG_LOAD to
BPF_PROG_RUN, with the difference that EINTR is not handled in the
syscall wrapper itself. This allows us to have PROG_RUN specific
retry logic.

Deprecate RunOptions.Reset since its main motivation was to
account for profiler skew. Interruptions from the runtime are only
possible via runtime.AllThreadSyscall, which is very specialised
anyways. This doesn't protect from interruptions due to signals
that are being sent from "outside" the process, which will still
skew results and cause retries.

Document that RunOptions.Repeat is a lower bound for how often
a program is run due to the retry behaviour. Also add a
workaround that makes the common case of repeat == 1 not suffer
from interruptions.

Fixes cilium#853
The BPF command is now called BPF_PROG_RUN, rename testRun to reflect this.
@lmb lmb force-pushed the prog-run-signals branch from 18135d1 to 3b78939 Compare December 13, 2022 11:05
@lmb lmb requested a review from ti-mo December 13, 2022 11:05
@ti-mo ti-mo merged commit 2943faa into cilium:master Dec 13, 2022
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.

how to deal with syscall interruption due to (runtime) signals
2 participants