Commit graph

475 commits

Author SHA1 Message Date
bunnie
ad8ba37cf9 add a script that does a factory reset
for those just getting started and who want a fast-path to update.
2022-02-04 04:18:30 +08:00
bunnie
11c88b170e implement a basis for anti-rollback upgrades
the actual transition to a new version isn't here. But,
at the very least, the root keys are now derived by hashing
them MAX_ROLLBACK_LIMIT times, which allows us to create a
key chain based on a global version number that can be incremented
while allowing derviation of older keys without compromising newer
keys.
2022-02-04 01:33:04 +08:00
bunnie
b3788a54af clarify the dependency policy 2022-01-10 16:50:10 +08:00
bunnie
995915ed4e nail down a couple more dependencies, and add a policy note to Cargo.toml
Each Cargo.toml now includes a comment which remnids maintainers
of the dependency policy for Xous (that is, nail down every dependency
to the minor number).
2022-01-10 15:54:27 +08:00
bunnie
fec180890b nail down dependencies in the related build toolchain flow
these are secondary attack surfaces -- code that isn't directly
in the kernel, but involved in the manipulation, handling, grooming
and preparation of source and binary files
2022-01-10 15:49:30 +08:00
bunnie
dd943c5416 pin down versions and harmonize versions across servers
Versions are pinned down to the minor number. Yes, this means that
we don't automatically pull in features and bug updates from crates.io,
but it also means we don't pull in new attack surfaces and code that
hasn't been tested or reviewed. I'd like this process to be very deliberate
and not automatic for Xous.

The `rand` crate is almost pinned down to a single version, except
for an odd dependency that's pulled in by hosted mode that depends
on rand 0.8.4 via a subordinate dependency via the `tempfile` crate.
Pondering if it's worth it to try and eliminate that, because the
0.8.4 version doesn't get compiled into any version that touches
real hardware. It just makes it harder to analyze the Cargo.lock
file, mostly. I think I'll leave it as-is.
2022-01-10 15:39:55 +08:00
bunnie
9a34de0065 rework flash memory locs; add command for re-creating a factory new device 2022-01-09 22:33:36 +08:00
bunnie
0c71622740 fix alignment bug in analysis code 2022-01-06 23:15:24 +08:00
bunnie
4c927f2c99 fix name records so they encode a length
This is one of the truly redeeming features of Rust is that a
major refactor of a core structure like this doesn't leave me
shaking in my boots -- I feel pretty good that this works
since everything passes the CI tests.

The original FS implementation did the "stupid C thing" which
just creates a fixed lenth field and uses null-terminated C
strings. Which actually restricts PDDB entry names to be ascii
as valid UTF-8 can encode single-byte nulls.

The intention was for names to be fully utf-8 compliant, but in
order to do that we have to burn one byte of potential filename
length and encode an overall length field for the name strings.

This change does that, which both makes the code a bit safer
at the expense of losing a character off of the maximum filename
length.
2022-01-06 18:53:01 +08:00
bunnie
d87920a772 add argument to erase the entire PDDB region. 2022-01-04 11:12:30 +08:00
bunnie
630dd6a784 make the CI options command line driven 2022-01-02 16:41:23 +08:00
bunnie
421a3814d8 clean up some warnings before moving on to further integration 2022-01-02 15:07:48 +08:00
bunnie
33b0593f9a fx fspace cache entry space check issue
was counting total number of pages, not actual free pages.
2022-01-02 01:41:55 +08:00
bunnie
fef355423b fix CI red herrings; add more debug granularty 2022-01-01 15:14:44 +08:00
bunnie
c02a8933ef speed up the analysis tool so it's a bit more practical to use in CI 2022-01-01 14:14:09 +08:00
bunnie
656f17f621 add extensive CI test 2021-12-29 05:49:07 +08:00
bunnie
6990513278 fixed a subtle bug in the pte sync algorithm
was mixing deletions and updates and because they are in arbitrary
order due to the hashset structure, sometimes i'd delete an entry
after it was updated.

