From: CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 6-DEC-1989 20:36 To: MRGATE::"ARISIA::EVERHART" Subj: RE: Help with SUPERVISOR mode code Message-Id: <8912070124.AA07491@crdgw1.ge.com> Received: From VENUS.YCC.YALE.EDU by CRVAX.SRI.COM with TCP; Wed, 6 DEC 89 15:52:49 PDT Date: Wed, 6 Dec 89 18:52 EST From: Leichter-Jerry@CS.YALE.EDU Subject: RE: Help with SUPERVISOR mode code Sender: LEICHTER@Venus.YCC.Yale.Edu To: zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!vrdxhq!pbs!pcrable@tut.cis.ohio-state.EDU, INFO-VAX@KL.SRI.COM X-Vms-To: IN%"zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!vrdxhq!pbs!pcrable@tut.cis.ohio-state.EDU" I need some help writing supervisor mode code. Since there is no $CMSUPER system service, I'm stuck using the CHMS instruction in macro. The macro instruction does not explain how the code argument is related to the address of the function that is to execute in supervisor mode. There also seems to be a catch 22 situation with declaring a change mode to supervisor handler since the handler itself must be declared while in supervisor mode. Is there already a change mode to supervisor handler there ? Sigh. Another one of those "dangerous questions" - ones where you KNOW that because the person asked the question, he is just going to get himself into a whole bunch of trouble if you give him the answer. In summary: - Of COURSE it is only possible to change the XXX-mode vector from XXX (or a more privileged) mode. If not, anyone could change the kernel-mode vector, issue a CMKRNL instruction and take over any VMS system. - SYS$CMKERNL and SYS$CMEXEC are system services which have little directly to do with the underlying CMxx instructions; they just call you back after getting into the appropriate mode, IF you have the right privileges. - There is no SYS$CMSUPER service because supervisor mode belongs to CLI's. A CLI could choose to provide such a service, but none of the standard ones do. - As a result, the only way to get to supervisor mode is to get to exec or kernel, and get back out from there. The easiest technique is to declare a supervisor-mode AST for yourself. You could also construct and execute an appropriate REI. - Programming in supervisor mode is totally unsupported under any of the standard CLI's. You MUST know what you are doing. - A program with access to supervisor mode can gain complete access to the system - while it's not obvious how, and I don't want to go into it, it isn't hard to get to kernel mode from super- visor mode. This is a matter of the way VMS is designed, not the way the VAX hardware works. This is probably the main reason that user-written CLI's are not supported. -- Jerry