2009/5/12 Paul Schuster <[email protected]>:

>  If you do (for example) a VSMLOC PVT,AREA=((R4),(R0)),TCB=VSMLCTCB
> by one task (I will call it TCB123) and it  completes RC=0, but the TCB
> returned in the VSMLCTCB field is another task (I will call it TCB456), what
> is this really telling me?  The RC=0 (at the time VSMLOC processing
> determined it was to be RC=0) says that the "The specified virtual storage
> area is allocated.", but...
>
>
> 1) Can the TCB123 task really access this storage successfully? (Assume this
> is just key-8 non-fetch-protected storage, and I want to access  read-only)

Sure - it's in the same address space. Other than key protection, and
perhaps very odd cases like page protection or something, you can
access it.

> 2) Is there not the possibility that after VSMLOC has determined it will
> return a RC=0, that the TCB456 task could freemain (release) this storage?

Absolutely. It could be freed, and then even allocated by yet another
TCB (or an SRB), have its protection key changed, and be used for some
unrelated purpose, all between the VSMLOC and the next instruction in
your program. Unless you are holding some probably-inadvisably-strong
lock, you really cannot use a non-atomic sequence to check access and
then use the storage. VSMLOC/VSMLIST are very good for reporting on
storage usage in an application (typically a long-running, server type
of thing), but it is not the way to implement any kind of security
controls, or determine in advance if it is safe to reference the
storage at an address.

> I am trying to understand better the RC=0 when the TCB that has obtained the
> storage (TCB456) is different than the TCB issuing the VSMLOC (TCB123).

It's very normal to share subpools among TCBs, which would allow
TCB123 to release storage obtained by TCB456. But even if they are not
in a shared subpool, there is still addressibility.

Tony H.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to