this is now found and fixed.
2021-12-28 06:47:33 +08:00
bunnie
713c0d6e73 add a multi-iteration CI loop around the pddb test
this allows us to capture seeds and corners of interest
2021-12-27 16:15:51 +08:00
bunnie
4f7372bbd4 add log levels to the debug tool 2021-12-27 13:07:01 +08:00
bunnie
c15841cfdc test framework in place to look at multiple basis
found one bug already, need to refactor how PT encryptor is
handled
2021-11-28 23:54:58 +08:00
bunnie
af9f4cbde3 back out changes for stress testing the fastspace mechanims 2021-11-27 21:23:42 +08:00
bunnie
185d629b98 stress test fastspace allocation and regeneration
- confirmed that log entries regenerate on trigger
- confirmed that fastspace cache regenerates and contains a
new subset of blank pages.
2021-11-27 21:17:41 +08:00
bunnie
93ee050079 fastspace regen debugging -- passes test, but needs optimization
should be able to get away with "just" regenerating the fast space
log only if that's what we've run out of; however, doing that optimization
we run into out of space errors. maybe we need some tuning of the thresholds
for when to reclaim space
2021-11-27 02:19:57 +08:00
bunnie
e02df18374 fix reporting error in directory listings 2021-11-26 03:36:36 +08:00
bunnie
468e372bfa most tests passing, also, be a little smarter about cache fills. 2021-11-26 03:08:08 +08:00
bunnie
ca485d5541 fix off-by-one in small pool to dictionary storage mappings
consolidate index math into helper functions to reduce errors.
2021-11-25 03:14:29 +08:00
bunnie
8de0d70f43 debugging the patch-extend test.
probably should make a bunch of unit tests for the free dictionary
key tracking logic, it's too tricky to test out.
2021-11-24 03:57:50 +08:00
bunnie
66a5b97705 revise pagetable entry to be 7 bytes wide -- this will allow
us to have a full 64-bit address space upon expansion of the page
number (turns out this is probably important because of the crappy
increment-only allocator used for the large blocks)
2021-11-24 01:49:22 +08:00
bunnie
42e926fcab fixes for patch update test
lots of corner cases found and ifxed
2021-11-23 23:33:06 +08:00
bunnie
d716fea17a now passing dictionary add/remove test 2021-11-23 02:57:13 +08:00
bunnie
77d3f8a646 fix bug in python aes-gcm-siv reference implementation 2021-11-23 02:56:54 +08:00
bunnie
eda60a5d9c base case test done, with CI checking 2021-11-22 18:26:19 +08:00
bunnie
62059a9f93 relocate images to a directory 2021-11-22 14:00:43 +08:00
bunnie
1874c8e72d most of the core routines are now in place
can create/delete dicts, create/delete/update keys.
basis deletion is...just forgetting the password. that's the point,
at least. could maybe extend the basis AAD to include some small
amount of derived data that could be deleted to facilitate basis
deletion...

anyways. next up is...lots and lots of testing.
2021-11-22 04:46:36 +08:00
bunnie
193f563782 very basic small key additions working as expected now 2021-11-21 02:21:25 +08:00
bunnie
c62b2a25fb dictionary adding now seems to work 2021-11-18 02:01:30 +08:00
bunnie
507d99ee41 moving toward refactoring the basis sync function 2021-11-18 00:09:55 +08:00
bunnie
bbbaa6b810 clean up the structural definition of the dictionaries and keys 2021-11-16 18:45:24 +08:00
bunnie
49d00c783e basic mounting of the PDDB & readout of system basis 2021-11-16 02:58:33 +08:00
bunnie
d7cc518552 add mbbb mechanism 2021-11-15 19:05:03 +08:00
bunnie
65bbc82ef5 commit to Repr(C), include doc comment for rationale and tests 2021-11-15 16:38:57 +08:00
bunnie
ce51205155 checkpoint with memory placement and disk storage
this probably isn't new to most other people but this has been
a very visceral exercise of how tricky it is to use Repr(c)
for data layouts in anything but the most trivial data structures.

