Welcome, Guest. Please login or register.

Author Topic: AmigaOS Memory protection, preemptive?  (Read 2848 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline freqmaxTopic starter

  • Hero Member
  • *****
  • Join Date: Mar 2006
  • Posts: 2179
    • Show only replies by freqmax
AmigaOS Memory protection, preemptive?
« on: May 10, 2009, 03:50:00 AM »
Is there any functionality for memory protection on those m68k processors that support it?, ie such that programs can't just poke around and take down the OS.

Swapping is supported with AmigaOS v4.0 so I thought maybe there's a chance.

 

Offline SamuraiCrow

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2281
  • Country: us
  • Gender: Male
    • Show only replies by SamuraiCrow
Re: AmigaOS Memory protection, preemptive?
« Reply #1 on: May 10, 2009, 04:14:38 AM »
There's a diagnostic tool called MuForce.  I think it's just a combination of MungWall and Enforcer.

-Edit-
http://aminet.net/package/dev/debug/MuForce
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: AmigaOS Memory protection, preemptive?
« Reply #2 on: May 10, 2009, 09:15:45 AM »
@freqmax
Quote
Is there any functionality for memory protection on those m68k processors that support it? ie such that programs can't just poke around and take down the OS.

No
Quote
Swapping is supported with AmigaOS v4.0 so I thought maybe there's a chance.

Not even AmigaOS 4 has memory protection (and neither has MorphOS), so no chance.
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: AmigaOS Memory protection, preemptive?
« Reply #3 on: May 10, 2009, 11:27:09 AM »
AmigaOS wasn't designed with memory protection in mind. All of the processes see the same memory map and the ability to access memory owned by another process is critical to the  messaging system: Process A allocates memory, puts data into it and passes a pointer to Process B which can modify it directly and pass it back.

The only model I could envisage working is one in which public and private memory are implemented. Public memory would be used to allocate storage for any structures that are to be passed between processes and private memory used everywhere else. However, even assuming you could rewrite the entire OS to use this model, protection of private memory could only be implemented on a page basis. Furthermore, given the existing design of the OS, you'd not really be no safer due to the extent to which it depends on messaging etc. You simply can't prevent a broken Process B crapping all over the public memory Process A allocated for the message.
int p; // A
 

Offline freqmaxTopic starter

  • Hero Member
  • *****
  • Join Date: Mar 2006
  • Posts: 2179
    • Show only replies by freqmax
Re: AmigaOS Memory protection, preemptive?
« Reply #4 on: May 10, 2009, 01:28:51 PM »
You send the message to the kernel which then takes ownership of that memory range. Then the program can trash all around without any effect ;)
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16879
  • Country: gb
  • Thanked: 5 times
    • Show only replies by Karlos
Re: AmigaOS Memory protection, preemptive?
« Reply #5 on: May 10, 2009, 01:36:09 PM »
Quote

freqmax wrote:
You send the message to the kernel which then takes ownership of that memory range. Then the program can trash all around without any effect ;)


Unfortunately, that is completely at odds with the amigaos messaging system. Messages are sent by reference, directly between message ports created by userland processes.

Even if you did managed to rework it so that they were sent by the "kernel" - which is a strange concept given that only the task scheduler and exception traps run in supervisor mode - you'd lose the principal advantage of the AmigaOS IPC mechanism, which is it's speed. If you copy the message, you introduce significant overhead.

So, you decide to opt for a zero copy but then only discrete pages can be protected. Unless you make all discrete allocations at least one page in size (which will waste memory like anything), you wouldn't want to do that. If you did, you might end up write protecting other bits of data in the same page that are in use by other processes.

Finally, assuming you overcome all this, if Process B craps all over the message and dies, it has still suceeded in hanging process A which is probably waiting for a ReplyMsg(). Anything waiting for Process A will now lock up too, and so on.
int p; // A
 

Offline brianb

  • Full Member
  • ***
  • Join Date: Jan 2009
  • Posts: 175
    • Show only replies by brianb
Re: AmigaOS Memory protection, preemptive?
« Reply #6 on: May 10, 2009, 02:31:51 PM »
You can run Linux on your 68k Amiga and gain memory protection....   :-P

http://www.linux-m68k.org/
 

Offline shoggoth

  • Full Member
  • ***
  • Join Date: Dec 2004
  • Posts: 223
    • Show only replies by shoggoth
Re: AmigaOS Memory protection, preemptive?
« Reply #7 on: May 10, 2009, 03:22:29 PM »
Quote

brianb wrote:
You can run Linux on your 68k Amiga and gain memory protection....   :-P

http://www.linux-m68k.org/


Sure, but in such case you're nolonger running AmigaOS (topic) :-)