zephyriot / zephyr-issues

0 stars 0 forks source link

Thread-level Memory Protection Support #1337

Open nashif opened 7 years ago

nashif commented 7 years ago

Reported by Anas Nashif:

Run trusted software in privileged mode and run all less-trusted software in unprivileged mode. Examples of trusted code are RTOSs, ISRs, handlers, and low-level drivers. Examples of less-trusted code are untested code third party software, and code that is vulnerable to malware such as protocol stacks and high-level drivers.

(Imported from Jira ZEP-1466)

nashif commented 7 years ago

by Marcus Shawcroft:

We should give some consideration to using mpu support to fault null pointer accesses.

There is a post on devel The recent post on devel https://lists.zephyrproject.org/pipermail/zephyr-devel/2017-March/007426.html that touches on some of the developer experience issues that arise from the the C standards treatment of null pointers and various related compiler optimizations.

nashif commented 7 years ago

by Andrew Boie:

The scope of this JIRA is way too broad and needs to be decomposed into deliverables. See GH-1931 for one such deliverable.

nashif commented 7 years ago

by Mark Linkmeyer:

Andrew to break up in to stories.

nashif commented 7 years ago

by Andrew Boie:

Survey from Linaro of MPU capabilities across a variety of arches/CPUs

https://wiki.linaro.org/Memory%20Protection%20Device%20Survey

nashif commented 7 years ago

by Andrew Boie:

Notes from Andy on high-level requirements:

So going through the JIRA and through our own documentation, you have all of the major tasks identified. That said, I do agree that a specific list of deliverables that are assigned to separate stories/arcs should be done.

Major tasks:

  • privileged/unprivileged section isolation
    • Static tables derived from sections. These would give code and data regions for kernel and apps
    • Define structures to describe regions and implement that
    • Define dynamic region definition for transient regions
      • How does this hook in to k_thread
  • Region management
    • APIs
  • Stack guard
    • Hardware support. MMU vs MPU
    • API convergence?
  • Null ptr protection
  • Peripheral device isolation
    • Recognizing device access and proper configuration of peripheral ranges
    • system calls to access device?
  • Privileged access escalation / system calls

These are general placeholders and cover a number of your specific cases outlined in the JIRA. When we were divvying up the work between Vincenzo and myself, my thought was to get the isolation of privileged and unprivileged working. Once we got the separation we could then explore the system calls and escalation mechanisms. I see the region management to be the primary thing to do first. Then the isolation, which brings in the section definitions and API work.

We can talk more on this in the morning, but I wanted to get this out tonight to at least condense some of the stuff we've been talking about internally.

Regards,

Andy

nashif commented 7 years ago

by Andrew Boie:

Marcus Shawcroft NULL pointer protection will be tracked in GH-2034, thanks!