Commit Graph

5462 Commits

Author SHA1 Message Date
stevenhorsman
0f1c326ca0 versions: Bump protobuf to 3.7.2
Now we are decoupled from the image-rs crate,
we can bump the protobuf version across our project
to resolve the GHSA-2gh3-rmm4-6rq5 advisory

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-06-20 20:52:04 +01:00
Archana Choudhary
e093919b42 tests: update container image for ci and unit test
This patch updates the container image for the CI test workloads:
- `k8s-layered-sc-deployment.yaml`
- `k8s-pod-sc-deployment.yaml`
- `k8s-pod-sc-nobodyupdate-deployment.yaml`
- `k8s-pod-sc-supplementalgroups-deployment.yaml`
- `k8s-policy-deployment.yaml`

Also updates unit tests:
- `test_create_container_security_context`
- `test_create_container_security_context_supplemental_groups`

This fixes tests failing due to an image pull error as the previous image is no longer available in
the container registry.

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
Signed-off-by: Saul Paredes <saulparedes@microsoft.com>
2025-06-20 10:46:56 -07:00
Fupan Li
15b24b5be1 Merge pull request #10698 from Apokleos/kata-volume-rs
runtime-rs: Support Pull Image in Guest with Kata Volume for CoCo
2025-06-17 15:00:02 +08:00
Lei Liu
71d1cdf40a test: fix broken testing code in libs
After commit a3f973db3b merged, protection::GuestProtection::[Snp,Sev]
have changed to tuple variants, and can no longer be used in assert_eq
marco without tuple values, or some errors will raised:

```
assert_eq!(actual.unwrap(), GuestProtection::Snp);
    |                                     ^^^^^^^^^^^^^^^^^^^^ expected  \
				`GuestProtection`, found enum constructor
```

Signed-off-by: Lei Liu <liulei.pt@bytedance.com>
2025-06-17 12:38:39 +08:00
Xuewei Niu
9b4518f742 Merge pull request #11359 from pawelbeza/fix-logs-on-virtiofs-shutdown
Fix logging on virtiofs shutdown
2025-06-16 17:06:29 +08:00
Steve Horsman
64c95cb996 Merge pull request #11389 from kata-containers/checkout-persist-credentials-false
workflows: Set persist-credentials: false on checkout
2025-06-16 09:58:22 +01:00
alex.lyn
cebb259e51 runtime-rs: Introduce force guest pulling image
Container image integrity protection is a critical practice involving a
multi-layered defense mechanism. While container images inherently offer
basic integrity verification through Content-Addressable Storage (CAS)
(ensuring pulled content matches stored hashes), a combination of other
measures is crucial for production environments. These layers include:
Encrypted Transport (HTTPS/TLS) to prevent tampering during transfer;
Image Signing to confirm the image originates from a trusted source;
Vulnerability Scanning to ensure the image content is "healthy"; and
Trusted Registries with stringent access controls.

In certain scenarios, such as when container image confidentiality
requirements are not stringent, and integrity is already ensured via the
aforementioned mechanisms (especially CAS and HTTPS/TLS), adopting
"force guest pull" can be a viable option. This implies that even when
pulling images from a container registry, their integrity remains
guaranteed through content hashes and other built-in mechanisms, without
relying on additional host-side verification or specialized transfer
methods.

Since this feature is already available in runtime-go and offers
synergistic benefits with guest pull, we have chosen to support force
guest pull.

Fixes #10690

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-06-16 16:49:17 +08:00
alex.lyn
2157075140 kata-types: Introduce a helper method to adjust rootfs mounts
This commit introduces the `adjust_rootfs_mounts` function to manage
root filesystem mounts for guest-pull scenarios.

When the force guest-pull mechanism is active, this function ensures that
the rootfs is exclusively configured via a dedicated `KataVirtualVolume`.
It disregards any provided input mounts, instead generating a single,
default `KataVirtualVolume`. This volume is then base64-encoded and set
as the sole mount option for a new, singular `Mount` entry, which is
returned as the only item in the `Vec<Mount>`.

