For those persons not steeped in VM lore, DIAGNOSE 0xA0 is set aside for external security managers (ESMs) to use. Certain sub functions are defined by IBM to be implemented by all ESMs. Others are specific to the ESM. Don is looking at an ESM-specific interface.
And he’s interested in calling it from Linux. That’s not an issue, per se, but most DIAGNOSE instructions serialize (stop) the virtual machine while the function is performed. That can be an issue for Linux. Just FYI. Regards, Alan Altmark IBM > On Nov 10, 2018, at 6:57 PM, Donald Russell <[email protected]> wrote: > > Thanks Alan, > > I’m tinkering with diag a0, subcode 60, a non-ibm api. And yes the virtual > machine needs additional privileges to use it. > > Thanks for the tip though. But whether I use diag a0 or 88 or any other > privileged instruction, my problem is getting into supervisor state so it > can do it. > > If a kernel extension is the only way, I’ll have to decide how I want to > proceed. I don’t mind doing it, I just have to find the time and weigh the > benefit vs possible security risk. > > Cheers > Don > > > >> On Sat, Nov 10, 2018 at 08:31 Alan Altmark <[email protected]> wrote: >> >> >> A0? Please make sure that your usage is not outdated. The most common >> usages of A0 were replaced long ago by DIAG 88. >> >> Regards, >> Alan Altmark >> IBM >> >>> On Nov 10, 2018, at 10:32 AM, Donald Russell <[email protected]> >> wrote: >>> >>> Thanks Neale! >>> >>> In my case I’m using diag a0. Though I may want to do this for other diag >>> instructions too. >>> >>> Getting in/out of supervisor state is my next hurdle. :-) >>> >>> I was going to use stidp to make sure I was actually on VM but that got >>> “Illegal Instruction” when it ran. >>> Maybe there’s a function I can call, or I can read /proc/cpuinfo to >> verify >>> A-it’s IBM/S390 and B-VM is running. I don’t like the idea of reading a >>> whole “file” to provide what a single instruction can give me. >>> >>> I still have to figure out how to get in and out of supervisor state for >>> the diag though. >>> >>> Thanks for tip on generating the machine code. That’s great! :-) >>> >>> Cheers, >>> Don >>> >>> >>> >>> >>>> On Sat, Nov 10, 2018 at 03:31 Neale Ferguson <[email protected]> >> wrote: >>>> >>>> .byte 0x83, 0x12, 0x00, 0x08 >>>> >>>> == diag 1,2,8 (CP command) >>>> >>>> You can either load r1/r2 in the _asm_ section or tell gcc to bind the >>>> variables to the registers. >>>> >>>> Remember, though, that diag is a privileged instruction and won't work >> in >>>> a userland program. >>>> >>>> In what particular diag are you interested? >>>> >>>> >>>> -------- Original message -------- >>>> From: Donald Russell <[email protected]> >>>> Date: 11/10/18 06:00 (GMT-05:00) >>>> To: [email protected] >>>> Subject: [LINUX-390] Using diagnose instruction from C on RHEL 7 >>>> >>>> Hello, >>>> >>>> I want to write a program in C and use a diagnose instruction. >>>> >>>> I thought I could do >>>> >>>> __asm___( “ diag ... “ ...); >>>> >>>> but that fails because diag is not a real instruction mnemonic. When I >> use >>>> gcc to compile and link I get an error: >>>> >>>> Program.c(.text+0x578): undefined reference to ‘x480a032’ >>>> collect2: error: ld returned 1 exit status >>>> >>>> I thought I could code dc x’8312....’ and force the use of registers 1 >> and >>>> 2 but it complains that dc is not valid. (The doc says instructions >>>> including directives are ok. But obviously not dc directives. :-) I >> also >>>> tried upper case just to be thorough) >>>> >>>> How can I coerce C into generating a diagnose instruction? >>>> >>>> Thanks, >>>> Don >>>> >>>> ---------------------------------------------------------------------- >>>> For LINUX-390 subscribe / signoff / archive access instructions, >>>> send email to [email protected] with the message: INFO LINUX-390 >> or >>>> visit >>>> >> http://www.marist.edu/htbin/wlvindex?LINUX-390 >> >>>> ---------------------------------------------------------------------- >>>> For more information on Linux on System z, visit >>>> >> http://wiki.linuxvm.org/ >> >>>> >>>> ---------------------------------------------------------------------- >>>> For LINUX-390 subscribe / signoff / archive access instructions, >>>> send email to [email protected] with the message: INFO LINUX-390 >> or >>>> visit >>>> >> http://www.marist.edu/htbin/wlvindex?LINUX-390 >> >>>> ---------------------------------------------------------------------- >>>> For more information on Linux on System z, visit >>>> >> http://wiki.linuxvm.org/ >> >>>> >>> >>> ---------------------------------------------------------------------- >>> For LINUX-390 subscribe / signoff / archive access instructions, >>> send email to [email protected] with the message: INFO LINUX-390 or >> visit >>> >> http://www.marist.edu/htbin/wlvindex?LINUX-390 >> >>> ---------------------------------------------------------------------- >>> For more information on Linux on System z, visit >>> >> http://wiki.linuxvm.org/ >> >>> >> >> ---------------------------------------------------------------------- >> For LINUX-390 subscribe / signoff / archive access instructions, >> send email to [email protected] with the message: INFO LINUX-390 or >> visit >> http://www.marist.edu/htbin/wlvindex?LINUX-390 >> ---------------------------------------------------------------------- >> For more information on Linux on System z, visit >> http://wiki.linuxvm.org/ >> > > ---------------------------------------------------------------------- > For LINUX-390 subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO LINUX-390 or visit > http://www.marist.edu/htbin/wlvindex?LINUX-390 GC7FcmjaGhYCOgSurg&e= > ---------------------------------------------------------------------- > For more information on Linux on System z, visit > http://wiki.linuxvm.org/ > ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390 ---------------------------------------------------------------------- For more information on Linux on System z, visit http://wiki.linuxvm.org/
