quick-xml 0.19.0, a dependency of svd2utra, uses features
that Rust will deprecate.
Unfortunately, the only versions of quick-xml that do not
use the deprecated language features also break a portion
of the API. In particular, quick-xml will no longer take
a `File` as an input: it will only take a `Path`.
This means that the API for svd2utra is also broken, because
originally it was designed to take a `File`
This patch refactors svd2utra to work with the latest quick-xml,
but also breaks any code that calls svd2utra's generate
APIs.
Fortunately this is fairly easy to fix, the calling code
will typically already have the Path somewhere in it, so
instead of opening the Path and passing it into the function,
one may simply pass in the Path.
this commit adds the facilities to extract eh_frame[_header]
sections and pass it to each process.
A bump is required to `std` to extract the passed parameters.
Sections of the MiniElf are now aligned as required by the
source ELF requirements. This is required for direct-mapping
with XIP.
the overhead is just a few bytes every couple of programs, so it's
a small price to pay for XIP.
figured out a way to modify the trait so that alignments
are 0 by default, and only set/reported for IniF,
on a per-process basis so if for some reason the alignments
change we should be OK.
Turns out, the pointing end of the stick for ELF sections don't start
at a page boundary. For example:
5 IniF: entrypoint @ 0001e42e, loaded from 000440f4. Sections:
Loaded from 000440f4 - Section .rodata 16924 bytes loading into 000100f4..00014310 flags: NONE
Loaded from 00048310 - Section .eh_frame_hdr 1772 bytes loading into 00014310..000149fc flags: NONE
Loaded from 000489fc - Section .eh_frame 6004 bytes loading into 000149fc..00016170 flags: NONE
Loaded from 0004a170 - Section .text 59876 bytes loading into 00017170..00025b54 flags: EXECUTE
Loaded from 00058b54 - Section .sdata 48 bytes loading into 00026b54..00026b84 flags: WRITE
Loaded from 00058b84 - Section .sbss 48 bytes loading into 00026b84..00026bb4 flags: WRITE | NOCOPY
Loaded from 00058bb4 - Section .bss 516 bytes loading into 00026bb8..00026dbc flags: WRITE | NOCOPY
Here you can see, the data is "loading into" 0x100f4, not
0x10000. The original PR would align things to a page, which means
you'd still have an offset mismatch if you tried to map these directly
over.
This patch causes IniF to insert extra padding to target
the offset necessary for the MiniElf to map 1:1.
An important assumption is the offset is constant across all
programs being linked. This seems to be the case, but, if this
assumption breaks, then the padding will also break.
this allows precursorupdater to run on older platforms that
don't support the very latest greatest pythons
instead we have a hand-rolled bip-39 implementation that we're using.
Python. ¯\_(ツ)_/¯
bip_utils is not sufficiently compatible with enough platforms
to be worth integrating. we use a hand-rolled bip-39 implementation
instead to eliminate the dependency.
commit a09100ab4a
Author: bunnie <bunnie@kosagi.com>
Date: Fri Dec 30 15:55:55 2022 +0800
bump lockfile
commit 53172e1471
Author: bunnie <bunnie@kosagi.com>
Date: Fri Dec 30 15:46:40 2022 +0800
bump verification pins
commit 36398810dd
Author: bunnie <bunnie@kosagi.com>
Date: Fri Dec 30 15:24:36 2022 +0800
bump version numbers to absorb new syscalls
commit 062fa6178a
Merge: ac4a854e3bcc955a
Author: bunnie <bunnie@kosagi.com>
Date: Fri Dec 30 15:23:31 2022 +0800
Merge branch 'reply-and-receive-next-syscall' into main
commit ac4a854e49
Merge: d1375343e4c298db
Author: bunnie <bunnie@kosagi.com>
Date: Fri Dec 30 15:22:25 2022 +0800
Merge branch 'main' of github.com:betrusted-io/xous-core into main
commit 3bcc955aba
Author: bunnie <bunnie@kosagi.com>
Date: Fri Dec 30 15:21:43 2022 +0800
add test code that also benchmarks the new routines.
commit e4c298db40
Merge: f71278b4e2bf7109
Author: bunnie <bunnie@kosagi.com>
Date: Fri Dec 30 15:16:13 2022 +0800
Merge pull request #289 from betrusted-io/reply-and-receive-next-syscall
Reply and receive next syscall
commit e2bf710939
Author: Sean Cross <sean@xobs.io>
Date: Thu Dec 29 21:06:51 2022 +0800
services: xous-ticktimer: use reply_and_receive_next()
Convert the ticktimer server to use the new
reply_and_receive_next_legacy() call. This is an example of how to use
this API for future projects.
Signed-off-by: Sean Cross <sean@xobs.io>
commit 0e75b8e479
Author: Sean Cross <sean@xobs.io>
Date: Thu Dec 29 21:05:26 2022 +0800
test-spawn: rename `Message` to `MessageEnvelope`
Signed-off-by: Sean Cross <sean@xobs.io>
commit 3218bde2b4
Author: Sean Cross <sean@xobs.io>
Date: Thu Dec 29 21:04:01 2022 +0800
kernel: implement reply_and_receive_next
Implement `ReplyAndReceiveNext` as a syscall. This will reply to a
message, pull the next message out of the queue, and then re-queue the
server to run. This should make servers much more responsive.
This patch has been tested on both hosted and native modes.
Signed-off-by: Sean Cross <sean@xobs.io>
commit d1375343c1
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 29 23:34:48 2022 +0800
update release notes
commit f71278b422
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 29 22:04:55 2022 +0800
fix issue #109 - refactor key fill/scan to not crash after pruning
After a prune, key fill/scan can crash because there is an assumption
that data is always resident in the cache for a small key.
This code handles the case where the small key data was evicted during
a prune, and reads the data back in just for that key on demand.
Furthermore, during a `sync` call, it will pull in the key data
that corresponds to the page containing just the small key, allowing
that page to be re-composed and replaced in memory. caching is used
on the decryption of the small key page so the expensive bit
of the call should only happen once per small key bank.
tested with pddb-ci and manually in hosted mode.
A portion of code was re-written to make it clear that only the
length of allocated data is copied to/from disk and memory, instead
of the reserved space as the previous code would indicate. The reserved
space is guaranteed to be zero because the RAM-based page for composing
the small key block is zero-ized prior to operations; left comments
reminding me of this in the future so I don't accidentally optimize
something out and cause data leakage between small keys because I'm
allowing the reserved areas to contain stale data.
commit e25da3a720
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 29 22:04:15 2022 +0800
add implemenation of the `prune` debug call
this allows us to trigger the cache prune manually, instead of
in response to memory backpressure only
commit 549e67fead
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 29 22:03:19 2022 +0800
add a `prune` debug call to force a hard-prune of the pddb cache
commit e045574d39
Author: Sean Cross <sean@xobs.io>
Date: Thu Dec 29 21:06:51 2022 +0800
services: xous-ticktimer: use reply_and_receive_next()
Convert the ticktimer server to use the new
reply_and_receive_next_legacy() call. This is an example of how to use
this API for future projects.
Signed-off-by: Sean Cross <sean@xobs.io>
commit 23c17d7632
Author: Sean Cross <sean@xobs.io>
Date: Thu Dec 29 21:05:26 2022 +0800
test-spawn: rename `Message` to `MessageEnvelope`
Signed-off-by: Sean Cross <sean@xobs.io>
commit aae5f3737c
Author: Sean Cross <sean@xobs.io>
Date: Thu Dec 29 21:04:01 2022 +0800
kernel: implement reply_and_receive_next
Implement `ReplyAndReceiveNext` as a syscall. This will reply to a
message, pull the next message out of the queue, and then re-queue the
server to run. This should make servers much more responsive.
This patch has been tested on both hosted and native modes.
Signed-off-by: Sean Cross <sean@xobs.io>
commit ab0c7d3b32
Author: Sean Cross <sean@xobs.io>
Date: Thu Dec 29 21:03:39 2022 +0800
kernel: server: check buf is some when returning mem
Signed-off-by: Sean Cross <sean@xobs.io>
commit 46f340324d
Author: Sean Cross <sean@xobs.io>
Date: Thu Dec 29 21:02:57 2022 +0800
kernel: rename `Message` -> `MessageEnvelope`
This syncs with the latest changes to `xous-rs`.
Signed-off-by: Sean Cross <sean@xobs.io>
commit 911ddb60fc
Author: Sean Cross <sean@xobs.io>
Date: Thu Dec 29 21:01:27 2022 +0800
kernel: debug: fix klog on baremetal
klog() refers to an outdated `.uart` struct, which has since been
renamed to `.serial`.
Signed-off-by: Sean Cross <sean@xobs.io>
commit d88254b1b1
Author: Sean Cross <sean@xobs.io>
Date: Thu Dec 29 21:00:35 2022 +0800
xous: add reply_and_receive_next_legacy call
This call is used to return values while simultaneously listening for
new messages.
The -legacy suffix is used to disambiguate scalar values, so we know
whether to send Scalar1, Scalar2, or Scalar5 messages.
Signed-off-by: Sean Cross <sean@xobs.io>
commit 64c88f9942
Author: Sean Cross <sean@xobs.io>
Date: Thu Dec 29 21:00:05 2022 +0800
xous: add Message type
This type actually contains the message contents, and will be used to
return data to the caller.
Signed-off-by: Sean Cross <sean@xobs.io>
commit d463f9563f
Author: Sean Cross <sean@xobs.io>
Date: Thu Dec 29 20:58:51 2022 +0800
xous: rename Message to MessageEnvelope
This reflects the fact that up until now, the `Message` struct has
merely been the envelope that surrounds the message. It does not contain
any actual Message contents.
Signed-off-by: Sean Cross <sean@xobs.io>
commit 49ce85f9a8
Author: Sean Cross <sean@xobs.io>
Date: Wed Jul 6 15:57:10 2022 +0800
ticktimer-server: prepare for using ReplyAndReceiveNext
Misc cleanup prior to switching which call we use.
Signed-off-by: Sean Cross <sean@xobs.io>
commit be56af6303
Author: Sean Cross <sean@xobs.io>
Date: Wed Jul 6 15:35:22 2022 +0800
xous: add wrapper for reply_and_receive_next
This wrapper enables userspace programs to use the new
ReplyAndReceiveNext syscall easily.
Signed-off-by: Sean Cross <sean@xobs.io>
commit 36e6e6c30b
Author: Sean Cross <sean@xobs.io>
Date: Wed Jul 6 15:18:32 2022 +0800
xous: syscall: add ReplyAndReceiveNext call
Signed-off-by: Sean Cross <sean@xobs.io>
commit 1e56598b10
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 29 00:53:32 2022 +0800
chore: fix some typos
commit 1291b0f00b
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 29 00:38:27 2022 +0800
add issue # to release note
commit 7206f24271
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 29 00:37:47 2022 +0800
update release notes
commit 2f30e1b50a
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 29 00:11:03 2022 +0800
implement #269
commit 5370c333da
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 29 00:10:42 2022 +0800
add callback for monitoring basis lock/unlock events
commit 8d42feb051
Author: bunnie <bunnie@kosagi.com>
Date: Wed Dec 28 19:48:40 2022 +0800
increase heap for mtxcli; add memory usage reporting
commit ac1df054ab
Author: bunnie <bunnie@kosagi.com>
Date: Mon Dec 26 13:52:44 2022 +0800
absorb 22-bit satp fix
commit 89500015a7
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 15 17:52:55 2022 +0800
try to fix regression from #284
still hitting cache coherence edge cases. expanding the flush
set read by one more way.
commit 41ea0a37c5
Merge: e422740db288d93a
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 15 14:36:40 2022 +0800
Merge branch 'main' of github.com:betrusted-io/xous-core into main
commit b288d93abd
Merge: 8e1d0502d4527b82
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 15 14:00:10 2022 +0800
Merge pull request #284 from betrusted-io/use-thin-lto
cargo: use thin-lto
commit d4527b8227
Author: Sean Cross <sean@xobs.io>
Date: Thu Dec 15 12:26:00 2022 +0800
cargo: use thin-lto
Use thin LTO for linking. This shouldn't have too big of an affect on
the resulting binary size, and it fixes the build for 1.66.0:
= note: rust-lld: error: undefined symbol:
core::panicking::panic_str_nounwind::h9b449c0fe03c8dac
>>> referenced by compiler_builtins.22a3dcb1-cgu.13
>>> compiler_builtins-b913bacb8fda1c55.compiler_builtins.22a3dcb1-cgu.13.rcgu.o:(compiler_builtins::math::libm::rem_pio2_large::rem_pio2_large::h3db6431f23a281c1)
in archive root\lib\rustlib\riscv32imac-unknown-xous-elf\lib\libcompiler_builtins-b913bacb8fda1c55.rlib
>>> referenced by compiler_builtins.22a3dcb1-cgu.13
>>> compiler_builtins-b913bacb8fda1c55.compiler_builtins.22a3dcb1-cgu.13.rcgu.o:(compiler_builtins::math::libm::rem_pio2_large::rem_pio2_large::h3db6431f23a281c1)
in archive root\lib\rustlib\riscv32imac-unknown-xous-elf\lib\libcompiler_builtins-b913bacb8fda1c55.rlib
Signed-off-by: Sean Cross <sean@xobs.io>
commit e422740d37
Author: bunnie <bunnie@kosagi.com>
Date: Tue Dec 13 23:03:50 2022 +0800
chore: last one. really.
commit ad79ebf8ba
Author: bunnie <bunnie@kosagi.com>
Date: Tue Dec 13 23:02:09 2022 +0800
chore: more typos. no really, i can stop at any time.
commit b1b6d46d27
Author: bunnie <bunnie@kosagi.com>
Date: Tue Dec 13 22:56:37 2022 +0800
chore: more typos
probably should not have tried to spell check this, now i'm wasting
my time.
commit 283ea1de0d
Author: bunnie <bunnie@kosagi.com>
Date: Tue Dec 13 22:49:25 2022 +0800
chore: fix more typos, add french dictionary to vscode workspace settings
commit 1d94968b2f
Author: bunnie <bunnie@kosagi.com>
Date: Tue Dec 13 22:36:47 2022 +0800
chore: fix typos
commit e930d88563
Author: bunnie <bunnie@kosagi.com>
Date: Tue Dec 13 01:42:00 2022 +0800
placeholder for 0.9.12 release notes
commit 8e1d05020d
Author: bunnie <bunnie@kosagi.com>
Date: Tue Dec 13 00:32:11 2022 +0800
add v0.9.11 to the restore.py URL list
commit bd230f5bb0
Author: bunnie <bunnie@kosagi.com>
Date: Mon Dec 12 16:51:27 2022 +0800
fix text to speech mode preferences setting
never allow the audio system to be turned off for blind people,
and disallow 0-volume setting as well.
commit 38bc254bb9
Author: bunnie <bunnie@kosagi.com>
Date: Mon Dec 12 16:28:33 2022 +0800
fix missing ja/zh translation
commit 60d4482ce2
Author: bunnie <bunnie@kosagi.com>
Date: Mon Dec 12 16:16:04 2022 +0800
bump lockfile
commit 56f0843229
Author: bunnie <bunnie@kosagi.com>
Date: Mon Dec 12 16:08:28 2022 +0800
bump verifier numbers
commit 5370ce396d
Author: bunnie <bunnie@kosagi.com>
Date: Mon Dec 12 16:07:20 2022 +0800
bump all revs due to SoC artifact update
commit cac0e57cda
Author: bunnie <bunnie@kosagi.com>
Date: Mon Dec 12 16:06:31 2022 +0800
change default target
commit 04b441a234
Author: bunnie <bunnie@kosagi.com>
Date: Mon Dec 12 16:06:19 2022 +0800
add 0.9.11 build artifact
commit 08cf863ff5
Author: bunnie <bunnie@kosagi.com>
Date: Mon Dec 12 16:05:15 2022 +0800
update SoC artifacts for 0.9.11 build
commit c32b5d5bac
Author: bunnie <bunnie@kosagi.com>
Date: Mon Dec 12 15:31:15 2022 +0800
bump release notes
commit 80ce119c95
Author: bunnie <bunnie@kosagi.com>
Date: Mon Dec 12 15:31:06 2022 +0800
fix RSSI calculations
commit edf24d9fc2
Author: bunnie <bunnie@kosagi.com>
Date: Mon Dec 12 14:11:19 2022 +0800
clean up on the wifi signal bars
commit eb17edc4ec
Merge: 9a580070435a6ea2
Author: bunnie <bunnie@kosagi.com>
Date: Mon Dec 12 11:47:18 2022 +0800
Merge pull request #283 from gsora/feat/wifi-signal-bars
feat: wifi signal bar
commit 9a580070a3
Author: bunnie <bunnie@kosagi.com>
Date: Sun Dec 11 17:50:51 2022 +0800
revert threaded init question now that deface issue is fixed
commit f9cdf31857
Author: bunnie <bunnie@kosagi.com>
Date: Sun Dec 11 17:07:29 2022 +0800
bump release notes
commit 196ceb0d29
Author: bunnie <bunnie@kosagi.com>
Date: Sun Dec 11 16:42:03 2022 +0800
fix: avoid thrashing when recomputing previously defaced canvases
There was a dubious line that I never felt good about and today
I found out why. By flipping every canvas to drawable before doing
the intersection computation we also throw away the defacement state,
so previously defaced canvases would lose their status bit, causing
thrashing of the canvases anytime there is a re-computation of
the canvas ordering.
This fix caches if a canvas was already defaced, and if it turns out
that an on-screen canvas should not be drawable but was already
defaced, the setting is re-applied, preventing thrashing.
commit dca043d387
Author: bunnie <bunnie@kosagi.com>
Date: Sun Dec 11 16:41:53 2022 +0800
improve context swap debug messages
commit 8d8dd2bd2f
Author: bunnie <bunnie@kosagi.com>
Date: Sun Dec 11 16:41:25 2022 +0800
fix typo in unwrap message
commit f31afa5125
Author: bunnie <bunnie@kosagi.com>
Date: Sun Dec 11 16:41:06 2022 +0800
remove unused opcode in shellchat; improve debug output
commit 6138b65d76
Author: bunnie <bunnie@kosagi.com>
Date: Sat Dec 10 23:44:18 2022 +0800
update comments to reflect changes in CI infra
commit 399124f942
Author: bunnie <bunnie@kosagi.com>
Date: Sat Dec 10 22:05:47 2022 +0800
fix hosted mode
commit 939e13950d
Author: bunnie <bunnie@kosagi.com>
Date: Sat Dec 10 18:59:55 2022 +0800
comment out debug in rootkeys implementation section
commit 2097afc166
Author: bunnie <bunnie@kosagi.com>
Date: Sat Dec 10 18:58:06 2022 +0800
add efuse burning flow to rootkeys
currently only available for builds that have the `efuse` feature
enabled
commit 19e16aea29
Author: bunnie <bunnie@kosagi.com>
Date: Sat Dec 10 18:56:59 2022 +0800
fix jtag fuse burning & add diagnostic messages
- msb/lsb swap on efuse bank fixed
- hazardous-debug feauter gates added
- dry-run for "testing only" added
commit 4ec866e1d7
Author: bunnie <bunnie@kosagi.com>
Date: Sat Dec 10 18:56:12 2022 +0800
add diagnostic seal command
commit f5c687a524
Author: bunnie <bunnie@kosagi.com>
Date: Sat Dec 10 17:45:30 2022 +0800
clarify user prompt
commit 2b4e47384e
Author: bunnie <bunnie@kosagi.com>
Date: Sat Dec 10 17:44:54 2022 +0800
add fused device support and warnings to precursorupdater
commit e42c4c7b33
Author: bunnie <bunnie@kosagi.com>
Date: Sat Dec 10 16:39:14 2022 +0800
add warnings & support for fused devices
burning a generic image to a fused device will surely lead to
a brick, so, try to keep a user from shooting themselves in the foot.
commit c2f7a63f97
Author: bunnie <bunnie@kosagi.com>
Date: Sat Dec 10 16:39:01 2022 +0800
remove some whitespace to allow for easier debugging
commit 1f89843122
Author: bunnie <bunnie@kosagi.com>
Date: Fri Dec 9 12:38:53 2022 +0800
defer init root keys question until status thread starts
also defer the preference thread from loading until after the
PDDB mount thread is started -- doesn't make sense to start it
any earlier than that, since it depends on the PDDB being mounted.
commit 02f9701546
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 8 17:42:12 2022 +0800
make an explicit dvt feature to simplify flags
commit 4dd983bfc4
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 8 17:19:05 2022 +0800
adjust security parameters for dvt build
commit fc08c3e29d
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 8 17:14:47 2022 +0800
add hazardous-debug to modals bip-39
for convenient key printout during debug. flag is normally off.
commit dd82b7f32a
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 8 17:14:21 2022 +0800
add no-codec mode to status
this is for DVT builds where the codec isn't supported, needed
for efuse testing
commit a5d341c7a6
Author: bunnie <bunnie@kosagi.com>
Date: Thu Dec 8 14:09:36 2022 +0800
add a bitstream encryption/recovery tool for fused devices
This is useful for recovering bricked devices where the backup
key is available. This tool can be used to generate an FPGA
image for a device that has been permanently fused to a non-0
backup key.
commit 4f270f54be
Author: bunnie <bunnie@kosagi.com>
Date: Wed Dec 7 22:24:56 2022 +0800
revert debugging on status opcodes
commit 435a6ea2bd
Author: Gianguido Sorà <me@gsora.xyz>
Date: Wed Dec 7 14:28:07 2022 +0100
feat: wifi signal bar
This commit draws a Wi-Fi signal bar with 5 bars (lowest to highest signal), to the right of SSID name.
Signal power is calculated from a lowest of -90dBm to a maximum of -30dBm, by increments of 13dBm.
commit f84a9d10c7
Author: bunnie <bunnie@kosagi.com>
Date: Sun Dec 4 18:13:37 2022 +0800
add placeholder for the efuse flow in the rootkey service
commit 8208a86c08
Author: bunnie <bunnie@kosagi.com>
Date: Sun Dec 4 18:12:30 2022 +0800
add the UX front-end for backup key burning
- instructions for BBRAM flow (refers to wiki)
- consent for efuse flow
- fix a blocking issue on backup prep (minor problem, just gives
users more time to contemplate without a panic)
commit 3838f3bc15
Author: bunnie <bunnie@kosagi.com>
Date: Sun Dec 4 18:12:05 2022 +0800
add a pause for context swaps on menu release
commit 53c9af1033
Author: bunnie <bunnie@kosagi.com>
Date: Fri Dec 2 23:00:38 2022 +0800
bump readme's
This is useful for recovering bricked devices where the backup
key is available. This tool can be used to generate an FPGA
image for a device that has been permanently fused to a non-0
backup key.
GCC will set the text size to `0` in a certain case that `rust-lld` did
not. This causes the elf copier to add about 512 MB to the image which
it otherwise shouldn't be doing.
Add a workaround that appears to fix the issue.
Signed-off-by: Sean Cross <sean@xobs.io>
During the previous port, we only wrote the first 4096 bytes. Write the
remainder of the file to the destination.
Signed-off-by: Sean Cross <sean@xobs.io>
This experimental tool can be used to create all-in-one images based
on precomputed file lists. It generates "test images" using just the
bare minimum number of processes.
This program includes all the keys, kernel, and initial images required
to support a simple program.
Signed-off-by: Sean Cross <sean@xobs.io>
Instead of assuming everything is a file or a path, allow
loading ELF files from u8 slices. This will enable us to create
images with `include_bytes!()`.
Signed-off-by: Sean Cross <sean@xobs.io>
Move the code used to sign images into its own library file. This will
enable us to use the image signing functions from other code.
Signed-off-by: Sean Cross <sean@xobs.io>
The rationale is that xous-rs should have only architecture
specific code, e.g.: riscv, arm, x86, etc. To make other
crates that depend on it not specify the features.
This could be useful when using xous-rs with `libstd`
for example.
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
this tries to catch the cases that:
- user tried to run the backup without first running "prepare backup..."
- the USB connection is a little flakey and returning bum data
We can only inspect the plaintext portions of the header, which contains
things like protocol version numbers, time stamps, and language codes.
We use the timestamp validation heavily because it's the only field that
isn't almost always going to be a 0 or 1 when correct, which are highly
likely to be reported anyways if there's a problem with the USB link.
This does assume the user sets the time correctly on the device
doing the backup, and on the Precursor itself.
This adds the `--dump` command, which requires a file that is
a copy/paste of a generated virtual to physical table. An example
of this log would look like this:
```
INFO:shellchat::cmds::net_cmd: V|P 6000d000 40799000 (services\shellchat\src\cmds\net_cmd.rs:770)
INFO:shellchat::cmds::net_cmd: V|P 6000e000 4079a000 (services\shellchat\src\cmds\net_cmd.rs:770)
INFO:shellchat::cmds::net_cmd: V|P 6000f000 4079b000 (services\shellchat\src\cmds\net_cmd.rs:770)
INFO:shellchat::cmds::net_cmd: V|P 60010000 4079c000 (services\shellchat\src\cmds\net_cmd.rs:770)
INFO:shellchat::cmds::net_cmd: V|P 60011000 4079d000 (services\shellchat\src\cmds\net_cmd.rs:770)
INFO:shellchat::cmds::net_cmd: V|P 60012000 4079e000 (services\shellchat\src\cmds\net_cmd.rs:770)
INFO:shellchat::cmds::net_cmd: V|P 60013000 4079f000 (services\shellchat\src\cmds\net_cmd.rs:770)
INFO:shellchat::cmds::net_cmd: V|P 60014000 407a0000 (services\shellchat\src\cmds\net_cmd.rs:770)
INFO:shellchat::cmds::net_cmd: V|P 60015000 407a1000 (services\shellchat\src\cmds\net_cmd.rs:770)
```
and so forth. The script can parse this raw log to create the necessary
page table mappings to read a large region of virtual memory and save
it as a contiguous chunk in a file.
It's a bit confusing to run the wrong tool but hopefully there
are ample help messages sprinkled in this to guide the average
user to the right location.
also print the sector data that errors out -- might be a bit
much at the moment but it's very helpful for immmediately
visualizing a loss-of-power event related write corruption
the loader is a little funky, and requires some maintainer hand-holding
due to the split of the page ownership between the root-keys
crate and the graphics-server crate.
Improved docs so I don't forget this detail in the future.
this allows for a quick readout of the version of each of these
artifacts, inside a signed region, by just inspecting the last
few words of the binary object.
this commits a script that will repeatedly rerun the `btest`
which creates several Bases, fills them with pseudorandom datat,
and goes through a lock/unlock cycle.
should be run with the disk size set to 4MiB for maximum stress
testing (the larger disk won't trigger an FSCB refill because its
hard to run out free space on the larger disk size)
The FPGA gateware region is blocked from trivial readout via USB:
this makes it a tiny bit harder to obtain the gateware image, which
contains the secret keys. This slightly aids users who haven't
burned any efuse keys and are using the default "null" key from
a trivial readout attack, and it also hampers a WBSTAR exploit.
This makes the most convenient path of attack to be loading
a custom xous.img (or otherwise exploiting the kernel) with
a gadget that is capable of reading the gateware region
through priveleged code, and then relaying it over USB through
some run-around of the firewall. This primitive isn't impossible
to create but it doesn't exist and has no use in a normal
operational flow, so, it's going to at least force an attacker
to write some code, as opposed to using off the shelf utilities
we provide.
The `xmas-elf` crate doesn't deal with `raw_data()` of sections that are
`NO_COPY`. These sections may point to data that is outside of the file.
In order to avoid hitting this assert, don't call `raw_data()` on
sections that are marked `NO_COPY`.
Signed-off-by: Sean Cross <sean@xobs.io>
use `usb kbdtest` to output a mapping assuming US-101 maps
it will then derive an appropriate keymap based on that mapping
doesn't support non-ascii characters (yet)
The next release will feature an access control on USB so that
root keys and the encrypted gateware cannot be read back and
transitively the writes would be guttered (but this is not a problem
because the write target address is not set by the memory location
of the write, it's actually set by the location specified in
the program command to the FLASH).
This means that the updating program has to be modified accordingly;
now, for writes, a single location is targeted (and as alluded above,
this is funneled to a write FIFO buffer, and then the actual address is
set with the page program command); and for readback, attempts to read
back the SoC area are flagged and noted as impossible due to security
precautions.
So you'd like to think that an authenticating cipher would like,
authenticate stuff on decryption. And AES-GCM-SIV was billed as sort
of AES with the pointy edges taken off.
Well, there's always one more bug, actually this time a salamander:
https://eprint.iacr.org/2020/1456.pdf Apparently one can forge
authentication if the attacker can control keys and ciphertext. In the
case of the PDDB I think the attack is largely theoretical, because
you'd have to forge through both the AES-GCM-SIV and the rather
insufficient nonce/murmur hash check on the PTE that locates the page
to be decrypted.
But it's never good to have cryptographic properties depend upon
something that's known to be insufficient, so let's assume the attacker
can simply forge keys and stick some data on the device.
This wouldn't be a problem for confidentiality but it could lead to
the ability to plant evidence, but more importantly could lead to code
paths that were thought to be protected against fuzzing being fuzzed
as you could conceivably create a Basis root record that "checked out"
and then the larger body of the PDDB code would try to chomp on other
pages that are forged, leading to a bigger attack surface. Plus who
knows what else might exist beyond salamanders...
This patch does a "key commitment" on the Basis root page, so that it
is now cryptographically hard to create a salamander. Basically
instead of using the system root key directly in AES-GCM-SIV, the key
goes through a KDF that expands it with yet another nonce plus a bit
of header data. The KDF is SHA512/256 and it expands it twice,
changing one bit in the header data (as prescribed by the paper cited
above), to create a version of the key that is written to disk (the
commitment), and a version of the key that is used to
decrypt/authenticate the AES-GCM-SIV data. Only if both the commitment
and the authentication check out, do we accept a Basis root page as
valid.
I had some concerns about the slightly different structure of the
Basis Root page being detectable, but I have been assured that the key
commitment form and the MAC in AES-GCM-SIV satisfy a property known as
IND$-CPA ("indistinguishable from uniform randomness by a
chosen-plaintext attacker") by Rogaway[1], and, more strongly, "Secure
nonce misuse-resistant authenticated encryption (mrAE)" by Gueron and
Lindell (see appendix for def)[2]. Still, just out of total paranoia
and nothing else, I organize the basis root page such that the MAC is
in the identical location as the other non-committed pages...just in
case there is some mathematical property of the MAC that could be
leveraged to leak info about the existence of the basis root record.
The commitment nonce and sha512/256 result I understand better and
feel pretty comfortable that they are going to be strongly random and
indistinguishable from AES ciphertext.
Thanks to Michael Rosenberg for taking the time to explain all this to
me and to guide me through the process of making the fixes. It is a
major PDDB API-breaking change and I'm glad it's able to be rolled out
before most users have received a device.
[1] https://web.cs.ucdavis.edu/~rogaway/papers/ad.pdf
[2] https://eprint.iacr.org/2015/102