- fix problem where we were generating a size based off of total disk
size, instead of fraction of available space
- enumerate FSCB entries into the page table scan. This is because
the page table cache could hold used entries that aren't reflected
in the low-level disk scan, and there is no way to trigger a
flush at the point of re-allocation.
- add an autotrigger feature for the basis stress test so it can
be run in a fuzzer loop
- various fixes and improvements to the implementation to help
integrate with CI
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 ServerID return type was placed in the middle of the results list,
which caused results 8-15 to be shifted by one to become results 9-15,
with result 8 being swapped with result 15.
This fixes this offset.
Signed-off-by: Sean Cross <sean@xobs.io>
When the "autobasis" feature is selected, the hardware block
will track all basis that have been opened and unlock them when
it comes time to scan/generate more FSCB space. It also bypasses
all UX normally invoked.
This allows us to create tests that open and close Bases automatically,
but of course, totally destroys the notion of plausible deniability.
So, don't turn the feature on for production.
As the REPL format comes from
[Renode Platform](https://github.com /renode/renode),
I believe the word 'Rebide' to be a typo for 'Renode'
(given the proximity of the letters on a keyboard).
Let's hope it'll make this tool more prominent in search results.
Signed-off-by: Ludovic LANGE <llange@users.noreply.github.com>
need to cover the case that no enumeration was done, and just
show a "null" list confirming basically nothing other than
the system basis is disclosed.
1. the large key read algorithm was broken. this is now fixed. we only
saw this triggered when the large key was much larger than 8kiB (and
the original CI tests just use 8kiB keys for "large").
2. the cursor position in read() and write() were being incremented
by the expected read amount, not the actual read amount.
This has worked in testing, but:
- There seems to be a new error unrelated to this with allocating
very large blocks of memory, which needs to be traced down.
- Because this operation will typically fully block the caller,
UX redraws can't happen (unless the caller has a fully multithreaded
redraw routine). This needs some thought because:
1. If you have several basis you're trying to unlock, eventually,
you'll overflow the application incoming queue with redraw requests,
and the system will crash.
2. It's cosmetically disturbing to have the dialog boxes piling up
on top of each other during a critical operation like this.
I *think* the right thing to do is to refactor the GAM a bit
to handle pop-up modals that block a bit more gracefully. But
I think it's more urgent to trace down the problem with large blocks
of memory being allocated, since it is a functional issue and not
a cosmetic one.
Instead of passing a constructed mutable ref from the pagetable entry,
pass a raw pointer and use `read_volatile()` / `write_volatile(x)` on
this pointer.
This should remove a little bit of UB from the kernel.
Signed-off-by: Sean Cross <sean@xobs.io>
Previously, the kernel would dutifully try to map memory that was in the
kernel space. It did this by investigating the kernel memory offset,
which immediately causes a double-fault.
Check to make sure a userspace process is not trying to map kernel
memory before checking the valid page.
Signed-off-by: Sean Cross <sean@xobs.io>
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.
I had thought there was an issue with heap size limit increases
and multithreading but I think actually the problem is the
PDDB runs pretty close to the stack size limit. This increases
the stack size limit for the PDDB on boot and also bumps up
the heap limit so caching can work more flawlessly.