This change guarantees consistent and exclusive rootfs configuration
when utilizing guest-pull for container images.

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-06-16 16:49:17 +08:00
alex.lyn
c9ffbaf30d runtime-rs: Support handling Kata Virtual Volume in handle_rootfs
In CoCo scenarios, there's no image pulling on host side, and it will
disable such operations, that's to say, there's no files sharing between
host and guest, especially for container rootfs.
We introduce Kata Virtual Volume to help handle such cases:
(1) Introduce is_kata_virtual_volume to ensure the volume is kata
virtual volume.
(2) Introduce VirtualVolume Handling logic in handle_rootfs when the
mount is kata virtual volume.

Fixes #10690

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-06-16 16:49:17 +08:00
alex.lyn
2600fc6f43 runtime-rs: Add Spec annotation to help pass image information
We need get the relevent image ref from OCI runtime Spec, especially
the annotation of it.

Fixes #10690

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-06-16 16:49:17 +08:00
alex.lyn
d4e9369d3d runtime-rs: Implement guest-pull rootfs via virtual volumes
This commit introduces comprehensive support for rootfs mount mgmt
through Kata Virtual Volumes, specifically enabling the guest-pull
mechanism.

It enhances the runtime's ability to:
(1) Extract image references from container annotations (CRI/CRI-O).
(2) Process `KataVirtualVolume` objects, configuring them for guest-pull operations.
(3) Set up the agent's storage for guest-pulled images.

This functionality streamlines the process of pulling container images
directly within the guest for rootfs, aligning with guest-side image management strategies.

Fixes #10690

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-06-16 16:49:17 +08:00
Xynnn007
aae64fa3d6 agent: add agent.image_pull_timeout parameter
This new parameter for kata-agent is used to control the timeout for a
guest pull request. Note that sometimes an image can be really big, so
we set default timeout to 1200 seconds (20 minutes).

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2025-06-16 13:54:15 +08:00
Xynnn007
105cb47991 agent: always try to override oci process spec
In previous version, only when the `guest-pull` feature is enabled
during the build time, the OCI process will be tried to be overrided
when the storage has a guest pull volume and also it is sandbox. After
getting rid of the feature, whether it is guest-pull is runtimely
determined thus we can always do this trying override, by checking if
there is kata guest pull volume in storages and it's sandbox.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2025-06-16 11:13:20 +08:00
Xynnn007
6b1249186f agent: embed ocicrypt config in rootfs by default
Now the ocicrypt configuration used by CDH is always the same and it's
not a good practics to write it into the rootfs during runtime by
kata-agent. Thus we now move it to coco-guest-components build script.
The config will be embedded into guest image/initrd together with CDH
binary.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2025-06-16 11:13:20 +08:00
Xynnn007
22e65024ce agent: get rid of pull-type option
The feature `guest-pull` and `default-pull` are both removed, because
both guest pull and host pull are supported in building time without
without involving new dependencies like image-rs before. The guest pull
will depend on the CDH process, not the build time feature.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2025-06-16 11:13:20 +08:00
Xynnn007
0e15b49369 agent: get rid of init_image_service
we do not need to initialize image service in kata-agent now, as it's
initialized in CDH.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2025-06-16 11:13:20 +08:00
Xynnn007
22c50cae7b agent: let image_pull_handler call cdh to pull image
This is a higher level calling to pull image inside guest. Now it should
call confidential_data_hub's API. As the previous pull_image API does
1. check is sandbox
2. generate bundle_path
inside the original logic, and the new API does not do them to keep the
API semantice clean, thus before we call the API, we explicitly do the
two things.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2025-06-16 11:13:20 +08:00
Xynnn007
39cd430994 agent: add ocicrypt_config envs for CDH process
now image pull ability is moved to CDH, thus the CDH process needs
environment variables of ocicrypt to help find the keyprovider(cdh) to
decrypt images.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2025-06-16 11:13:20 +08:00
Xynnn007
f67f5c2b69 agent: remove image pull configs
As image pull ability is moved to CDH, kata-agent does not need the
confugurations of image pulling anymore.

