Re: Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Alan Altmark
If you’re talking to an ESM, that’s fine. Yes, you have to use a kernel module. Linux apps are problem state only. You want priv data? Ask the kernel for it. It decides if you’re authorized from a Linux perspective. Regards, Alan Altmark IBM > On Nov 10, 2018, at 6:57 PM, Donald Russell

Re: Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Donald Russell
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

Re: Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Binyamin Dissen
On Sat, 10 Nov 2018 14:21:49 -0800 Donald Russell wrote: :>On Sat, Nov 10, 2018 at 13:24 Binyamin Dissen :>wrote: :>> On Sat, 10 Nov 2018 12:59:44 -0800 Donald Russell :>> wrote: :>> :>Thanks for that info. But thatdoesnt get me to goal of issuing my own :>> :>diag. :>> I would suggest the

Re: Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Donald Russell
On Sat, Nov 10, 2018 at 13:24 Binyamin Dissen wrote: > On Sat, 10 Nov 2018 12:59:44 -0800 Donald Russell > wrote: > > :>Thanks for that info. But thatdoesnt get me to goal of issuing my own > :>diag. > > I would suggest the goal would have a business case. Just issuing a DIAG > without an end

Re: Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Binyamin Dissen
On Sat, 10 Nov 2018 12:59:44 -0800 Donald Russell wrote: :>Thanks for that info. But thatdoesnt get me to goal of issuing my own :>diag. I would suggest the goal would have a business case. Just issuing a DIAG without an end purpose? -- Binyamin Dissen http://www.dissensoftware.com Director,

Re: Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Donald Russell
Thanks for that info. But thatdoesnt get me to goal of issuing my own diag. Sounds like that’s bigger than a breadbox. I’ll have to figure out to make something that can be mod probe -loaded. Or find another solution No worries. All good fun and learning. Cheers, Don On Sat, Nov 10, 2018 at

Re: Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Mark Post
>>> On 11/10/2018 at 02:08 PM, Mike Walter >>> wrote: > Wouldn't a CP QUERY CPUID (perhaps CP QUERY VIRTUAL CPUID) via diag08, or the > Linux command to issue CP commands, work? If the returned value begins with > FF, you are running in a virtual machine. If you can issue a CP command at

Re: Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Mike Walter
Wouldn't a CP QUERY CPUID (perhaps CP QUERY VIRTUAL CPUID) via diag08, or the Linux command to issue CP commands, work? If the returned value begins with FF, you are running in a virtual machine. Mike Walter -Retired- From: Linux on 390 Port on behalf of Donald

Re: Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Neale Ferguson
I resemble that comment. I also wrote diag 25c and IUCV device drivers. The latter was for character devices rather than af_iucv. Original message From: Rick Troth Date: 11/10/18 11:06 (GMT-05:00) To: LINUX-390@VM.MARIST.EDU Subject: Re: [LINUX-390] Using diagnose instruction

Re: Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Rick Troth
Sure ... and think outside the box of just calling a DIAG. What problem are you tryig to solve? If you want to interrogate CP for users and groups and authorizations then think about how to tie that in with PAM. Not meaning to complicate things for you, but you'll be pleased with a result that

Re: Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Alan Altmark
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 wrote: > > Thanks Neale! > > In my case I’m using diag a0. Though I may want to do this for other

Re: Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Alan Altmark
And remember that even though you are in supervisor state, the DIAG may still cause a program check. You must be specially authorized to use certain DIAGs. Regards, Alan Altmark IBM > On Nov 10, 2018, at 6:29 AM, Neale Ferguson wrote: > > .byte 0x83, 0x12, 0x00, 0x08 > > == diag 1,2,8 (CP

Re: Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Donald Russell
Thanks Rick. Just when I thought I was almost done. :-) I’m used to CMS, zOS and TPF where a properly authorized “problem program” can switch in and out of supervisor state. Do you have any reading material you can point me to? I gather this will be something I have to modprobe-load to make

Re: How to get in/out of supervisor state in C program

2018-11-10 Thread Rick Troth
See other email. Supervisor state is not available outside the kernel as a matter of security. -- R; <>< On Sat, Nov 10, 2018, 11:00 Donald Russell I want to use a privileged instruction (diag, stidp, etc) in __asm__(); > statement. > > How do I get into supervisor state to run that and then

Re: Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Rick Troth
Supervisor state is the domain of the kernel in most contemporary systems, including Linux. What you need to do for DIAG A0 is write a kernel module. Your next hurdle is interfacing kernel modules. There was one guy who implemented a generic DIAG interface early in the life of Linux on Z. But it

How to get in/out of supervisor state in C program

2018-11-10 Thread Donald Russell
I want to use a privileged instruction (diag, stidp, etc) in __asm__(); statement. How do I get into supervisor state to run that and then return to problem state? The purpose of stidp is to verify I’m running on VM before I go doing “vm things”. :-) I’m expecting my program to run setuid as

Re: Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Donald Russell
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

Re: Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Neale Ferguson
.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

Using diagnose instruction from C on RHEL 7

2018-11-10 Thread Donald Russell
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’