Skip to content

Commit

Permalink
Do not require ptrace any more
Browse files Browse the repository at this point in the history
  • Loading branch information
mildred committed Dec 14, 2023
1 parent d7eeb8d commit 657a987
Show file tree
Hide file tree
Showing 3 changed files with 216 additions and 148 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ Under the hood, it works in two ways:

It uses `SECCOMP_RET_USER_NOTIF` which is only available on recent kernels.

- if systemd socket activation is needed, then it uses seccomp in combinaison
with ptrace and when a `bind()` system call is detected, then the process is
stopped and ptrace is used to alter the process. The system call registers are
dumped and if the address bound matches a pattern:
If systemd socket activation is needed, then it uses
`SECCOMP_IOCTL_NOTIF_ADDFD` which is even newer.

- if `-p` flag is specified, then it uses seccomp in combinaison with ptrace and
when a `bind()` system call is detected, then the process is stopped and
ptrace is used to alter the process. The system call registers are dumped and
if the address bound matches a pattern:

- either ptrace is used to replace the address with a replacement address,
just like with seccomp, and the bind system call continues
Expand All @@ -27,10 +30,6 @@ Under the hood, it works in two ways:
call is replaced by the `dup2()` system call and the return value is
altered to return `0` in case of success.

In the future, when `SECCOMP_NOTIFY_IOCTL_ADDFD` will become available, then
ptrace could be entirely replaced by seccomp, including when systemd socket
activation is needed.

This is still a young project. Don't hesitate to report bugs or submit fixes.

Known bugs
Expand Down
Loading

0 comments on commit 657a987

Please sign in to comment.