All these configurations reading from kernel cmdline is now implemented
by CDH.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2025-06-16 11:13:20 +08:00
Xynnn007
4436fe6d99 agent: move guest pull abilities to Confidential Data Hub
Image pull abilities are all moved to the separate component
Confidential Data Hub (CDH) and we only left the auxiliary functions
except pull_image in confidential_data_hub/image.rs

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2025-06-16 11:10:09 +08:00
Xynnn007
5067aafd56 agent: move cdh.rs and image.rs to a separate module confidential_data_hub
This is a little refactoring commit that moves the mod `cdh.rs` and
`image.rs` to a directory module `confidential_data_hub`. This is
because the image pull ability will be moved into confidential data
hub, thus it is better to handle image pull things in the confidential
data hub submodule.

Also, this commit does some changes upon the original code. It gets rid
of a static variable for CDH timeout config and directly use the global
config variable's member. Also, this changes the
`is_cdh_client_initialized` function to sync version as it does not need
to be async.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2025-06-16 11:10:09 +08:00
Xynnn007
997a1f35ab agent: add PullImage to CDH proto file
CDH provides the image pull api. This commit adds the declaration of the
API in the CDH proto file. This will be used in following commits.

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2025-06-16 11:10:09 +08:00
Xuewei Niu
c27116fa8e Merge pull request #11416 from lifupan/prealloc
runtime-rs: add the memory prealloc support for qemu/ch
2025-06-15 11:01:05 +08:00
Saul Paredes
cdfc9fd2d9 agent: add feature flag to secure_mount method
This method is not used when guest-pull is not used.
Add a flag that prevents a compile error when building with rust version > 1.84.0 and not using guest-pull

Signed-off-by: Saul Paredes <saulparedes@microsoft.com>
2025-06-13 11:25:58 -07:00
Fabiano Fidêncio
6f0ea595b7 Merge pull request #11402 from microsoft/danmihai1/disable-nvdimm
runtime: build variable for disable_image_nvdimm=true
2025-06-13 16:35:57 +02:00
Dan Mihai
0f8e453518 Merge pull request #11412 from katexochen/rego-v1
genpolicy: fix rules syntax issues, rego v1 compatibility; ci: checks for rego parsing
2025-06-13 07:30:34 -07:00
Paweł Bęza
91db41227f runtime: Fix logging on virtiofs shutdown
Fixes a confusing log message shown when Virtio-FS is disabled.
Previously we logged “The virtiofsd had stopped” regardless of whether Virtio-FS was actually enabled or not.

Signed-off-by: Paweł Bęza <pawel.beza99@gmail.com>
2025-06-13 15:59:52 +02:00
Fupan Li
5163156676 runtime-rs: add the memory prealloc support for cloud-hypervisor
Add the memory prealloc support for cloud hypervisor too.

Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
2025-06-13 16:26:11 +08:00
Fupan Li
fb7cfcd2fb runtime-rs: add the memory prealloc support for qemu
Add the memory prealloc support for qemu hypervisor.
When it was enabled, all of the memory will be allocated
and locked. This is useful when you want to reserve all the
memory upfront or in the cases where you want memory latencies
to be very predictable.

Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
2025-06-13 16:26:03 +08:00
dependabot[bot]
1e6962e4a8 build(deps): bump the tracing group across 7 directories with 1 update
Bumps the tracing group with 1 update in the /src/dragonball directory: [tracing](https://github.com/tokio-rs/tracing).
Bumps the tracing group with 1 update in the /src/libs directory: [tracing](https://github.com/tokio-rs/tracing).
Bumps the tracing group with 1 update in the /src/tools/agent-ctl directory: [tracing](https://github.com/tokio-rs/tracing).
Bumps the tracing group with 1 update in the /src/tools/genpolicy directory: [tracing](https://github.com/tokio-rs/tracing).
Bumps the tracing group with 1 update in the /src/tools/kata-ctl directory: [tracing](https://github.com/tokio-rs/tracing).
Bumps the tracing group with 1 update in the /src/tools/runk directory: [tracing](https://github.com/tokio-rs/tracing).
Bumps the tracing group with 1 update in the /src/tools/trace-forwarder directory: [tracing](https://github.com/tokio-rs/tracing).


Updates `tracing` from 0.1.37 to 0.1.41
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.37...tracing-0.1.41)

Updates `tracing` from 0.1.34 to 0.1.41
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.37...tracing-0.1.41)

Updates `tracing` from 0.1.37 to 0.1.41
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.37...tracing-0.1.41)

Updates `tracing` from 0.1.37 to 0.1.41
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.37...tracing-0.1.41)

Updates `tracing` from 0.1.40 to 0.1.41
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.37...tracing-0.1.41)

Updates `tracing` from 0.1.40 to 0.1.41
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.37...tracing-0.1.41)

Updates `tracing` from 0.1.29 to 0.1.41
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.37...tracing-0.1.41)

