Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
devices: Skip floppy drives while passing devices to guest
Browse files Browse the repository at this point in the history
In privileged mode, all host devices are supposed to be passed
to the container in config.json. Skip floppy drives.

Fixes #1551

Signed-off-by: Archana Shinde <[email protected]>
  • Loading branch information
amshinde committed Apr 18, 2019
1 parent 717a30b commit f6b8387
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions virtcontainers/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ var cdromMajors = map[int64]string{
32: "CM206_CDROM_MAJOR",
}

// https://github.com/torvalds/linux/blob/master/include/uapi/linux/major.h
// #define FLOPPY_MAJOR 2
const floppyMajor = int64(2)

// Process gathers data related to a container process.
type Process struct {
// Token is the process execution context ID. It must be
Expand Down Expand Up @@ -603,6 +607,14 @@ func filterDevices(sandbox *Sandbox, c *Container, devices []ContainerDevice) (r
}).Info("Not attach device because it is a CDROM")
continue
}

if major == floppyMajor {
c.Logger().WithFields(logrus.Fields{
"device": dev.ContainerPath,
}).Info("Not attaching device because it is a floppy drive")
continue
}

ret = append(ret, dev)
}
return
Expand Down

0 comments on commit f6b8387

Please sign in to comment.