Commit graph

7605 commits

Author SHA1 Message Date
bunnie
4c7c9312c1 change xous-ipc api to 0.10.0 2024-09-23 00:24:48 +08:00
bunnie
5cad1a3bcf more xous_ipc cleanup 2024-09-23 00:03:49 +08:00
bunnie
3c0140bf2d final cleanup on shellchat xous-ipc abstractions
the implementation relied on a quirk of xous-ipc where the message
ID is 0 for string send/receives. This cleans it up so that the API
is transparent and consistent with other API calls in the system.
2024-09-23 00:01:32 +08:00
bunnie
8424d19ea9 fixup API to not rely on copy, instead use borrow
also some more regex fixup
2024-09-23 00:00:41 +08:00
bunnie
ef718853b2 cleanup borrow issues in com 2024-09-22 23:59:52 +08:00
bunnie
1bd8be2393 cleanup replace, and make into_inner/from_inner methods
the into/from inner methods are useful for using the Buffer
abstraction as a way to invoke rkyv on a structure to serialize
it and then manipulate the serialized data directly
2024-09-22 23:58:11 +08:00
bunnie
95a31a369c fix Copy derive and related issues in net 2024-09-22 21:55:20 +08:00
bunnie
e423bfd347 fix lines that missed the regex in DNS 2024-09-22 21:54:58 +08:00
bunnie
15aaf55e93 fix borrow for argument parsing 2024-09-22 21:54:24 +08:00
bunnie
4eb504bb43 more typecast cleanup 2024-09-22 18:51:06 +08:00
bunnie
839923967c git rid of a .clone() that crept in, now fixed by prior commit 2024-09-22 18:50:38 +08:00
bunnie
7141a02e10 ah yes. This was the kind of xous-ipc abuse I was worried I would have done.
And I did it! and it's now fixed.

I was using xous-ipc String to make a fixed-length string in a
structure that's not strictly an IPC structure.

The solution to this is to just implement a fixed length string
directly.
2024-09-22 18:49:26 +08:00
bunnie
6e4eec99a3 more cleanup on usb crate 2024-09-22 18:48:55 +08:00
bunnie
1b5eacdb68 manually cleanup a flat accessor in USB crate 2024-09-22 15:49:39 +08:00
bunnie
be227adde1 removed sized strings from pddb interchange structures
I think this is safe to do because no strings can be directly
serialized into the PDDB's structures. The place to check for
this is inside the backend/ directory. For example, `DictName`
is where the name field is serialized into a structure that
goes onto the disk. It's explicitly length-checked.

What this means is that we could have calls into the pddb crate
with invalid length strings, however, if you check the lib
implementation, all of the APIs also pre-flight the length of
arguments to ensure they fit into the destination string.

So mostly what we're losing is the constraints on the intermediate
IPC representation, but the length is still checked on either side.
2024-09-22 15:44:05 +08:00
bunnie
34e6f46d63 formatting changes that resulted from the regex search
a bunch of lines are shorter or different length now which
triggers a mandatory reformat. this patch cleans that up,
so that going forward the manual rework patches are clearer and
not tied up with formatting patches.
2024-09-22 15:31:14 +08:00
bunnie
0cdbfdfcc3 format cleanup & copy remove
a bunch of code has to be re-formatted because spacing changed
and we have a strict formatting rule
2024-09-22 15:29:23 +08:00
bunnie
f6f7cbdc98 bunnie-review: fix borrows in modals main loop
note for more review by bunnie down the road to make sure
that I have not changed any behaviors accidentally in fixing
the loss of Copy on a core structure
2024-09-22 15:28:11 +08:00
bunnie
af35f6e118 more cleanup of copy trait 2024-09-22 15:13:46 +08:00
bunnie
dfd7272773 review-needed: modify the alert modal prompt loop
The original loop takes advantage of the copy-trait that is
no longer available. I think the intent of the loop was to
mutate a field within the copy through each iteration so you
can update the prompt to handle field validations that failed
without re-allocating the ManagedPromtWithTextResponse structure.

This has been rewritten to alloc that each iteration to avoid
the borrow error, and instead the `prompt` itself is a string
that's initialized with the initial prompt message and is updated
on each iteration if the form validation fails.

@gsora git seems to say you wrote this code, maybe I could use
your help to review this patch.
2024-09-22 15:10:31 +08:00
bunnie
58527ea38b manual cleanup Copy derive: gam crate
There isn't a simple regex to deal with the loss of Copy when
deprecating xous_ipc, so this has to be a manual pass.

Losing the copy trait means (maybe) some loss of efficiency
in the API because we have to clone some structures instead
of copying them, although, I think actually what might have
been happening under the hood anyways is the copy was implemented
as a clone-under-the-hood for the xous-ipc.