---
updated-dependencies:
- dependency-name: tracing
  dependency-version: 0.1.41
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: tracing
- dependency-name: tracing
  dependency-version: 0.1.41
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: tracing
- dependency-name: tracing
  dependency-version: 0.1.41
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: tracing
- dependency-name: tracing
  dependency-version: 0.1.41
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: tracing
- dependency-name: tracing
  dependency-version: 0.1.41
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: tracing
- dependency-name: tracing
  dependency-version: 0.1.41
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: tracing
- dependency-name: tracing
  dependency-version: 0.1.41
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: tracing
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-12 15:45:35 +00:00
Steve Horsman
843655c352 Merge pull request #11411 from stevenhorsman/runk-users-crate-switch
runk: Switch users crate
2025-06-12 10:35:31 +01:00
Paul Meyer
5baea34fff genpolicy/rules: rego v1 compatibility
Migrate policy to rego v1.
See https://www.openpolicyagent.org/docs/v0-upgrade#changes-to-rego-in-opa-v10

Signed-off-by: Paul Meyer <katexochen0@gmail.com>
2025-06-12 10:46:43 +02:00
Fupan Li
7c1f8c9009 Merge pull request #10697 from Apokleos/no-sharefs
runtime-rs: Support shared_fs = "none" for CoCo
2025-06-12 11:48:00 +08:00
Ruoqing He
26c7f941aa versions: Bump rust to 1.85.1
As discussed in 2025-05-22's AC call, bump rust toolchian to 1.85.1.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00
Ruoqing He
5011253818 agent-ctl: Bump ttrpc-codegen related dependencies
Bump `ttrpc-codegen` related dependencies in response to `ttrpc-codegen`
bump in `libs/protocol`.

Relates: #11376

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00
Ruoqing He
ba75b3299f dragonball: Fix clippy elided_named_lifetimes
Manually fix `elided_named_lifetimes` clippy warning reported by rust
1.85.1.

```console
error: elided lifetime has a name
   --> src/vm/aarch64.rs:113:10
    |
107 |     fn get_fdt_vm_info<'a>(
    |                        -- lifetime `'a` declared here
...
113 |     ) -> FdtVmInfo {
    |          ^^^^^^^^^ this elided lifetime gets resolved as `'a`
    |
    = note: `-D elided-named-lifetimes` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(elided_named_lifetimes)]`
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00
Ruoqing He
1bbedb8def dragonball: Fix clippy repr_packed_without_abi
Fix `repr_packed_without_abi` clippy warning as suggested by rust
1.85.1.

```console
error: item uses `packed` representation without ABI-qualification
   --> dbs_pci/src/msi.rs:468:1
    |
466 |   #[repr(packed)]
    |          ------ `packed` representation set here
467 |   #[derive(Clone, Copy, Default, PartialEq)]
468 | / pub struct MsiState {
469 | |     msg_ctl: u16,
470 | |     msg_addr_lo: u32,
471 | |     msg_addr_hi: u32,
472 | |     msg_data: u16,
473 | |     mask_bits: u32,
474 | | }
    | |_^
    |
    = warning: unqualified `#[repr(packed)]` defaults to `#[repr(Rust, packed)]`, which has no stable ABI
    = help: qualify the desired ABI explicity via `#[repr(C, packed)]` or `#[repr(Rust, packed)]`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#repr_packed_without_abi
    = note: `-D clippy::repr-packed-without-abi` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::repr_packed_without_abi)]`
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00
Ruoqing He
e8be3c13fb dragonball: Fix clippy missing_docs
Fix `missing_docs` clippy warning as suggested by rust 1.85.1.

```console
error: missing documentation for an associated function
    --> src/device_manager/mod.rs:1299:9
     |