Unfortunately the Basis root data structure needs to be fairly rich,
so we're playing around with using rkyv to help with the serialization
to disk but I'm also not convinced this is a good idea yet. This
checkpoints commits a "working" rkyv implementation, but I'm not
entirely happy with the notion that rkyv can shuffle around data
bits based on its particular version or decisions in the serializer
crate. I'd like deterministic, repeatable serialization that will
be solid through lots of revs...
2021-11-15 16:00:01 +08:00
bunnie
ba9b136f87 debugging alignment issues on serialization of compound structures 2021-11-15 04:03:55 +08:00
bunnie
94a86c542d add an entrails parser for the PDDB 2021-11-14 19:02:34 +08:00
bunnie
8b59bcdf61 add indices to create_image output
makes it easier to figure out what IniE section corresponds
with which PID.
2021-11-06 21:03:28 +08:00
bunnie
c87acaeddc clarify a bit of rounding code in the create-image routine 2021-11-06 20:30:01 +08:00
bunnie
6360d1c902 tighten up the hard-coded locations for the trng test
these locations look good for a while, now that i see the
structure of data allocation (it's split between top and bottom)
2021-10-31 02:58:43 +08:00
bunnie
5f327126ab Merge branch 'bunnie-dev' of github.com:betrusted-io/xous-core into bunnie-dev 2021-10-30 03:16:13 +08:00
bunnie
72df2ff7e4 commit tester stability tweaks 2021-10-30 03:15:53 +08:00
bunnie
ad66460543 move the trng tester ram locations on the corresponding host-side test script 2021-10-30 03:14:33 +08:00
bunnie
73c131cbcc fix help message 2021-10-07 01:09:53 +08:00
bunnie
42e298d79b add a sleep between update commands 2021-10-05 22:34:53 +08:00
bunnie
792ad953eb add wf200 artifacts to the update script 2021-10-05 22:28:30 +08:00
bunnie
2e40546a88 add a force overwrite option to the updater for the soc mode 2021-10-04 16:30:41 +08:00
bunnie
0f00e36dea loader was never updated. oops. 2021-10-04 16:26:33 +08:00
bunnie
6b0b768081 add a line break on the exit to call out the reminder 2021-10-04 15:48:37 +08:00
bunnie
e3ff753e83 add a line break on the help message 2021-10-04 15:48:23 +08:00
bunnie
9994b38e16 clarify update_ci role with respect to the SOC image 2021-10-04 15:47:02 +08:00
bunnie
7bfdce147c modify the update_ci script to be aware of the release tree 2021-10-04 15:38:04 +08:00
bunnie
966615270f update trng test wdt ping method 2021-09-09 22:38:51 +08:00
bunnie
f3786b01a1 Merge branch 'main' of github.com:betrusted-io/xous-core into main 2021-09-07 19:01:02 +08:00
bunnie
840cccecda make the filename more obvious for the purpose of the legacy update script 2021-09-07 19:00:34 +08:00
bunnie
da9078749f add a script for xous 0.8 devices. because there are still a couple out there 2021-09-07 18:59:47 +08:00
bunnie
e510525a0a move wycheproof-import to tools 2021-09-06 14:42:19 +08:00
bunnie
e57587d9c8 update documentation to reflect bitstream padding added to align AES blocks 2021-09-05 18:31:42 +08:00
bunnie
0ae2d13602 update trng_test.py to xous 0.9 2021-09-05 17:47:52 +08:00
bunnie
d20a06e4eb fix update script to use the correct precursor 2021-08-30 03:30:45 +08:00
bunnie
69d9e38c8b add EC updates to the CI update script 2021-08-24 23:22:41 +08:00
bunnie
33d14b6ee3 add some timeouts after each phase, for the device to reboot 2021-08-24 22:59:10 +08:00
bunnie
1af98f7e43 Merge branch 'main' of github.com:betrusted-io/xous-core into bunnie-dev 2021-08-24 22:39:50 +08:00
bunnie
99ff36f529 add a quick CI update script 2021-08-24 22:37:31 +08:00
bunnie
a2bcf0fc2b match wdt ping to refactor + fix paths for default images to xous 2021-08-23 05:11:14 +08:00
bunnie
ccc577f8d7 clean up the update flow 2021-08-16 02:46:54 +08:00
bunnie
353311b987 fix USB update flow 2021-08-15 16:03:18 +08:00
bunnie
f334199ee6 commit host mode debugging 2021-08-12 23:01:34 +08:00
bunnie
ec6a3fd1a3 self-signing working, but the patch to use the SHA hash engine seems to be disregarded... 2021-08-09 03:27:43 +08:00
bunnie
d86c78eea8 partial progress on self-signing 2021-08-03 04:58:34 +08:00
bunnie
825322c730 add explicit .iter() for arrays so we still work with Rust 1.51 2021-07-18 16:04:22 +08:00
Sean Cross
aaa4407e21 sign-image: enable kernel image signing
Previously we only supported signing the loader. This also adds the
kernel as a thing that can be signed.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-07-15 16:39:35 +08:00
Sean Cross
f0bd6c6cd3 Merge branch 'sign-image' 2021-07-13 20:11:27 +08:00
bunnie
a4f8346c34 reflect the latest fixes to the secure boot process
also patch up some issues with sha512 reset and loose
ends on docs and updates
2021-07-13 00:46:31 +08:00
bunnie
5d62af49a5 simple signature checks in the bootloader now
checks xous.img as a single blob before accepting it.
2021-07-12 17:16:22 +08:00
bunnie
2b19f31da9 set the stage for simple signature validation on the kernel 2021-07-12 02:26:50 +08:00
bunnie
b31ff527a3 more help for dealing with python shittiness 2021-07-11 17:01:56 +08:00
bunnie
3359267eb0 update with some hints that hopefully make installation easier 2021-07-11 17:00:38 +08:00
Sean Cross
31551a6227 tools: add sign-image
Add a Rust implementation of `sign-image`. This enables us to sign the
binary on any platform that can compile Rust.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-07-11 16:34:23 +08:00
bunnie
dfb8d89866 add comments about where to get packages from 2021-07-11 14:13:34 +08:00
bunnie
1949c1bbc9 a semblance of sanity, finally 2021-07-09 23:01:50 +08:00
bunnie
057d9895a6 beginnings of image signing 2021-07-06 17:31:09 +08:00
bunnie
a25f244426 Merge branch 'bunnie-dev' of github.com:betrusted-io/xous-core into bunnie-dev 2021-07-04 01:50:55 +08:00
bunnie
f63b29cadd fix bugs in the trng tester helper script 2021-07-04 01:50:31 +08:00
bunnie
22906ce366 make the defaults for usb_update.py map to something immediately usable in-situ 2021-07-02 04:27:26 +08:00
bunnie
25ea2c9cf9 move obsolete script into tools directory and update readme 2021-06-30 00:12:46 +08:00
bunnie
7ff4824eb6 add routines to copy audio test files to the device 2021-06-23 19:07:59 +08:00
bunnie
d5c30fae00 tighten up the CPU halt periods to just around the USB burst reads 2021-06-12 15:13:35 +08:00
bunnie
75f15df723 relax polling of target ready in trng test script 2021-06-12 04:26:30 +08:00
bunnie
c1734334fb add retries around all functions 2021-06-12 03:41:45 +08:00
bunnie
406aa9405d put the trng tester host-side helpe script inside the tools directory 2021-06-12 01:50:17 +08:00
bunnie
758bb64578 Merge branch 'bunnie-dev' of github.com:betrusted-io/xous-core into bunnie-dev 2021-06-02 04:04:21 +08:00
bunnie
1f7add35a1 update docs for usb updater 2021-06-02 04:04:04 +08:00
bunnie
fadc9c29ab Merge remote-tracking branch 'origin/master' into bunnie-dev 2021-06-02 03:59:25 +08:00
bunnie
b9f3182bb9 mods for hosted mode to work again 2021-06-02 03:45:15 +08:00
bunnie
8145473167 remove what i think is no longer a necessary comment 2021-05-25 05:31:21 +08:00
bunnie
8398d22102 fix readme 2021-05-25 03:56:19 +08:00
bunnie
40b4f26dcb fix alignment bug on erase blocks for usb_update.py 2021-05-25 03:54:37 +08:00
bunnie
548126d1b6 add a maintenance note to the docs 2021-05-23 15:11:11 +08:00
bunnie
e1d0dc2178 add USB updater scripts to xous-core 2021-05-23 14:55:43 +08:00
Sean Cross
f7ae13da44 tools: run cargo fmt on pnam
Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-19 14:20:22 +08:00
Sean Cross
2e4fb672ab arguments: document and add pnam tag
The `PNam` tag stores information in the kernel about process names.
This can be used at runtime to discover what process maps to what
program name.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-05-10 14:37:33 +08:00
Sean Cross
86140dfb35 tools: specify v0.4 for log
Signed-off-by: Sean Cross <sean@xobs.io>
2021-02-06 16:36:34 +08:00
Sean Cross
7b50d00eb8 repo: run cargo fmt
This reformats line endings to be consistent, and reinforces the
contents of `.gitattributes`.

Signed-off-by: Sean Cross <sean@xobs.io>
2021-01-03 18:31:51 +08:00
hasheddan
a4d18d6db2
Update tools README.md links to other docs
Fixes links in tools directory README.md to top-level documentation.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-12-06 10:40:45 -06:00
Sean Cross
96df91f53b create-image: support generating an image from an svd
Now that we can parse svd files, support creating an image using an svd
instead of a csv file.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-10-05 11:37:44 +08:00
Sean
ba320184b0 tools: create-image: print out error when csr.csv can't be opened
Signed-off-by: Sean <xobs@ci.betrusted.io>
2020-10-03 20:32:31 +08:00
Sean Cross
10ecacd136 kernel: native: create process for initial processes
These all need to bootstrap themselves.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-08-09 23:08:54 +08:00
Sean Cross
09be029ad0 tools: refactor to make clippy happy
This fixes a lot of small clippy warnings.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-07-29 20:02:58 +08:00
Sean Cross
14bb1ac1e5 kernel: working on getting process termination functioning
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-22 17:42:24 +08:00
Sean Cross
973945fce2 tools: read-tags: fix bad pointer arithmetic
This removes raw pointer usage that could cause unaligned accesses.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-15 12:30:21 +08:00
Sean Cross
7da67f050a tools: fix most clippy warnings
Signed-off-by: Sean Cross <sean@xobs.io>
2020-06-15 12:04:23 +08:00
Sean Cross
5aa3358bc0 tools: generate byte addresses for mini elf files
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-12 15:29:26 +08:00
Sean Cross
4645816674 tools: elf: add comment and dead code for alignment fixing
This issue was spotted when the kernel address was wrong.  This fixed
the test, but was indicative of something else being wrong.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-10 14:43:15 +08:00
Sean Cross
edf723e107 create-image: verify the kernel image address is sane
Rust inconsistently applies linker scripts.  Verify the image being
added has a script that makes sense.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-10 14:42:01 +08:00
Sean Cross
36dbc97a61 tools: pad inie and xkrn tags to 4-bytes
This fixes an issue where images were not word-aligned.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-10 13:12:27 +08:00
Sean Cross
6959b4ef77 tools: rename from xous-tools
Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-10 12:46:20 +08:00
Sean Cross
f50ec67553 initial commit
This pulls together many disparate repositories into one xous-core
repository.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-03-10 12:13:05 +08:00