Commit 9ea209f
Fix directfs restore for deleted regular file when read handle is not available
In such a situation, we can not rely on traditional methods (like openHandle())
to open a readable handle. This is because, for directfs to open a handle, it
needs to re-walk the file via the parent using openat(parentFD, name). This
does not work for deleted files, it will fail with ENOENT. runsc gofer works
around this by using /proc/self/fd/ to re-open the control FD in the desired
mode. However, the sentry does not have access to any procfs instance (for
security). See fcbc289 ("runsc: umount /proc in the sandbox namespace").
This change makes directfs just use the control FD to fetch file data. The
control FD should not be used for IO. We make an exception here for S/R.
Fixes #11903
PiperOrigin-RevId: 7850379821 parent d7830d9 commit 9ea209f
File tree
5 files changed
+71
-20
lines changed- pkg/sentry/fsimpl/gofer
- test/syscalls/linux
5 files changed
+71
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
592 | 624 | | |
593 | 625 | | |
594 | 626 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1971 | 1971 | | |
1972 | 1972 | | |
1973 | 1973 | | |
1974 | | - | |
1975 | | - | |
1976 | | - | |
1977 | | - | |
1978 | | - | |
1979 | | - | |
1980 | | - | |
1981 | | - | |
1982 | | - | |
1983 | | - | |
1984 | 1974 | | |
1985 | 1975 | | |
1986 | 1976 | | |
1987 | 1977 | | |
| 1978 | + | |
1988 | 1979 | | |
1989 | 1980 | | |
1990 | 1981 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
165 | 158 | | |
166 | 159 | | |
167 | 160 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
298 | 332 | | |
299 | 333 | | |
300 | 334 | | |
| |||
0 commit comments