1299 |         pub fn new_test_mgr() -> Self {
     |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: `-D missing-docs` implied by `-D warnings`
     = help: to override `-D warnings` add `#[allow(missing_docs)]`
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00
Ruoqing He
ceff1ed98d dragonball: Fix clippy needless_lifetimes
Fix `needless_lifetimes` clippy warning as suggested by rust 1.85.1.

```console
error: the following explicit lifetimes could be elided: 'a
   --> dbs_virtio_devices/src/vhost/vhost_user/connection.rs:137:6
    |
137 | impl<'a, AS: GuestAddressSpace, Q: QueueT, R: GuestMemoryRegion> EndpointParam<'a, AS, Q, R> {
    |      ^^                                                                        ^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    = note: `-D clippy::needless-lifetimes` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::needless_lifetimes)]`
help: elide the lifetimes
    |
137 - impl<'a, AS: GuestAddressSpace, Q: QueueT, R: GuestMemoryRegion> EndpointParam<'a, AS, Q, R> {
137 + impl<AS: GuestAddressSpace, Q: QueueT, R: GuestMemoryRegion> EndpointParam<'_, AS, Q, R> {
    |
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00
Ruoqing He
c04f1048d5 dragonball: Fix clippy unnecessary_lazy_evaluations
Fix `unnecessary_lazy_evaluations` clippy warning as suggested by rust
1.85.1.

```console
error: unnecessary closure used to substitute value for `Option::None`
   --> dbs_virtio_devices/src/vhost/vhost_user/block.rs:225:28
    |
225 |           let vhost_socket = config_path
    |  ____________________________^
226 | |             .strip_prefix("spdk://")
227 | |             .ok_or_else(|| VirtIoError::InvalidInput)?
    | |_____________________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
    = note: `-D clippy::unnecessary-lazy-evaluations` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::unnecessary_lazy_evaluations)]`
help: use `ok_or` instead
    |
227 |             .ok_or(VirtIoError::InvalidInput)?
    |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>

unnecessary_lazy_evaluations

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00
Ruoqing He
16b45462a1 dragonball: Fix clippy manual_inspect
Manually fix `manual_inspect` clippy warning reported by rust 1.85.1.

```console
error: using `map_err` over `inspect_err`
   --> dbs_virtio_devices/src/net.rs:753:52
    |
753 |         self.device_info.read_config(offset, data).map_err(|e| {
    |                                                    ^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_inspect
    = note: `-D clippy::manual-inspect` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::manual_inspect)]`
help: try
    |
753 ~         self.device_info.read_config(offset, data).inspect_err(|e| {
754 ~             self.metrics.cfg_fails.inc();
    |
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00
Ruoqing He
5e80293bfc dragonball: Fix clippy empty_line_after_doc_comments
Fix `empty_line_after_doc_comments` clippy warning as suggested by rust
1.85.1.

```console
error: empty line after doc comment
  --> dbs_boot/src/x86_64/layout.rs:11:1
   |
11 | / /// Magic addresses externally used to lay out x86_64 VMs.
12 | |
   | |_^
13 |   /// Global Descriptor Table Offset
14 |   pub const BOOT_GDT_OFFSET: u64 = 0x500;
   |   ------------------------------ the comment documents this constant
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments
   = note: `-D clippy::empty-line-after-doc-comments` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::empty_line_after_doc_comments)]`
   = help: if the empty line is unintentional remove it
help: if the documentation should include the empty line include it in the comment
   |
12 | ///
   |
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00
Ruoqing He
bb13b6696e dragonball: Fix clippy manual_div_ceil
Fix `manual_div_ceil` clippy warning as suggested by rust 1.85.1.

```console
error: manually reimplementing `div_ceil`
   --> dbs_interrupt/src/kvm/mod.rs:202:24
    |
202 |         let elem_cnt = (total_sz + elem_sz - 1) / elem_sz;
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `total_sz.div_ceil(elem_sz)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil
    = note: `-D clippy::manual-div-ceil` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::manual_div_ceil)]`
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00
Ruoqing He
e58bd52dd8 dragonball: Fix clippy precedence
Fix `precedence` clippy warning as suggested by rust 1.85.1.

```console
error: operator precedence can trip the unwary
   --> dbs_interrupt/src/kvm/mod.rs:169:6
    |
169 |     (u64::from(type1) << 48 | u64::from(entry.type_) << 32) | u64::from(entry.gsi)
    |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `(u64::from(type1) << 48) | (u64::from(entry.type_) << 32)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence
    = note: `-D clippy::precedence` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::precedence)]`
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00
Ruoqing He
44142b13d3 genpolicy: Fix clippy unstable_name_collisions
Manually fix `unstable_name_collisions` clippy warning reported by rust
1.85.1.

```console
error: a method with this name may be added to the standard library in the future
   --> src/registry.rs:646:10
    |
646 |     file.unlock()?;
    |          ^^^^^^
    |
    = warning: once this associated item is added to the standard library, the ambiguity may cause an error or change in behavior!
    = note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
    = help: call with fully qualified syntax `fs2::FileExt::unlock(...)` to keep using the current method
    = note: `-D unstable-name-collisions` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unstable_name_collisions)]`
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00
Ruoqing He
366d293141 genpolicy: Fix clippy manual_unwrap_or_default
Manually fix `manual_unwrap_or_default` clippy warning reported by rust
1.85.1.

```console
error: if let can be simplified with `.unwrap_or_default()`
   --> src/registry.rs:619:37
    |
619 |       let mut data: Vec<ImageLayer> = if let Ok(vec) = serde_json::from_reader(read_file) {
    |  _____________________________________^
620 | |         vec
621 | |     } else {
...   |
624 | |     };
    | |_____^ help: replace it with: `serde_json::from_reader(read_file).unwrap_or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default
    = note: `-D clippy::manual-unwrap-or-default` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::manual_unwrap_or_default)]`
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00
Ruoqing He
a71a77bfa3 genpolicy: Fix clippy manual_div_ceil
Manually fix `manual_div_ceil` clippy warning reported by rust 1.85.1.

```console
error: manually reimplementing `div_ceil`
  --> src/verity.rs:73:25
   |
