Commit a2d100e
[S597085][antlir2][isolate] fallback to bind-mounting /proc
Summary:
If we get an `EPERM` while mounting `/proc`, try to fall back to a bind mount.
A small number of RPM scriptlets might choke on this, but this will give the
build a better chance of succeeding.
Test Plan:
```name="Happy path where new /proc works"
❯ buck2 test fbcode//antlir/antlir2/features/rpm/...
Buck UI: https://www.internalfb.com/buck2/8114d14c-ada3-49e2-8596-bc048b4a369e
Test UI: https://www.internalfb.com/intern/testinfra/testrun/9851624322928450
Tests finished: Pass 67. Fail 0. Fatal 0. Skip 0. Omit 0. Infra Failure 0. Build failure 0
```
Since I can't reproduce the `EPERM` failure mode on my devserver, just change
the code to pretend that it failed:
```
❯ hg diff
diff --git a/fbcode/antlir/antlir2/antlir2_isolate/isolate_unshare/isolate_unshare_preexec/src/isolation.rs b/fbcode/antlir/antlir2/antlir2_isolate/isolate_unshare/isolate_unshare_preexec/src/isolation.rs
--- a/fbcode/antlir/antlir2/antlir2_isolate/isolate_unshare/isolate_unshare_preexec/src/isolation.rs
+++ b/fbcode/antlir/antlir2/antlir2_isolate/isolate_unshare/isolate_unshare_preexec/src/isolation.rs
@@ -334,27 +334,27 @@
Err(e) => Err(e),
}?;
- match nix::mount::mount(
- None::<&str>,
+ // match nix::mount::mount(
+ // None::<&str>,
+ // &newroot.open_dir("proc")?.abspath(),
+ // Some("proc"),
+ // MsFlags::MS_NOSUID | MsFlags::MS_NOEXEC | MsFlags::MS_NODEV,
+ // None::<&str>,
+ // ) {
+ // Ok(()) => Ok(()),
+ // Err(e) if e == nix::errno::Errno::EPERM => {
+ warn!("got EPERM while mounting /proc - attempting a bind mount instead");
+ mount(
+ Some("/proc"),
&newroot.open_dir("proc")?.abspath(),
- Some("proc"),
- MsFlags::MS_NOSUID | MsFlags::MS_NOEXEC | MsFlags::MS_NODEV,
None::<&str>,
- ) {
- Ok(()) => Ok(()),
- Err(e) if e == nix::errno::Errno::EPERM => {
- warn!("got EPERM while mounting /proc - attempting a bind mount instead");
- mount(
- Some("/proc"),
- &newroot.open_dir("proc")?.abspath(),
- None::<&str>,
- MsFlags::MS_BIND | MsFlags::MS_REC,
- None::<&str>,
- )
- .context("while bind-mounting /proc")
- }
- Err(e) => Err(e).context("while mounting /proc"),
- }?;
+ MsFlags::MS_BIND | MsFlags::MS_REC,
+ None::<&str>,
+ )
+ .context("while bind-mounting /proc")?;
+ // }
+ // Err(e) => Err(e).context("while mounting /proc"),
+ // }?;
nix::unistd::chroot(&newroot.abspath())?;
if let Some(wd) = working_directory {
❯ buck2 test fbcode//antlir/antlir2/features/rpm/...
Buck UI: https://www.internalfb.com/buck2/bb147ef3-a7dd-4180-8e7f-b7aebf135cb0
Test UI: https://www.internalfb.com/intern/testinfra/testrun/15762598833571210
Tests finished: Pass 67. Fail 0. Fatal 0. Skip 0. Omit 0. Infra Failure 0. Build failure 0
```
Reviewed By: vjt
Differential Revision: D89734817
fbshipit-source-id: 2c9f94d7b471f6f74534c41f935d27659a1d8dff1 parent 9899a02 commit a2d100e
File tree
3 files changed
+23
-3
lines changed3 files changed
+23
-3
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
Lines changed: 18 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
332 | 333 | | |
333 | 334 | | |
334 | 335 | | |
335 | | - | |
| 336 | + | |
| 337 | + | |
336 | 338 | | |
337 | 339 | | |
338 | 340 | | |
339 | 341 | | |
340 | 342 | | |
341 | | - | |
342 | | - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
343 | 358 | | |
344 | 359 | | |
345 | 360 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
0 commit comments