Either way, this happens in the high level management structures
for modals, so it's not the end of the world to incur a clone
on the description of the structures -- we'd have to pay
more attention if this happened e.g. at the pixel shuffling
level, but a few UI strings at human-interaction rates
isn't going to kill us.
2024-09-22 14:50:21 +08:00
bunnie
f8719d781e security-related: implement missing clear_volatile() 2024-09-22 14:49:51 +08:00
bunnie
f1d263359d security-relevant: clear_volatile() API missing on String
xous_ipc::<String> had a clear-volatile() API for zeroizing
sensitive strings.

This is now missing in String, so it has been manually implemented
here by casting the String to a slice-u8 and then iterating
through it using raw pointers and volatile writes with a compiler
barrier to hopefully avoid all of the landmines I know of for
zeroizing a string...

commit is called out separately because this one is one of the
more "dangerous" security-related changes in the API migration.
2024-09-22 14:28:29 +08:00
bunnie
1fd59f0fc9 regex search/replace instances of xous_ipc::String to String 2024-09-22 14:28:16 +08:00
bunnie
b514d31fed regex search/replace instances of xous_ipc::String to String 2024-09-22 14:26:41 +08:00
bunnie
0fbca1cd4d cleanup a typecast ambiguity due to new API
Rust can't tell how to cast some u32_le into u32/usize automatically
due to confusion with the num_derive trait, so we have to explicitly
specify a chain of typecasts to clean up the conflict with the
new rkyv
2024-09-22 14:24:59 +08:00
bunnie
1b0fa6e04b regex search/replace instances of xous_ipc::String to String 2024-09-22 14:24:49 +08:00
bunnie
d2f13d92fe regex xous_ipc::String to String + cleanup idioms
some idioms are improved with String, this cleans up a bit of code
in addition to the search/replace
2024-09-22 14:23:20 +08:00
bunnie
15722a314a regex search/replace instances of xous_ipc::String to String 2024-09-22 14:22:58 +08:00
bunnie
0ef93e3bcd fix rkyv version in planning test 2024-09-22 14:21:32 +08:00
bunnie
c4f67ccb31 regex search/replace instances of xous_ipc::String to String 2024-09-22 14:21:09 +08:00
bunnie
3eb61d3002 regex search/replace instances of xous_ipc::String to String
includes some light touch-up to the API to clean up a consequence
of String not being copy-able anymore
2024-09-22 14:20:24 +08:00
bunnie
849ae5f874 regex search/replace instances of xous_ipc::String to String
codegenerator fixes
2024-09-22 14:19:46 +08:00
bunnie
f2fbc7fafd regex search/replace instances of xous_ipc::String to String
more regex results
2024-09-22 14:19:32 +08:00
bunnie
1d9316f9cd regex search/replace instances of xous_ipc::String to String
core xous services cluster
2024-09-22 14:18:49 +08:00
bunnie
916c98fd5c regex search/replace instances of xous_ipc::String to String
split into multiple commits for easier committing
2024-09-22 14:18:19 +08:00
bunnie
52ffd88b40 regex search/replace instances of xous_ipc::String to String
split into multiple commits for easier committing
2024-09-22 14:17:03 +08:00
bunnie
6d7a8fdc09 regex search/replace instances of xous_ipc::String to String
split into multiple commits for easier committing
2024-09-22 14:16:36 +08:00
bunnie
a1bf70b9ed regex search/replace instances of xous_ipc::String to String
split into a couple commits for ease of committing
2024-09-22 14:14:55 +08:00
bunnie
6470e1c6f2 xous-ipc changes that trigger the next series of search/replace commits 2024-09-22 14:14:29 +08:00
bunnie
423bfe93ea clean up a warning in loader crate
minor cleanup because the warning is distracting from chasing
down all the other warnings
2024-09-22 11:34:59 +08:00
bunnie
6d954d6303 remove xous-ipc string
this triggers a whole lotta changes....
2024-09-22 11:34:24 +08:00
bunnie
a506e7c5b6 bump rkyv in planning 2024-09-22 10:49:15 +08:00
bunnie
3dd4e2a2c3 a pass at modifying string.
Turns out, this is the wrong approach. It's still useful code
because it's a direct method for passing strings that doesn't
rely on rkyv (so it could potentially be more efficient for
very efficiency-oriented applications).

But I think in the end, after writing this and seeing the errors
that come from it, I think we should just abandon String<N> altogether
because it doesn't get us anything.
2024-09-18 14:19:41 +08:00
bunnie
e004ce2651 mods to lib 2024-09-18 14:19:32 +08:00
bunnie
11e112d06d dependency updates 2024-09-18 14:18:49 +08:00
bunnie
0be556a5d4 take at porting buffer to rkyv-0.8 2024-09-18 14:18:35 +08:00
bunnie
56e5d53992 update to rkyv 0.8.7 2024-09-18 12:35:37 +08:00
bunnie
fd0eaaade6
Merge pull request #573 from betrusted-io/rkyv-0.8
Rkyv 0.8 - planning
2024-09-18 01:00:55 +08:00
bunnie
3120b5d13c clean up API even further 2024-09-18 00:50:21 +08:00