1752799 Members
5787 Online
108789 Solutions
New Discussion юеВ

Re: "Hang" on return

 
SOLVED
Go to solution
Willem Grooters
Honored Contributor

"Hang" on return

VMS 7.3-2, Alpha
Login as TMG1_WILLEM (low-priv user), execute a command:

$ SPAWN PIPE SETP tomg2 ; ; SETENV TOMG1

SETENV is a procedure that changes the process and job environment to fit a particular environemnt, different from login: UIC, default, logicals, process rights and privileges (both AUTHORIZED and DEFAULT), using two (privileged) images and DCL. The user does have an account in this environment (TMG2_WILLEM) but can not normally log in directly into this environment.
is executed in the context of user TMG2_willem - with elevated privileges.

The source of the original images is lost, and the functionality has been reverse-engineered from the original, by examining what it does to process end job environment.
In most cases, it seems to work fine. Changes in the process environment can be observed in the attachment.

However, above code sequence shows that there is still a difference to be handled.
Using the old images, it doesn't matter if fails causing an $ EXIT; the subprocess will end and control will be returned to the main process (though the changes in the job environment will still be there). The new images however cause the main process to hang, and the process needs to be killed (^C nor ^Y have any effect).

It seems to me that the subprocess does not signal the main process of it's termination.

I also tried (to check process and devices:

$ SPAWN PIPE SETP TOMG2 ; ANA/SYS

and this also causes the main process to hang when SDA is exited, no matter how, when the new images are used.

My thought is there must be some protection that needs to be altered, or an ACE added, (like I did on TT:) to signal the end of the subprocess, but I couldn't locate anything.

Any idea on how to find out what device may be inaccessible?
Willem Grooters
OpenVMS Developer & System Manager
20 REPLIES 20
Hein van den Heuvel
Honored Contributor

Re: "Hang" on return

No immediate help, just a couple of question which may help others.

First, roughly, what does the new code do? Straight system service calls (impersonate!) or kernel mode hackery twidlling bits in Process control blocks, process headers?

> TMG1_WILLEM (low-priv user),

It looks to me that this username has all the priviliges in the world: CMKRNL (useful to grab any other priv, and to issue SET UIC), and WORLD and so on. Not low-priv and does nto need an installed helper.

>> $ SPAWN PIPE

What is the purpose of the SPAWN before the pipe?

Are there DETACHED processes, or just changed to the sub-processed.

I suspect that one of the processes is waiting for a MAILBOX message. Use ANALYZE/SYSTEM and SHOW PROC/CHAN looking for 'busy'. You may also want to use the SDA MBX extention.


Hope this helps a little,

Groetjes,
Hein.

Wim Van den Wyngaert
Honored Contributor

Re: "Hang" on return

Does it stop when you wait about 10 minutes ?

Does it use T2T ? If the receiver does an exit without reading/closing sys$net it will receive a wait of 5 minutes (was on VMS 6.2).

Wim
Wim
Willem Grooters
Honored Contributor

Re: "Hang" on return

Actions of the new code: just what the old image seems to be doing (according SHOW PROCESS/ALL output and other information gathered), but basically as described in the attachment. No impersonation, plain system calls and direct access into system structures as well.
The images in the procedure are installed with the privs required, so any user can run the procedures, without elevated privs.
on SPAWN PIPE....The original sequence I got changes environment, copies a file in that environment that is otherwise inaccessible, changes ownership of this copy, restores the original environment and exits - as a single entity. There are other ways to achieve this but this is the code used in the production environment.
On mailbox: I guess so: My idea is that writing a message to a termination mailbox fails because the process' UIC has changed. However, I just noticed that the original program may change the process-UIC as well - but probably just in the process context, not in the JIB (as the new code does).
Willem Grooters
OpenVMS Developer & System Manager
Willem Grooters
Honored Contributor

Re: "Hang" on return

Wim: hasn't been mentioned; worth giving it a try (but I think it won't stop)
No T2T - what's T2T? - AFAIK.
Willem Grooters
OpenVMS Developer & System Manager
Willem Grooters
Honored Contributor

Re: "Hang" on return

T2T + SYS$NET = task to task. Could have thought about that: No, not involved.
Willem Grooters
OpenVMS Developer & System Manager
Willem Grooters
Honored Contributor

Re: "Hang" on return

Wim; waited half an hour but still no reaction: subprocess is stopped, main process remains in HIB, no open channels.

I looked into ACC for the last attempt ($ SPAWN PIPE SETENV TOMG2 ; ANA/SYS), that I stopped with ^Z (normal exit). It didn't return either, this is what ACC returns on this proces:

SUBPROCESS Process Termination
------------------------------
Username: TMG1_WILLEM UIC: [TMG2_P,TMG2_WILLEM]
Account: TMG1_P Finish time: 13-MAR-2009 15:06:17.30
Process ID: 20200155 Start time: 13-MAR-2009 15:06:12.64
Owner ID: 20200154 Elapsed time: 0 00:00:04.65
Terminal name: Processor time: 0 00:00:03.76
Remote node addr: Priority: 4
Remote node name: Privilege <31-00>: 521DB02D
Remote ID: Privilege <63-32>: 00000000
Remote full name:
Posix UID: -2 Posix GID: -2 (%XFFFFFFFE)
Queue entry: Final status code: 00F48009
Queue name:
Job name:
Final status text:
Page faults: 479 Direct IO: 101
Page fault reads: 87 Buffered IO: 183
Peak working set: 5632 Volumes mounted: 0
Peak page file: 172912 Images executed: 7
Willem Grooters
OpenVMS Developer & System Manager
Hein van den Heuvel
Honored Contributor

Re: "Hang" on return


The status is just the ANALYZE/SYSTEM you used:

$ write sys$output f$mess(%x00F48009)
%SDA-S-NOMSG, Message number 00F48009

The HIBER state is interesting.
It suggests it is NOT having a (mailbox) IO outstanding, but it may have an attention AST ready to fire. So I woudl still check for the channels and such.

Have just tried whether a simple $WAKE call will make it happy?

Does the tool need to have a SYS$WAKE call, to add a 'pending' wake, or use SYS$SCHDWK 'just in case'?

Hein.

Hein van den Heuvel
Honored Contributor

Re: "Hang" on return

fwiw...

There is (oddly?) no standard tool to do SET PROC/WAKE/ID=...

Here is a trivial 'wake' tool.

$ type wake.c
#include
int pid, sys$wake();
main (int argc, char *argv[])
{
sscanf( argv[1], "%X", &pid);
return sys$wake(&pid,0);
}
$

And here is that tool in a test:

$ type hiber.c
#include
#include
int sys$hiber();
main ()
{
printf ("Hiber for %08X\n", getpid());
sys$hiber();
printf ("Goodbye.\n");
}
$
$ spawn/nowait run hiber
%DCL-S-SPAWNED, process HEIN_7111 spawned
$
Hiber for 00000497
$
$ mcr sys$login:wake 497
Goodbye.
$

Goodbye,
Hein.

Jan van den Ende
Honored Contributor

Re: "Hang" on return

Willem,

is this SETENV the same as the one used in the environment we both have in our history?
If YES, then you probable should contact Oswald.
I no longer have the direct contact info, but I think you will know where to find him.

hth

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.