mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 20:19:07 +00:00
arch: Clone minijail instead of re-using for serial
Reusing struct minijail for multiple forked children isn't supported and was only accidentally functional. The new minijail fixed that bug and now the jails must be explicitly cloned to be reused. BUG=b:187741537 TEST=CQ passes Cq-Depend: chromium:2850757 Change-Id: I986223c7089ded4a9a55e666a13663a625d760b5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2889652 Reviewed-by: Allen Webb <allenwebb@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Allen Webb <allenwebb@google.com>
This commit is contained in:
parent
3a5178e3b2
commit
a51b1bfe1b
2 changed files with 11 additions and 2 deletions
|
@ -246,6 +246,8 @@ pub enum DeviceRegistrationError {
|
|||
AllocateDeviceAddrs(PciDeviceError),
|
||||
/// Could not allocate an IRQ number.
|
||||
AllocateIrq,
|
||||
/// Unable to clone a jail for the device.
|
||||
CloneJail(minijail::Error),
|
||||
// Unable to create a pipe.
|
||||
CreatePipe(base::Error),
|
||||
// Unable to create serial device from serial parameters
|
||||
|
@ -287,6 +289,7 @@ impl Display for DeviceRegistrationError {
|
|||
AllocateIoResource(e) => write!(f, "Allocating IO resource: {}", e),
|
||||
AllocateDeviceAddrs(e) => write!(f, "Allocating device addresses: {}", e),
|
||||
AllocateIrq => write!(f, "Allocating IRQ number"),
|
||||
CloneJail(e) => write!(f, "failed to clone jail: {}", e),
|
||||
CreatePipe(e) => write!(f, "failed to create pipe: {}", e),
|
||||
CreateSerialDevice(e) => write!(f, "failed to create serial device: {}", e),
|
||||
CreateTube(e) => write!(f, "failed to create tube: {}", e),
|
||||
|
|
|
@ -437,8 +437,14 @@ pub fn add_serial_devices(
|
|||
match serial_jail.as_ref() {
|
||||
Some(jail) => {
|
||||
let com = Arc::new(Mutex::new(
|
||||
ProxyDevice::new(com, &jail, preserved_fds)
|
||||
.map_err(DeviceRegistrationError::ProxyDeviceCreation)?,
|
||||
ProxyDevice::new(
|
||||
com,
|
||||
&jail
|
||||
.try_clone()
|
||||
.map_err(DeviceRegistrationError::CloneJail)?,
|
||||
preserved_fds,
|
||||
)
|
||||
.map_err(DeviceRegistrationError::ProxyDeviceCreation)?,
|
||||
));
|
||||
io_bus
|
||||
.insert(com.clone(), SERIAL_ADDR[x as usize], 0x8)
|
||||
|
|
Loading…
Reference in a new issue