73 |             let count = (data_size + entry_size - 1) / entry_size;
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `data_size.div_ceil(entry_size)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil
   = note: `-D clippy::manual-div-ceil` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::manual_div_ceil)]`
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00
Ruoqing He
5d491bd4f4 genpolicy: Bump ttrpc-codegen related dependencies
Bump `ttrpc-codegen` related dependencies in response to `ttrpc-codegen`
bump in `libs/protocol`.

Relates: #11376

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00
Ruoqing He
965f1d799c kata-ctl: Fix clippy empty_line_after_outer_attr
Manually fix `empty_line_after_outer_attr` clippy warning reported by
rust 1.85.1.

```console
error: empty line after outer attribute
   --> src/check.rs:515:9
    |
515 | /         #[allow(dead_code)]
516 | |
    | |_^
517 |           struct TestData<'a> {
    |           ------------------- the attribute applies to this struct
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_outer_attr
    = note: `-D clippy::empty-line-after-outer-attr` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::empty_line_after_outer_attr)]`
    = help: if the empty line is unintentional remove it
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00
Ruoqing He
3d64b11454 kata-ctl: Fix clippy question_mark
Manually fix `question_mark` clippy warning reported by rust 1.85.1.

```console
error: this `match` expression can be replaced with `?`
  --> src/ops/check_ops.rs:49:13
   |
49 |       let f = match get_builtin_check_func(check) {
   |  _____________^
50 | |         Ok(fp) => fp,
51 | |         Err(e) => return Err(e),
52 | |     };
   | |_____^ help: try instead: `get_builtin_check_func(check)?`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark
   = note: `-D clippy::question-mark` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::question_mark)]`
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-06-11 13:50:10 +00:00