Re: load module loaded address between BPX LOAD (load_hfs) and ptrace+fork+exec?

2018-07-10 Thread Peter Hunkeler

>In a program, you can issue the BPX LOAD service to load a program
into memory... and similar to the LOAD macro, this returns the address
where the module was loaded, and the starting address.

>Now - is there any guarantee that if you then do a BPX FORK and then
a BPX EXEC to execute the module, that the module will be loaded at the same
address in the child?


The fork does a one by one copy of the address space (except from non-UNIXish 
things such as "DD allocations"). So the "BPX LOADed" load module is still at 
the same address. However, BPX EXEC is the equivalent of terminating the 
current job step, and starting a new job step where the BPX EXEC module will be 
the job step program.


I therefore say the answer is NO.


The only case where it could be loaded at the same address is when the BPX 
EXECed the load module is the same as the job step load module in the parent 
address space. But, I have never looked into an EXECed address space to see if 
that is the case or not.
 --
Peter Hunkeler

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


Re: load module loaded address between BPX LOAD (load_hfs) and ptrace+fork+exec?

2018-07-10 Thread Charles Mills
I don't even play a UNIX expert on TV but doesn't FORK give the child a
total clone of the parent's address space? If X (for any X, including a load
module) was at address aaa before the FORK, will it not be at address aaa
for both parent and child after the FORK?

Charles


-Original Message-
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
Behalf Of Thomas David Rivers
Sent: Tuesday, July 10, 2018 10:09 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: load module loaded address between BPX LOAD (load_hfs) and
ptrace+fork+exec?

In a program, you can issue the BPX LOAD service to load a program
into memory... and similar to the LOAD macro, this returns the address
where the module was loaded, and the starting address.

Now - is there any guarantee that if you then do a BPX FORK and then
a BPX EXEC to execute the module, that the module will be loaded at the same
address in the child?

If the child that is doing the BPX EXEC is running under PTRACE, does that
change things?

If there is such a guarantee, I can't seem to find it documented 
anywhere; any
pointers on that?

   - Thanks -
  - Dave Rivers -

-- 
riv...@dignus.comWork: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN


load module loaded address between BPX LOAD (load_hfs) and ptrace+fork+exec?

2018-07-10 Thread Thomas David Rivers

In a program, you can issue the BPX LOAD service to load a program
into memory... and similar to the LOAD macro, this returns the address
where the module was loaded, and the starting address.

Now - is there any guarantee that if you then do a BPX FORK and then
a BPX EXEC to execute the module, that the module will be loaded at the same
address in the child?

If the child that is doing the BPX EXEC is running under PTRACE, does that
change things?

If there is such a guarantee, I can't seem to find it documented 
anywhere; any

pointers on that?

  - Thanks -
 - Dave Rivers -

--
riv...@dignus.comWork: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN