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

vmm: Explicitly set NetConfig FDs as invalid for (de)serialization #6332

Merged
merged 1 commit into from
Mar 26, 2024

Conversation

likebreath
Copy link
Member

The 'NetConfig' may contain FDs which can't be serialized correctly, as FDs can only be donated from another process via a Unix domain socket with SCM_RIGHTS. To avoid false use of the serialized FDs, this patch explicitly set 'NetConfig' FDs as invalid for (de)serialization.

See: #6286

@likebreath likebreath requested a review from a team as a code owner March 25, 2024 23:58
vmm/src/vm_config.rs Outdated Show resolved Hide resolved
vmm/src/vm_config.rs Outdated Show resolved Hide resolved
vmm/src/vm_config.rs Outdated Show resolved Hide resolved
The 'NetConfig' may contain FDs which can't be serialized correctly, as
FDs can only be donated from another process via a Unix domain socket
with `SCM_RIGHTS`. To avoid false use of the serialized FDs, this patch
explicitly set 'NetConfig' FDs as invalid for (de)serialization.

See: cloud-hypervisor#6286

Signed-off-by: Bo Chen <chen.bo@intel.com>
@likebreath likebreath added this pull request to the merge queue Mar 26, 2024
Merged via the queue into cloud-hypervisor:main with commit 11fa24c Mar 26, 2024
31 checks passed
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request Apr 21, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot operation. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. Hence, added 2 new
parameters 1. net_ids 2. net_fds to 'RestoreConfig'.

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request Apr 21, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot operation. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. Hence, added 2 new
parameters 1. net_ids 2. net_fds to 'RestoreConfig'.

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request Apr 21, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
two new fields to 'RestoreConfig' - 1.net_ids 2.net_fds.
'net_ids' is a list of NetConfig id. 'net_fds' is a list of FDs for
required NetConfigs. These fds are replaced into the fds field of
NetConfig appropriately.

Implement 'validate' for RestoreConfig
Implement exclusive HTTP PutHandler for VmRestore.
Allow net FDs to be sent along with 'restore' in ch-remote

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request Apr 21, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
two new fields to 'RestoreConfig' - 1.net_ids 2.net_fds.
'net_ids' is a list of NetConfig id. 'net_fds' is a list of FDs for
required NetConfigs. These fds are replaced into the fds field of
NetConfig appropriately.

Implement 'validate' for RestoreConfig
Implement exclusive HTTP PutHandler for VmRestore.
Allow net FDs to be sent along with 'restore' in ch-remote

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request Apr 21, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
two new fields to 'RestoreConfig' - 1.net_ids 2.net_fds.
'net_ids' is a list of NetConfig id. 'net_fds' is a list of FDs for
required NetConfigs. These fds are replaced into the fds field of
NetConfig appropriately.

Implement 'validate' for RestoreConfig
Implement exclusive HTTP PutHandler for VmRestore.
Allow net FDs to be sent along with 'restore' in ch-remote

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request Apr 22, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
two new fields to 'RestoreConfig' - 1.net_ids 2.net_fds.
'net_ids' is a list of NetConfig id. 'net_fds' is a list of FDs for
required NetConfigs. These fds are replaced into the fds field of
NetConfig appropriately.

Implement 'validate' for RestoreConfig
Implement exclusive HTTP PutHandler for VmRestore.
Allow net FDs to be sent along with 'restore' in ch-remote

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkaladevi@linux.microsoft.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request Apr 22, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
two new fields to 'RestoreConfig' - 1.net_ids 2.net_fds.
'net_ids' is a list of NetConfig id. 'net_fds' is a list of FDs for
required NetConfigs. These fds are replaced into the fds field of
NetConfig appropriately.

Implement 'validate' for RestoreConfig
Implement exclusive HTTP PutHandler for VmRestore.
Allow net FDs to be sent along with 'restore' in ch-remote

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra Aekkaladevi
<paekkaladevi@linux.microsoft.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request Apr 22, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
two new fields to 'RestoreConfig' - 1.net_ids 2.net_fds.
'net_ids' is a list of NetConfig id. 'net_fds' is a list of FDs for
required NetConfigs. These fds are replaced into the fds field of
NetConfig appropriately.

