Protecting the OS
Re: Protecting the OS
Why do you want to run applications in kernel-mode? You are yet to give any good answers for this. Remember that user-space is awesome and has been specially design to for safe process containment.
Re: Protecting the OS
I think the OP is talking about a microkernel/servers situation, where the servers need access to resources that a userland program wouldn't. But it would still be sensible to protect the servers from each other. Although not providing complete protection, paging enables protection against accidental access to another server's resources.
Re: Protecting the OS
If you don't know the provenance of, or simply just don't trust, 3rd party code, then the separation of a system into kernel and user mode can be useful. All of us who've written C have had pointer troubles at some time.
On the other hand, if you know what's what, or if you are clever enough to be using a language which doesn't permit different subsystems to interfere with each other, then this disaggregation seems to be a non-essential feature of modern microprocessors.
On the other hand, if you know what's what, or if you are clever enough to be using a language which doesn't permit different subsystems to interfere with each other, then this disaggregation seems to be a non-essential feature of modern microprocessors.
Every universe of discourse has its logical structure --- S. K. Langer.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Protecting the OS
And both MMIO and port IO can be done perfectly fine from ring 3 - even on a per-device granularity.I think the OP is talking about a microkernel/servers situation, where the servers need access to resources that a userland program wouldn't.
Re: Protecting the OS
It can still be used to give a memory protection to regular programs , even if it would not protect from malicious code.dozniak wrote:You do realise that this protection attribute can be changed at any time by any other code also running in ring0?d2alphame wrote:some level of protection for the OS by placing it's code and data in a page that is executable + read but cannot be written to (write-protected). I think this at least puts a small sort of caution in place for unintentional interference with the OS by apps running at CPL 0.
It could protect from unintended modification, but that's only small part of the whole protection.
Sometime it can be also a good policy to favor the making of non malicious programs, rather than doing everything to avoid malicious code. Specially for something at low level, like gdt, it's unlikely a programmer with good intention would change the gdt by accident, even if it would be very easy for malicious code.
After it's a question of at which level in the system design you allow to execute non trusted code, some 'secure' application context could be made latter with a model using different privilege level, but having a 'trusted' application context in ring0/cpl0 can be useful, it can ease the design of applications, and avoid some overhead. And just having an 'indicative' memory protection can be useful for debugging or still prevent some problems.
Re: Protecting the OS
It may be feasible only if you do not intend to ever run any 3rd party code.h0bby1 wrote:Sometime it can be also a good policy to favor the making of non malicious programs, rather than doing everything to avoid malicious code.
Learn to read.
Re: Protecting the OS
Yup! That's what I'll do . I'll place the OS in a write-protected page. Thanks y'all
Re: Protecting the OS
Hi,
Cheers,
Brendan
There are only really 2 cases:d2alphame wrote:Yes I realize that. But what can I do?dozniak wrote:It could protect from unintended modification, but that's only small part of the whole protection.
- You know you can trust the code, and therefore don't need any protection and can run it at CPL=0 (e.g. the kernel itself)
- You don't know if you can trust the code or not, and therefore it must be run at CPL=3 (e.g. normal applications)
That fixes nothing; and just means that the kernel can't write to it's own data without pointless and expensive overhead (e.g. making the page/s writable and flushing TLB beforehand and then making the page/s write-protected and flushing TLB again afterwards).d2alphame wrote:Yup! That's what I'll do . I'll place the OS in a write-protected page. Thanks y'all
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Protecting the OS
It can be useful for debugging purpose.Brendan wrote: For your OS, things like device drivers, networking stack, file systems, etc may be trusted (where it's silly to bother caring about protection) or they may not be trusted (where it's silly to run them at CPL=0 in the first place). Regardless of how you look at it, caring about protecting the OS from code running at CPL=0 is silly.