Skip to content

Commit 68c8cfc

Browse files
authored
fix: disable ptrace capability check for dotnetspy (#1622)
* fix: disable ptrace capability check for dotnetspy * fix: update examples
1 parent 653ee64 commit 68c8cfc

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

examples/dotnet/fast-slow/docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,3 @@ services:
99
- 'server'
1010
app:
1111
build: ''
12-
cap_add:
13-
- SYS_PTRACE

examples/dotnet/web/docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,3 @@ services:
1313
ports:
1414
- '5000:5000'
1515
build: ''
16-
cap_add:
17-
- SYS_PTRACE

pkg/exec/cli_linux.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,17 @@ import (
77
)
88

99
func performOSChecks(spyName string) error {
10-
if disableLinuxChecks {
11-
return nil
12-
}
13-
if spyName == "ebpfspy" {
10+
var err error
11+
switch {
12+
case disableLinuxChecks:
13+
case spyName == "dotnetspy":
14+
case spyName == "ebpfspy":
1415
if !isRoot() {
15-
return errors.New("when using eBPF you're required to run the agent with sudo")
16-
}
17-
} else {
18-
if !caps.HasSysPtraceCap() {
19-
return errors.New("if you're running pyroscope in a Docker container, add --cap-add=sys_ptrace. " +
20-
"See our Docker Guide for more information: https://pyroscope.io/docs/docker-guide")
16+
err = errors.New("when using eBPF you're required to run the agent with sudo")
2117
}
18+
case !caps.HasSysPtraceCap():
19+
err = errors.New("if you're running pyroscope in a Docker container, add --cap-add=sys_ptrace. " +
20+
"See our Docker Guide for more information: https://pyroscope.io/docs/docker-guide")
2221
}
23-
return nil
22+
return err
2423
}

0 commit comments

Comments
 (0)