Public bug reported:

Reported by Matthieu Baerts (matttbe) in LP: #2137745.

With virtme-ng, after having modified the init script (e.g. in
/usr/lib/python3/dist-packages/virtme/guest/virtme-init) to have:

  #!/usr/bin/env bash

instead of

  #!/bin/bash

(what vng dev version is using now: https://github.com/arighi/virtme-
ng/pull/480)

With that, the virtualised kernel crashes, because the init script
returned an error:

$ vng -r --no-virtme-ng-init -v
  (...)
  Security violation: Requested utility `env` does not match executable name:
    /usr/libexec/virtiofsd
  [ 1.344090] Kernel panic - not syncing: Attempted to kill init! 
exitcode=0x00000100
  [ 1.344221] CPU: 0 UID: 0 PID: 1 Comm: virtme-init Not tainted 
7.0.0-22-generic #22-Ubuntu PREEMPT(lazy)

(Note that virtiofsd is just an "artifact": if I don't use it with
--force-9p, it will complain about /usr/bin/qemu-system-x86_64)

Switching back to #!/bin/bash, or using gnuenv, or coreutils 0.8.0
binary from upstream fixes the issue.


Reported by fuelrod (danielhodder) in LP: #2137745.

This also breaks multi-arch container builds, where scripts with
`#!/usr/bin/env bash` shebangs run through binfmt/qemu emulation:

```
#277 [linux/arm64 container 28/30] RUN <<'EOF' (#!/usr/bin/env bash...)
#277 8.845 Security violation: Requested utility `env` does not match 
executable name:
#277 8.845 /dev/pipes/EOF
#277 ERROR: process "/dev/.buildkit_qemu_emulator /bin/sh -c /dev/pipes/EOF" 
did not complete successfully: exit code: 1
```

In this case we have a RUN statement that looks like this:

```dockerfile
RUN <<'EOF'
#!/usr/bin/env bash

# Some bash script
EOF
```

That succeeds on the native architecture, but fails when multi-arch
Docker builds are run with the setup documented on
https://docs.docker.com/build/building/multi-platform/. To work around
this in our builds we replaced the rust-coreutils with GNU core utils,

 
Note: Both reports are being caused by this patch: 
https://git.launchpad.net/ubuntu/+source/rust-coreutils/tree/debian/patches/require-utility-to-be-invoked-at-matching-path.patch?h=ubuntu/devel.
 The patch cannot be simply removed because it is required to fix 
vulnerabilities in rust-coreutils dispatch.

** Affects: rust-coreutils (Ubuntu)
     Importance: Medium
         Status: Triaged

** Changed in: rust-coreutils (Ubuntu)
       Status: New => Triaged

** Changed in: rust-coreutils (Ubuntu)
   Importance: Undecided => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2171960

Title:
  require-utility patch breaks env-shebang scripts in VMs

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2171960/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to