Hi Daniel,
@Brad is more authoritative to speak on this, but absolutely. In particular, I believe the RevB has a chip with memory protection, making it actually amenable to isolating processes (whereas the RevA does not). We've been mostly using the RevA for doing RISC-V development without a board since there is support for it in QEMU, and most of the RISC-V development so far has gone into OpenTitan and the Arty E21, both on FPGAs since real hardware isn't available yet.
If you're interested in working on the HiFive port for a senior design project, I strongly encourage you to do so and we'll help however we can!
-Amit
Any plans on having board support for the HiFive1 RevB? I'm working on my senior design project on IoT security using RISC-V and Rust on the HiFive1 RevB board. I saw Tock on GitHub and it seems kind of interesting. Thanks!
--
You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tock-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/fd924140-4185-4765-a445-0adc6b39bf5f%40googlegroups.com.
Thanks for quick reply Amit,
I'm not a developer necessarily, I'm studying electrical engineering, but I don't mind trying to do the port as Tock seems to align very well with my original intentions. I have a Rev B board in my possession right now and I have another one on order. Rev B uses the FE310-G002 chip and according to the manual, it has 8 PMP registers (physical memory protection) with user and machine modes too. Note that SparkFun has a Red-V board that has the FE310-G002 chip so it has same memory protections as the RevB board and is available for purchase ($40). That would be another board to look into. Let me know where I should start with the porting process, and I'll see if I can make it happen. Appreciate it,
--
You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tock-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/5a3fab52-27fe-4b3f-bdc2-4450dd6634e0%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to tock...@googlegroups.com.
I've decided to try and port Tock to the HiFive1 RevB. I know that the RevA did not have the memory protection features. With that being said, would any of the RevA crates translate to the RevB like the chip and arch crates? It seems that I should start with the Hifive1 arch crate and make adjustments for configuring the memory protection. Any suggestions or comments on starting? Thanks,Daniel
On Thursday, February 20, 2020 at 11:01:20 AM UTC-5, Daniel Hayes wrote:--A while back, I found this Maixduino board from SeeedStudio. It uses their Kendryte 210 chip that has dual-core 64 bit RISC-V IMAC. They have a lot of support for AI type stuff and it has an onboard esp32 module. I have no idea if it has PMP or U-mode, but it's cheap! I also have one of these on hand, haven't played with it yet though. Just another board I thought you guys might be interested in at some point.
On Wednesday, February 19, 2020 at 2:36:34 PM UTC-5, Daniel Hayes wrote:I agree on the HiFive1RevB board being more interesting with the on-board esp32. I've found the GitHub page on porting boards. I don't know how much help I could be, but I'll do anything I can to help move this along. Appreciate it!
On Wednesday, February 19, 2020 at 2:24:04 PM UTC-5, Brad Campbell wrote:Having support for rev B is definitely a goal. In fact it has long been an unchecked box on the tracking issue: https://github.com/tock/tock/issues/1135.Also, thanks for pointing out the sparkfun board, that is an interesting development. I think the hifive b is still more compelling, however, as it allows for wireless connectivity.- BradOn Wed, Feb 19, 2020 at 1:44 PM Daniel Hayes <dhay...@uncc.edu> wrote:Here is the link for the FE310-G002 RISC-V chip--
On Wednesday, February 19, 2020 at 11:23:14 AM UTC-5, Daniel Hayes wrote:Thanks for quick reply Amit,I'm not a developer necessarily, I'm studying electrical engineering, but I don't mind trying to do the port as Tock seems to align very well with my original intentions. I have a Rev B board in my possession right now and I have another one on order. Rev B uses the FE310-G002 chip and according to the manual, it has 8 PMP registers (physical memory protection) with user and machine modes too. Note that SparkFun has a Red-V board that has the FE310-G002 chip so it has same memory protections as the RevB board and is available for purchase ($40). That would be another board to look into. Let me know where I should start with the porting process, and I'll see if I can make it happen. Appreciate it,Daniel
You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tock...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/5a3fab52-27fe-4b3f-bdc2-4450dd6634e0%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tock-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/c87b5c0a-2178-43c9-b0eb-a7f9dea6619c%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to tock-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/c87b5c0a-2178-43c9-b0eb-a7f9dea6619c%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tock-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/15dd3071-3cc4-4706-bb9e-fae1cbbf0970%40googlegroups.com.
Ultimately, a pull request would be awesome, but to start you want to clone the repository to your local machine and make changes there. When things are working you can open a pull request. We have some general directions in the contributing document: https://github.com/tock/tock/blob/master/.github/CONTRIBUTING.md- Brad
On Mon, Feb 24, 2020 at 11:53 AM Daniel Hayes <dhay...@uncc.edu> wrote:
Thanks for the replies. I will start reviewing the existing crates mentioned and get a feel for what will need to be changed. Also, I'm new with GitHub, should I clone the repo to my local machine and work on it there or submit a pull request?--
On Monday, February 24, 2020 at 11:30:42 AM UTC-5, Patrick Mooney wrote:On Mon, 24 Feb 2020 at 10:27, Brad Campbell <bra...@gmail.com> wrote:
>
> Yes, you should be able to largely copy the e310x crate and use the sifive and rv32i crates. You will also notice that the e310x crate is mostly just assigning memory addresses to the drivers defined in the shared sifive crate.
I picked up one of the aforementioned RED-V boards and Tock bring-up
hasn't been quite that straightforward so far. I'm not sure if there
are changes between it and the "official" HiFive1B which would make
the experience there any better, though.
You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tock...@googlegroups.com.
Ultimately, a pull request would be awesome, but to start you want to clone the repository to your local machine and make changes there. When things are working you can open a pull request. We have some general directions in the contributing document: https://github.com/tock/tock/blob/master/.github/CONTRIBUTING.md- Brad
On Mon, Feb 24, 2020 at 11:53 AM Daniel Hayes <dhay...@uncc.edu> wrote:
Thanks for the replies. I will start reviewing the existing crates mentioned and get a feel for what will need to be changed. Also, I'm new with GitHub, should I clone the repo to my local machine and work on it there or submit a pull request?--
On Monday, February 24, 2020 at 11:30:42 AM UTC-5, Patrick Mooney wrote:On Mon, 24 Feb 2020 at 10:27, Brad Campbell <bra...@gmail.com> wrote:
>
> Yes, you should be able to largely copy the e310x crate and use the sifive and rv32i crates. You will also notice that the e310x crate is mostly just assigning memory addresses to the drivers defined in the shared sifive crate.
I picked up one of the aforementioned RED-V boards and Tock bring-up
hasn't been quite that straightforward so far. I'm not sure if there
are changes between it and the "official" HiFive1B which would make
the experience there any better, though.
You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tock...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to tock-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/00b8cf7b-da4f-412c-a004-2affbc046329%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/00b8cf7b-da4f-412c-a004-2affbc046329%40googlegroups.com.
use riscv_rt::entry; | |
use hifive1::hal::prelude::*; | |
use hifive1::hal::delay::Sleep; | |
use hifive1::hal::DeviceResources; | |
use hifive1::pin; |
To unsubscribe from this group and stop receiving emails from it, send an email to tock-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/a15755b4-f4b5-48f8-93d5-fe4c29841bf7%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/a15755b4-f4b5-48f8-93d5-fe4c29841bf7%40googlegroups.com.
On Mar 14, 2020, at 5:43 AM, Daniel Hayes <dhay...@uncc.edu> wrote:
Does anyone know if I can use a secure bootloader to launch the Tock OS? I am thinking about using WolfBOOT for secure boot and secure OTA updates.
--
You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tock-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/8fa10c6a-bade-435f-9304-a64482d79543%40googlegroups.com.
You can — we do this on Titan:Depending on how your secure boot loader works, you might need to forego dynamically loading apps. I.e., you have to put the apps and kernel into an image and sign that image. This is what the above code does. The key part of the Makefile is in the user space directory:This compiles the userspace app, compiles the kernel, combines them into a merged image, signs it, prepends a stage 2 boot loader (the stage 1 checks that this stage 2 boot loader hasn’t been tampered with), and makes that the final image.Phil
On Mar 14, 2020, at 5:43 AM, Daniel Hayes <dhay...@uncc.edu> wrote:
Does anyone know if I can use a secure bootloader to launch the Tock OS? I am thinking about using WolfBOOT for secure boot and secure OTA updates.
--
You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tock...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/8fa10c6a-bade-435f-9304-a64482d79543%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to tock-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/fb2a4591-180b-4e88-b318-a6d60bbd41b3%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/fb2a4591-180b-4e88-b318-a6d60bbd41b3%40googlegroups.com.
You can use as many entries you need per app. On ARM we use 3 at least, and the remaining 5 are used for shared IPC regions.
The trick is that the kernel dynamically changes the PMP configuration when it context switches between user space processes. So using all PMP entries for a single process doesn't preclude also using all entries for a different process, since they never run at the same time.
--
You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tock-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/450c0356-1c50-4459-9900-4e39d2a12fd0%40googlegroups.com.
You can use as many entries you need per app. On ARM we use 3 at least, and the remaining 5 are used for shared IPC regions.
The trick is that the kernel dynamically changes the PMP configuration when it context switches between user space processes. So using all PMP entries for a single process doesn't preclude also using all entries for a different process, since they never run at the same time.
On 3/26/20 3:49 PM, Daniel Hayes wrote:
I'm a little confused on how the MPU configuration works. I'm using RISC-V so I will refer to it as PMP (physical memory protection). Is the idea to use the pmp configurations to isolate each user app? How many pmp entries are needed per app? I originally thought that you would setup one pmp per user app, but now I'm thinking that it may take 2 or 3 entries because of RAM and ROM for each user app stack. Can someone give me a little more clarity on this? Thanks--Daniel
On Wednesday, February 19, 2020 at 9:13:19 AM UTC-5, Daniel Hayes wrote:Any plans on having board support for the HiFive1 RevB? I'm working on my senior design project on IoT security using RISC-V and Rust on the HiFive1 RevB board. I saw Tock on GitHub and it seems kind of interesting. Thanks!
You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tock...@googlegroups.com.
Okay that helps my understanding a lot. Is there a possibility for a bad actor to modify the PMP configuration from the network stack? I know that having dynamic PMP entries gives you "unlimited" zoning, but it seems that smaller applications could use the Lock bit to prevent even machine mode from altering the entries and increasing security.
Not really. I'll explain.
A process can't modify the lock bit, or any other PMP registers for that matter, because processes are run in U mode, and U mode can't access those registers. So a malicious process can't do anything like that, at least not on it's own.
Inside the kernel, Tock isolates components using the Rust module and type system into components called "capsules." These components aren't allowed to use `unsafe` Rust, and as a result, can only do things that the rest of the kernel allows them to (the Threat Model document that Johnathan is currently drafting goes into more detail about exactly what a capsule can and cannot do: https://github.com/tock/tock/pull/1632)
So, the only code that can affect the PMP is the trusted part of the kernel, which includes the "kernel" crate (which performs process scheduling and context switching, as well as the lowest level of interrupt handling), and the chip-specific crate (which is responsible for mapping hardware registers to Rust).
There are caveats, of course... in the process case, there could be a bug in the hardware that would somehow allow the process to bypass U-mode constraints.
In the kernel case, there could be a bug in some trusted code that either exposes the PMP somehow or that violates Rust soundness constraints, in which case more or less all bets might be off. So the goal is to keep this code to a minimum and as simple as possible, and try to reason about it carefully.
Does that make sense?
I took this photo from the tock's github, does this stack show two pmp entries? One for flash and one for RAM?
Also, I understand that the pmp address register is 32bits. For TOR it just lists the top address for the range, where NA4/NAPOT uses the most significant bits to specify a starting address, and the least significant bits to determine the range size. Is this correct?
I hate to bother you guys too much with this stuff. I'm trying to learn and this forum has proven to be the most useful so far, so thanks! Hopefully, I can make some worth while contributions to Tock at some point :)
--
Daniel
On Thursday, March 26, 2020 at 5:35:58 PM UTC-4, Amit Levy wrote:You can use as many entries you need per app. On ARM we use 3 at least, and the remaining 5 are used for shared IPC regions.
The trick is that the kernel dynamically changes the PMP configuration when it context switches between user space processes. So using all PMP entries for a single process doesn't preclude also using all entries for a different process, since they never run at the same time.
On 3/26/20 3:49 PM, Daniel Hayes wrote:
I'm a little confused on how the MPU configuration works. I'm using RISC-V so I will refer to it as PMP (physical memory protection). Is the idea to use the pmp configurations to isolate each user app? How many pmp entries are needed per app? I originally thought that you would setup one pmp per user app, but now I'm thinking that it may take 2 or 3 entries because of RAM and ROM for each user app stack. Can someone give me a little more clarity on this? Thanks--Daniel
On Wednesday, February 19, 2020 at 9:13:19 AM UTC-5, Daniel Hayes wrote:Any plans on having board support for the HiFive1 RevB? I'm working on my senior design project on IoT security using RISC-V and Rust on the HiFive1 RevB board. I saw Tock on GitHub and it seems kind of interesting. Thanks!
You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tock...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/450c0356-1c50-4459-9900-4e39d2a12fd0%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tock-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/b589895a-f09d-471f-8ec1-80711a591ec8%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/b589895a-f09d-471f-8ec1-80711a591ec8%40googlegroups.com.
Thanks for the detail Amit. I have couple of more questions. I noticed that the stack is at the bottom of the diagram, usually the stack is at the top and grows down towards the heap. Is there a significant reasoning behind this addressing scheme?
There are two.
First, there are three dynamically growing sections instead of just two: the stack, heap and grant sections (grants belong to the kernel, but are allocated in process space).
Second, putting the stack at the bottom helps to catch stack overflows. When the stack overruns it'll result in memory access outside of the process memory and thus in a memory fault, as opposed to potentially accessing heap data.
Also, is the tockloader responsible for setting up the pmp addresses for each application space?
Does the tockloader have a custom linker to setup the sandboxes?
There isn't a custom linker per-se (we just use GNU LD), but Tock does rely on a particular configuration of the linker, in coordination with the user space `_start` symbol's implementation for the code to be properly position in dependent.
Finally, Does Tock utilize any user interrupts, or is the request sent to the kernel which then calls the interrupt. Thanks,
To unsubscribe from this group and stop receiving emails from it, send an email to tock-dev+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tock-dev/7c7830fb-fecb-4ebc-b377-4a1a83e8a3eb%40googlegroups.com.