Skip to content

Commit c0dc97c

Browse files
authored
Merge pull request #958 from ldorau/Add_info_about_the_PTRACE_MODE_ATTACH_REALCREDS_permission
Add info about the `PTRACE_MODE_ATTACH_REALCREDS` permission
2 parents 19bd9fd + dcc1ec1 commit c0dc97c

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

README.md

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,15 @@ OS memory provider supports two types of memory mappings (set by the `visibility
150150
IPC API requires the `UMF_MEM_MAP_SHARED` memory `visibility` mode
151151
(`UMF_RESULT_ERROR_INVALID_ARGUMENT` is returned otherwise).
152152

153+
IPC API uses the file descriptor duplication. It requires using `pidfd_getfd(2)` to obtain
154+
a duplicate of another process's file descriptor (`pidfd_getfd(2)` is supported since Linux 5.6).
155+
Permission to duplicate another process's file descriptor is governed by a ptrace access mode
156+
`PTRACE_MODE_ATTACH_REALCREDS` check (see `ptrace(2)`) that can be changed using
157+
the `/proc/sys/kernel/yama/ptrace_scope` interface in the following way:
158+
```sh
159+
$ sudo bash -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"
160+
```
161+
153162
There are available two mechanisms for the shared memory mapping:
154163
1) a named shared memory object (used if the `shm_name` parameter is not NULL) or
155164
2) an anonymous file descriptor (used if the `shm_name` parameter is NULL)
@@ -162,23 +171,37 @@ An anonymous file descriptor for the shared memory mapping will be created using
162171

163172
##### Requirements
164173

165-
Required packages for tests (Linux-only yet):
174+
IPC API on Linux requires the `PTRACE_MODE_ATTACH_REALCREDS` permission (see `ptrace(2)`)
175+
to duplicate another process's file descriptor (see above).
176+
177+
Packages required for tests (Linux-only yet):
166178
- libnuma-dev
167179

168180
#### Level Zero memory provider
169181

170182
A memory provider that provides memory from L0 device.
171183

184+
IPC API uses the file descriptor duplication. It requires using `pidfd_getfd(2)` to obtain
185+
a duplicate of another process's file descriptor (`pidfd_getfd(2)` is supported since Linux 5.6).
186+
Permission to duplicate another process's file descriptor is governed by a ptrace access mode
187+
`PTRACE_MODE_ATTACH_REALCREDS` check (see `ptrace(2)`) that can be changed using
188+
the `/proc/sys/kernel/yama/ptrace_scope` interface in the following way:
189+
```sh
190+
$ sudo bash -c "echo 0 > /proc/sys/kernel/yama/ptrace_scope"
191+
```
192+
172193
##### Requirements
173194

174195
1) Linux or Windows OS
175196
2) The `UMF_BUILD_LEVEL_ZERO_PROVIDER` option turned `ON` (by default)
197+
3) IPC API on Linux requires the `PTRACE_MODE_ATTACH_REALCREDS` permission (see `ptrace(2)`)
198+
to duplicate another process's file descriptor (see above).
176199

177200
Additionally, required for tests:
178201

179-
3) The `UMF_BUILD_GPU_TESTS` option turned `ON`
180-
4) System with Level Zero compatible GPU
181-
5) Required packages:
202+
4) The `UMF_BUILD_GPU_TESTS` option turned `ON`
203+
5) System with Level Zero compatible GPU
204+
6) Required packages:
182205
- liblevel-zero-dev (Linux) or level-zero-sdk (Windows)
183206

184207
#### DevDax memory provider (Linux only)

0 commit comments

Comments
 (0)