Implement 'validate' for RestoreConfig
Implement exclusive HTTP PutHandler for VmRestore.
Allow net FDs to be sent along with 'restore' in ch-remote

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request Apr 22, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
two new fields to 'RestoreConfig' - 1.net_ids 2.net_fds.
'net_ids' is a list of NetConfig id. 'net_fds' is a list of FDs for
required NetConfigs. These fds are replaced into the fds field of
NetConfig appropriately.

Implement 'validate' for RestoreConfig
Implement exclusive HTTP PutHandler for VmRestore.
Allow net FDs to be sent along with 'restore' in ch-remote

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request Apr 23, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
two new fields to 'RestoreConfig' - 1.net_ids 2.net_fds.
'net_ids' is a list of NetConfig id. 'net_fds' is a list of FDs for
required NetConfigs. These fds are replaced into the fds field of
NetConfig appropriately.

Implement 'validate' for RestoreConfig
Implement exclusive HTTP PutHandler for VmRestore.
Allow net FDs to be sent along with 'restore' in ch-remote

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request Apr 23, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
two new fields to 'RestoreConfig' - 1.net_ids 2.net_fds.
'net_ids' is a list of NetConfig id. 'net_fds' is a list of FDs for
required NetConfigs. These fds are replaced into the fds field of
NetConfig appropriately.

Implement 'validate' for RestoreConfig
Implement exclusive HTTP PutHandler for VmRestore.
Allow net FDs to be sent along with 'restore' in ch-remote

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request Apr 23, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
two new fields to 'RestoreConfig' - 1.net_ids 2.net_fds.
'net_ids' is a list of NetConfig id. 'net_fds' is a list of FDs for
required NetConfigs. These fds are replaced into the fds field of
NetConfig appropriately.

Implement 'validate' for RestoreConfig
Use vm_action_put_handler_body_with_fds for VmRestore http handler
Allow net FDs to be sent along with 'restore' in ch-remote

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request Apr 24, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
two new fields to 'RestoreConfig' - 1.net_ids 2.net_fds.
'net_ids' is a list of NetConfig id. 'net_fds' is a list of FDs for
required NetConfigs. These fds are replaced into the fds field of
NetConfig appropriately.

Implement 'validate' for RestoreConfig
Use vm_action_put_handler_body_with_fds for VmRestore http handler
Allow net FDs to be sent along with 'restore' in ch-remote

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request May 2, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
new field 'net_fds' to 'RestoreConfig'. The FDs passed using this new
field are replaced into the 'fds' field of NetConfig appropriately.
Also, implement 'validate' fn for RestoreConfig

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request May 2, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
new field 'net_fds' to 'RestoreConfig'. The FDs passed using this new
field are replaced into the 'fds' field of NetConfig appropriately.
Also, implement 'validate' fn for RestoreConfig

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request May 2, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
new field 'net_fds' to 'RestoreConfig'. The FDs passed using this new
field are replaced into the 'fds' field of NetConfig appropriately.
Also, implement 'validate' fn for RestoreConfig

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request May 3, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
new field 'net_fds' to 'RestoreConfig'. The FDs passed using this new
field are replaced into the 'fds' field of NetConfig appropriately.

The 'validate()' function ensures all net devices from 'VmConfig' backed
by FDs have a corresponding 'RestoreNetConfig' with a matched 'id' and
expected number of FDs.

The unit tests provide different inputs to parse and validate functions to
make sure parsing and error handling is as per expectation.

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Co-authored-by: Bo Chen <chen.bo@intel.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request May 3, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
new field 'net_fds' to 'RestoreConfig'. The FDs passed using this new
field are replaced into the 'fds' field of NetConfig appropriately.

The 'validate()' function ensures all net devices from 'VmConfig' backed
by FDs have a corresponding 'RestoreNetConfig' with a matched 'id' and
expected number of FDs.

The unit tests provide different inputs to parse and validate functions
to make sure parsing and error handling is as per expectation.

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Co-authored-by: Bo Chen <chen.bo@intel.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request May 3, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
new field 'net_fds' to 'RestoreConfig'. The FDs passed using this new
field are replaced into the 'fds' field of NetConfig appropriately.

