kata-containers/agent

When updated device resource entries, agent doesn't check device type (character vs. block)

dgibson opened this issue · 3 comments

Description of problem

This bug was seen by code inspection, I haven't reproduced it.

The problem arises when:

  • A block device /dev/b appears in the container's OCI specification
  • A character device /dev/c appears in the container's OCI specification
  • /dev/b and /dev/c coincidentally have the same major:minor numbers in the host
  • At least one of the devices is listed by major:minor in the device resources list

Expected result

Each resource entry is updated with the guest major:minor numbers corresponding to its device.

Actual result

Resources for both /dev/b and /dev/c will be updated with the guest major:minor for whichever device is processed second.

@dgibson How it is possible that two devices on the host have the same major:minor numbers?

/dev/b and /dev/c coincidentally have the same major:minor numbers in the host

@dgibson How it is possible that two devices on the host have the same major:minor numbers?

/dev/b and /dev/c coincidentally have the same major:minor numbers in the host

Because one is a character device and one is a block device. The major:minor numbers for block and character devices are in different address spaces.

Ah, good point Thanks @dgibson