Commit Graph

48 Commits

Author SHA1 Message Date
jiaxiao zhou 5c55e352de
cargo clippy
Signed-off-by: jiaxiao zhou <jiazho@microsoft.com>
2023-08-02 02:43:05 +00:00
Maksym Pavlenko ddf49a9a52 Fix dependencies
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-07-11 10:47:24 -07:00
Maksym Pavlenko 98754fd771 Update tokio
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-03-13 09:43:52 -07:00
dependabot[bot] 2cf2fd4a92
build(deps): update oci-spec requirement from 0.5.8 to 0.6.0
Updates the requirements on [oci-spec](https://github.com/containers/oci-spec-rs) to permit the latest version.
- [Release notes](https://github.com/containers/oci-spec-rs/releases)
- [Changelog](https://github.com/containers/oci-spec-rs/blob/main/release.md)
- [Commits](https://github.com/containers/oci-spec-rs/compare/v0.5.8...v0.6.0)

---
updated-dependencies:
- dependency-name: oci-spec
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-13 01:44:43 +00:00
dependabot[bot] 7558fe4c49
build(deps): update nix requirement from 0.25 to 0.26
Updates the requirements on [nix](https://github.com/nix-rust/nix) to permit the latest version.
- [Release notes](https://github.com/nix-rust/nix/releases)
- [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nix-rust/nix/compare/v0.25.0...v0.26.1)

---
updated-dependencies:
- dependency-name: nix
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-29 21:09:10 +00:00
Maksym Pavlenko 80e7945674 Use workspace inheritance to describe crates
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-11-04 14:34:49 -07:00
Maksym Pavlenko 5ddd3e37bb Run fmt
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-09-29 11:55:31 -07:00
Maksym Pavlenko 51a27ee268 Update nix dependency (fix #93)
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-09-21 11:32:39 -07:00
Maksym Pavlenko cfe09e2227 Update nix dependency
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-05-05 14:55:34 -07:00
Yuna Tomida f9ae07236d
removed unsafe codes on runc client and shim
Signed-off-by: Yuna Tomida <ytomida.mmm@gmail.com>
2022-05-04 15:39:41 +09:00
dependabot[bot] 9193b476c2
build(deps): update uuid requirement from 0.8.2 to 1.0.0
Updates the requirements on [uuid](https://github.com/uuid-rs/uuid) to permit the latest version.
- [Release notes](https://github.com/uuid-rs/uuid/releases)
- [Commits](https://github.com/uuid-rs/uuid/compare/0.8.2...1.0.0)

---
updated-dependencies:
- dependency-name: uuid
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-20 21:37:17 +00:00
Maksym Pavlenko 21e298aef3 Bump versions
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-03-10 15:58:28 -08:00
Zhang Tianyang 3ff1fc0a6d bugfix: return a tmp dir when 'XDG_RUNTIME_DIR' was not set
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-03-09 23:46:47 +08:00
Feng Shaobao 1e1a6a8d97 change Executor to Spawner and make it trait object 2022-03-08 15:39:43 +08:00
Feng Shaobao 777fe2ad23 support async feature for runc shim
Signed-off-by: Feng Shaobao <fshb1988@gmail.com>
2022-03-07 16:38:19 +08:00
Zhang Tianyang a06ec3df2d runc-shim: implement pids task
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-03-01 19:04:12 +08:00
Zhang Tianyang dd90a9180f runc: Set piped stdio as default
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-02-28 21:36:03 +08:00
Zhang Tianyang cdb93f2358 runc-shim: implement update task
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-02-27 18:12:33 +08:00
Liu Jiang 33e940b9c8 runc: refine the way to setup Io
Refine the way to setup Io drivers for runC.

The capability to capture output/error messages from runc depends on
the Io driver used. Some add two more Io drivers: InheritedStdIo and
PipedStdIo. Also document whether the Io driver supports capturing
output/error messages.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-24 18:47:08 +08:00
Liu Jiang 41c2083eac runc: simple syntax improvments
Simple syntax only improvements.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-24 18:46:38 +08:00
Liu Jiang fc50adf2dc runc: implement sync version of ps() and stats()
Implement sync version of ps() and stats().

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-24 18:46:37 +08:00
Liu Jiang 95cda30597 runc: fix two bugs in preparing command line arguments
1) it should use "runc resume" instead of "runc pause" for resume()
2) the order of arguments to run() is wrong, other options may appear
   between "--bundle" and "bundle_id".

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-24 18:46:36 +08:00
Liu Jiang 6c6fa1ac09 runc: make async version of Runc::create() to return Response
Make async version of Runc::create() to return `Response` instead of
`()`, to keep symmetry with sync version.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-24 18:46:35 +08:00
Liu Jiang f5f18ec52b runc: avoid unwrap() in runc::launch()
In runc::launch(), it does
        let stdout = String::from_utf8(result.stdout).unwrap();
        let stderr = String::from_utf8(result.stderr).unwrap();

This is risk of DoS attack because the content result.stdout/sterr may
contain contents generated by the container, so it may contain malicious
non-UTF8 characters.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-24 18:46:33 +08:00
Zhang Tianyang b08e4090ea runc: fix bug that exec command leaks files
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-02-23 21:16:16 +08:00
Zhang Tianyang 117263d9be Move Io and Console
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-02-17 23:06:35 +08:00
Zhang Tianyang 620ce26d59 Remove extern use and refactor naming
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-02-17 23:02:26 +08:00
Zhang Tianyang 0a33f3e867 Runc shim implementation
Implement shim cli commands and some basic task APIs to run a runc container

Co-authored-by: Feng Shaobao fshb1988@gmail.com
Co-authored-by: Zhang Tianyang burning9699@gmail.com
Co-authored-by: Yu Qitao yuqitao1024@qq.com

Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-02-17 23:02:14 +08:00
Maksym Pavlenko 464af70dfa Remove IO impl for Arc
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-02-15 10:44:18 -08:00
Liu Jiang d453f1e38a runc: implement Io for Arc<T: Io>
Add an implementation of `impl<T: Io> Io for Arc<T>`.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-15 14:08:13 +08:00
Liu Jiang 0dc9705d7e runc: add unit test cases for io.rs
Add unit test cases for io.rs to avoid mistake.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-15 14:08:12 +08:00
Liu Jiang a52bcd0c7e runc: add helper PipedIo::create_pipe()
Add helper PipedIo::create_pipe() to reduce duplicated code.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-15 14:08:11 +08:00
Liu Jiang be8046e832 runc: simplify code a bit and refine doc
Simplify code in io.rs a bit, also refine doc and simplify code.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-15 14:08:10 +08:00
Liu Jiang 8c2a61a807 runc: introduce helper function execute()
Introduce helper function monitor.rs::execute() to avoid duplicated
code, and also correctly setup stdout/stderr for ProcessMonitor.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-15 11:15:33 +08:00
Liu Jiang cd965aa06a runc: avoid panic when the child process get signalled
On Unix, tokio::process::ExitStatus::code() will return None if the
process was terminated by a signal. So handle to avoid panicking
caused by unwrap().

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-15 11:15:31 +08:00
Liu Jiang 8f20cfb58c runc: add test cases for process monitor 2022-02-15 11:15:27 +08:00
Liu Jiang 37975426b9 runc: enhance documentation for ProcessMonitor
Enhance documentation for ProcessMonitor, to explicitly state the
requirement of ProcessMonitor::start().

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-15 11:15:26 +08:00
Liu Jiang d170d62326 runc: add a unit test case for GlobalOpts
Add a unit test case for GlobalOpts.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-14 16:57:05 +08:00
Liu Jiang 4b3efbc875 runc: move runc commandline constants into options.rs
Move runc commandline related constants into options.rs, so options.rs
hosts all commandline parsing related code. And util.rs only hosts
utilities.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-14 16:57:04 +08:00
Liu Jiang cfdbb4dbcd runc: rename ConfigBuilder as GlobalOpts and moves it into options.rs
Rename ConfigBuilder as GlobalOpts and moves it into options.rs,
to follow the runc man pages.

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-14 16:48:08 +08:00
Liu Jiang 2cba19f230 runc: avoid using unwrap() in util.rs
Introduce helper path_to_string() to avoid using unwrap().

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-14 16:48:08 +08:00
Maksym Pavlenko ab45a92d6d Add async feature
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-02-13 14:23:16 -08:00
Maksym Pavlenko 64306e3e4d Remove target checks
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-02-11 11:41:12 -08:00
Maksym Pavlenko 14dceb116f Remove duplicated config builder
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-02-11 11:18:16 -08:00
Maksym Pavlenko 3b2b00f206 Update README
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-02-11 10:10:42 -08:00
Akihiro Suda 522e26fab8
crates/runc/src/lib.rs: fix compilation on non-Linux
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-02-06 18:32:35 +09:00
Yuna Tomida eddd107601
remove unnecessary 'forget'
Signed-off-by: Yuna Tomida <ytomida.mmm@gmail.com>
2022-02-04 02:27:54 +00:00
Yuna Tomida 8f3e556a1b
renamed crate and applied recommended changes
Signed-off-by: Yuna Tomida <ytomida.mmm@gmail.com>
2022-02-04 00:39:39 +00:00