Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: fix duplicated devices requested to the agent #9624

Merged
merged 1 commit into from
May 22, 2024

Conversation

cncal
Copy link
Contributor

@cncal cncal commented May 12, 2024

By default, when a container is created with the --privileged flag, all devices in /dev from the host are mounted into the guest. If there is a block device(e.g. /dev/dm) followed by a generic device(e.g. /dev/null),two identical block devices(/dev/dm) would be requested to the kata agent causing the agent to exit with error:

Conflicting device updates for /dev/dm-2

As the generic device type does not hit any cases defined in switch, the variable kataDevice which is defined outside of the loop is still the value of the previous block device rather than nil. Defining kataDevice in the loop fixes this bug.

By default, when a container is created with the `--privileged` flag,
all devices in `/dev` from the host are mounted into the guest. If
there is a block device(e.g. `/dev/dm`) followed by a generic
device(e.g. `/dev/null`),two identical block devices(`/dev/dm`)
would be requested to the kata agent causing the agent to exit with error:

> Conflicting device updates for /dev/dm-2

As the generic device type does not hit any cases defined in `switch`,
the variable `kataDevice` which is defined outside of the loop is still
the value of the previous block device rather than `nil`. Defining `kataDevice`
in the loop fixes this bug.

Signed-off-by: cncal <flycalvin@qq.com>
@katacontainersbot katacontainersbot added the size/small Small and simple task label May 12, 2024
Copy link
Member

@lifupan lifupan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks!

@gkurz
Copy link
Member

gkurz commented May 14, 2024

/test

Copy link
Member

@beraldoleal beraldoleal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@Apokleos Apokleos merged commit b7af00b into kata-containers:main May 22, 2024
296 of 309 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test size/small Small and simple task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants