Skip to content

x86: Implement simple stack memory protection #3626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zephyrbot opened this issue May 24, 2017 · 6 comments
Closed

x86: Implement simple stack memory protection #3626

zephyrbot opened this issue May 24, 2017 · 6 comments
Assignees
Labels
area: Kernel Enhancement Changes/Updates/Additions to existing features priority: high High impact/importance bug
Milestone

Comments

@zephyrbot
Copy link
Collaborator

zephyrbot commented May 24, 2017

Reported by Andrew Boie:

Implement a simple stack protection scheme on x86.
General policy:

  1. Writes to any stacks not owned by the currently running thread should pagefault
  2. Writes to any memory immediately preceding the current stack should immediately pagefault

To implement #2, stacks may need to be positioned between rodata and data, such that the first byte before the first stack is read-only and will trigger a pagefault if written to.

Depends on GH-3623, GH-3531

(Imported from Jira ZEP-2188)

@zephyrbot
Copy link
Collaborator Author

by Andrew Boie:

I have a naive POC but when the stack overflows the CPU just resets.
On retrospect, this makes perfect sense since when the page fault exception hits, the x86 CPU is still trying to use the stack that overflowed, and we end up faulting infinitely.
Need to look at the best way to do an automatic stack switch when the exception hits, I think we need to set up a special TSS for exception handling or something.

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented Jun 12, 2017

by Andrew Boie:

Moving this out to v1.10.0. Looking like we will need to implement user vs supervisor mode first, GH-3627 first. Continuing to research this.

@zephyrbot
Copy link
Collaborator Author

by Andrew Boie:

Mark Linkmeyer I think I can get this one for 1.9, a lot of progress was made this week

@zephyrbot
Copy link
Collaborator Author

zephyrbot commented Jul 15, 2017

by Andrew Boie:

I have this working end-to-end, but the QEMU in the SDK is broken, see GH-3827

@zephyrbot
Copy link
Collaborator Author

by Andrew Boie:

#810

@zephyrbot
Copy link
Collaborator Author

by Andrew Boie:

enabled by default for x86 QEMU targets

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Kernel Enhancement Changes/Updates/Additions to existing features priority: high High impact/importance bug
Projects
None yet
Development

No branches or pull requests

2 participants