-
Notifications
You must be signed in to change notification settings - Fork 384
Description
Description
Running dotnet-dump in a Linux Docker container appears to always require SYS_PTRACE capability to collect dumps now and fails with 0x80004005 without it.
Regression?
Yes. Using dotnet-dump to collect dumps in Linux containers generally worked without any elevated privileges when running on .NET Core 3.1. On .NET 5, however, dump collection fails without SYS_PTRACE.
Other information
Repro steps:
- On a Win10 dev machine running Docker Desktop targeting Linux containers.
- Create a new .NET 5 ASP.NET Core WebAPI from a new-project template and add a Dockerfile with VS’s right-click “add Dockerfile” option.
- Build the Docker image
- docker build -t mjrousos/dockertest:latest -f Dockerfile ..
- Run the Docker container
- docker run -d --rm mjrousos/dockertest:latest
- Exec into the container
- docker exec -it f273 /bin/bash
- Install and run dotnet-dump
- apt-get update
- apt-get install curl
- curl -L https://aka.ms/dotnet-dump/linux-x64 -o dotnet-dump
- chmod +x ./dotnet-dump
- ./dotnet-dump ps
- 1 dotnet /usr/share/dotnet/dotnet
- ./dotnet-dump collect -p 1
- Writing full to /app/core_20210317_144707
- Writing dump failed (HRESULT: 0x80004005)
--Diag output looks good at first, but concludes with this error:
EnumerateElfInfo: phdr 0x5586152a5040 phnum 10
ERROR: ReadMemory(0x5586152a5040, 38) phdr FAILED
If I retarget my app and Dockerfile to netcoreapp3.1, though, the exact same steps work great and I get a dump
Repro code
I've pushed a sample solution to mjrousos/DockerDotnetDumpRepro. In its current state, dotnet-dump fails but after retargeting the csproj and Dockerfile to .NET Core 3.1, dotnet-dump succeeds. Also, a sample Docker image (targeting .NET 5) is available on Dockerhub as mjrousos/dockertest:latest.