The 'validate()' function ensures all net devices from 'VmConfig' backed
by FDs have a corresponding 'RestoreNetConfig' with a matched 'id' and
expected number of FDs.

The unit tests provide different inputs to parse and validate functions
to make sure parsing and error handling is as per expectation.

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Co-authored-by: Bo Chen <chen.bo@intel.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request May 3, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
new field 'net_fds' to 'RestoreConfig'. The FDs passed using this new
field are replaced into the 'fds' field of NetConfig appropriately.

The 'validate()' function ensures all net devices from 'VmConfig' backed
by FDs have a corresponding 'RestoreNetConfig' with a matched 'id' and
expected number of FDs.

The unit tests provide different inputs to parse and validate functions
to make sure parsing and error handling is as per expectation.

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Co-authored-by: Bo Chen <chen.bo@intel.com>
github-merge-queue bot pushed a commit that referenced this pull request May 7, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: #6332.
So, Restore should support input for the new net FDs. This patch adds
new field 'net_fds' to 'RestoreConfig'. The FDs passed using this new
field are replaced into the 'fds' field of NetConfig appropriately.

The 'validate()' function ensures all net devices from 'VmConfig' backed
by FDs have a corresponding 'RestoreNetConfig' with a matched 'id' and
expected number of FDs.

The unit tests provide different inputs to parse and validate functions
to make sure parsing and error handling is as per expectation.

Fixes: #6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Co-authored-by: Bo Chen <chen.bo@intel.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request May 8, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
new field 'net_fds' to 'RestoreConfig'. The FDs passed using this new
field are replaced into the 'fds' field of NetConfig appropriately.

The 'validate()' function ensures all net devices from 'VmConfig' backed
by FDs have a corresponding 'RestoreNetConfig' with a matched 'id' and
expected number of FDs.

The unit tests provide different inputs to parse and validate functions
to make sure parsing and error handling is as per expectation.

Fixes: cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Co-authored-by: Bo Chen <chen.bo@intel.com>
github-merge-queue bot pushed a commit that referenced this pull request May 9, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: #6332.
So, Restore should support input for the new net FDs. This patch adds
new field 'net_fds' to 'RestoreConfig'. The FDs passed using this new
field are replaced into the 'fds' field of NetConfig appropriately.

The 'validate()' function ensures all net devices from 'VmConfig' backed
by FDs have a corresponding 'RestoreNetConfig' with a matched 'id' and
expected number of FDs.

The unit tests provide different inputs to parse and validate functions
to make sure parsing and error handling is as per expectation.

Fixes: #6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Co-authored-by: Bo Chen <chen.bo@intel.com>
pupacha added a commit to pupacha/cloud-hypervisor that referenced this pull request May 9, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: cloud-hypervisor#6332.
So, Restore should support input for the new net FDs. This patch adds
new field 'net_fds' to 'RestoreConfig'. The FDs passed using this new
field are replaced into the 'fds' field of NetConfig appropriately.

The 'validate()' function ensures all net devices from 'VmConfig' backed
by FDs have a corresponding 'RestoreNetConfig' with a matched 'id' and
expected number of FDs.

The unit tests provide different inputs to parse and validate functions
to make sure parsing and error handling is as per expectation.

Fixes cloud-hypervisor#6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Co-authored-by: Bo Chen <chen.bo@intel.com>
github-merge-queue bot pushed a commit that referenced this pull request May 14, 2024
'NetConfig' FDs, when explicitly passed via SCM_RIGHTS during VM
creation, are marked as invalid during snapshot. See: #6332.
So, Restore should support input for the new net FDs. This patch adds
new field 'net_fds' to 'RestoreConfig'. The FDs passed using this new
field are replaced into the 'fds' field of NetConfig appropriately.

The 'validate()' function ensures all net devices from 'VmConfig' backed
by FDs have a corresponding 'RestoreNetConfig' with a matched 'id' and
expected number of FDs.

The unit tests provide different inputs to parse and validate functions
to make sure parsing and error handling is as per expectation.

Fixes #6286

Signed-off-by: Purna Pavan Chandra <paekkaladevi@linux.microsoft.com>
Co-authored-by: Bo Chen <chen.bo@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

None yet

2 participants