Commit graph

9 commits

Author SHA1 Message Date
David Tolnay
1d0b445be2 macros: Update syn to 0.15
This brings us onto the stable API surface area for procedural macros
that stabilized in Rust 1.30, rather than the string-based shim on
older compilers.

    https://blog.rust-lang.org/2018/10/25/Rust-1.30.0.html

Intervening release notes:

- https://github.com/dtolnay/syn/releases/tag/0.13.0
- https://github.com/dtolnay/syn/releases/tag/0.14.0
- https://github.com/dtolnay/syn/releases/tag/0.15.0

TEST=cargo check crosvm
TEST=cargo test each of the three proc-macro crates
TEST=build_packages
CQ-DEPEND=CL:1340766

Change-Id: Idcf14df0225ab41423b9a8639d0bba0a63513712
Reviewed-on: https://chromium-review.googlesource.com/1338507
Commit-Ready: David Tolnay <dtolnay@chromium.org>
Tested-by: David Tolnay <dtolnay@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
2018-11-21 05:52:45 -08:00
Daniel Verkamp
310b308166 rustfmt wire_format_derive and poll_token_derive
BUG=None
TEST=cargo test

Change-Id: I62f00a71ed3693352de648bb8ee576335b32019f
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1273688
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-10-10 17:07:51 -07:00
Zach Reizner
55a9e504be cargo fmt all source code
Now that cargo fmt has landed, run it over everything at once to bring
rust source to the standard formatting.

TEST=cargo test
BUG=None

Change-Id: Ic95a48725e5a40dcbd33ba6d5aef2bd01e91865b
Reviewed-on: https://chromium-review.googlesource.com/1259287
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-10-09 21:14:05 -07:00
Zach Reizner
a1422e6bca fix warning and bit rotted tests uncovered by kokoro
TEST=run kokoro presubmit
BUG=None

Change-Id: I301551f8f58263f1a8b7a8276867881cb17517ab
Reviewed-on: https://chromium-review.googlesource.com/1236889
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2018-09-22 01:43:11 -07:00
Chirantan Ekbote
d678784ae1 p9: Fix file and directory creation mode
Don't allow clients to create files and directories that are writable by
anyone other than the user.  This is equivalent to having a umask of
022.

BUG=chromium:703939
TEST=change the umask in the container, mkdir, and see that it has 0755

Change-Id: I0622fcd89935512969bcd25a9b1fece1e72e1f38
Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1112869
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2018-06-27 22:07:22 -07:00
Chirantan Ekbote
f2fb37e669 p9: Fix unsafe block in read function
We calculate the size of the buffer to allocate for a read message by
finding the minimum of the requested size and the number of bytes left
in the response message buffer.

However, we then turned around and used an unsafe block to set the
length of the allocated buffer to the requested size rather than the
calculated size.  This could lead to memory corruption if the file we
were trying to read had enough bytes to fill up the whole buffer and the
requested size was larger than the max message size.

Replace both unsafe blocks with a resize function instead.  The
compiler is smart enough to turn this into a memset and
zero-initializing a few KB of memory is not that expensive.

BUG=chromium:703939
TEST=none

Change-Id: Ia9911d4176322bc9af0753541bd29d7a4723503b
Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1110479
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2018-06-21 19:56:34 -07:00
Chirantan Ekbote
b657603f10 p9: Add server implementation
Implement all the server methods for the 9P protocol.

BUG=chromium:703939
TEST=bonnie++ -r 256

Change-Id: I6b1b5fe4fea4d4941db42e5c1a364a54d0827054
Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1013203
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
2018-06-15 10:56:39 -07:00
Chirantan Ekbote
9b81eb57f3 p9: protocol: Add message definitions
Add definitions for all the messages we expect to send and receive over
the wire.

BUG=chromium:703939
TEST=none

Change-Id: I6b48f3e2eb9779fca57f8b71120b7bb1e8ab4ab9
Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1013201
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2018-05-22 21:56:58 -07:00
Chirantan Ekbote
800fcb060f Add low-level p9 protocol implementation
Implement encoding and decoding various primitives using the p9
protocol.  In addition, add a procedural macro to derive the encoding
and decoding implementation for structs built out of the primitives.

BUG=chromium:703939
TEST=unit tests
CQ-DEPEND=CL:1065063

Change-Id: I7256633fb7002da9ce8af03be2f24410b90ccf3f
Signed-off-by: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/969965
Reviewed-by: Stephen Barber <smbarber@chromium.org>
2018-05-22 21:56:58 -07:00