IBM Support

How to generate and read a z/OS SLIP Zero Address Detection (ZAD) Report

How To


Summary

SLIP Zero Address Detection (ZAD) is a z/OS feature that detects and documents execution of an instruction that accesses (stores or fetches) storage by using an operand address that was formed from a general register containing zero. This detection feature allows the owner of an application to identify programming errors where an assembler instruction is inadvertently accessing data within the Prefixed Save Area (PSA) control block, which resides at virtual address zero, due to incorrect register content of zero.

Objective

This article provides a link to the information needed to use the SLIP Zero Address Detection feature, a description of how to interpret the resulting report, and coding recommendations for preventing ZAD events triggered by intentional references to the PSA control block.

Environment

SLIP Zero Address Detection is a feature available on all supported z/OS releases.  You must be running z/OS on a z196, z114, or later server model to use ZAD. ZAD is not supported on z/OS under z/VM.  Due to the potential for performance impact, ZAD is intended to be used primarily in a test environment.   

Steps

For information on using z/OS SLIP Zero Address Detection, including precautions, suggestions, and instructions for report generation, see the section entitled SLIP Zero Address Detection (ZAD) in the z/OS MVS System Commands manual.  Take particular note of the following key points from that documentation:
 
  • Due to potential for performance impact, it is recommended that ZAD be used in a test environment.  If using ZAD in a production environment, provide an appropriate PRCNTLIM (PL) parameter value on the SLIP and monitor the system closely for possible overhead.
  • Minimize PER matches through use of SLIP filters.
  • Use SLIP parameter ASIDSA=SA to catch accesses to location 0 in an address space only (and not in a data space). 
  • Look for ZAD events only within your own product code.  Many expected ZAD events in IBM modules can occur which do not represent problems and are not defects.  If you see a ZAD event that is outside of your product code, and you do not suspect that it is an error, do not report it.
Follow the detailed directions at the link provided previously to generate a ZAD report.  When possible, the report identifies where the event occurred (by address and by module name, if available), how many times the event occurred, and the instruction that was issued. This information facilitates locating the particular module and determining whether the event is an error.

At the beginning of the report, you see an indication of when the report ran and how long:

SLIP Action Exit IEAVTSZR Event Report 07/04/2022 17:53:10.07
IEAVTSZR SLIP Trap ID=ZADT Duration: 00000007_0770AC56 Seconds: 7

To get to the section of most interest, from the beginning of the report, do: FIND JOBNAME

This search gets you to a data header followed by multiple lines of data. Each line of data represents a count of how many times within the run of ZAD a particular job/ASID/module/offset combination executed an instruction that accessed PSA storage by using a general register containing a value of zero. The storage access could have been for either a fetch or a store.  For a detailed definition of what register conditions trigger a ZAD event, see the section on "Zero Address Detection" in chapter 4 of the IBM z/Architecture Principles of Operation.


Following is a breakdown of the fields in the column header:
  • JobName - name of the job under which the highlighted instruction (the instruction that caused the ZAD event) was executed
  • ASID - hexadecimal ASID number of the job under which the highlighted instruction was executed
  • Address - address in storage where the highlighted instruction resides
  • Count - the number of times within the run that a particular job/ASID/module/offset combination executed an instruction that accessed storage by using a general register containing a value of zero.
  • Modname - name of the load module or nucleus module in which the highlighted instruction resides
  • Offset - offset within module where the highlighted instruction resides
  • Dsp - if there is a "D" in this column, the access was to a data space; otherwise, it was to an address space. (Use SLIP parameter ASIDSA=SA on the ZAD SLIP to eliminate data space entries from this report.)
  • InstrucText - the 6 bytes of hexadecimal data at the address indicated by the Address field. This data includes the highlighted instruction.  The instruction might be only the first 2 or first 4 bytes of this 6-byte string.
  • Decoded Instruction Text - the highlighted instruction, displayed as an assembler language instruction
When you are reviewing this report, look for any module names that you recognize as being in-house, that is, belonging to your company. As you perform this review, you might note a number of IBM module names in the report.  SLIP ZAD documentation states that, due to normal system processing, many expected ZAD events in IBM modules can occur which do not represent problems and are not defects. It further states that, when testing, look for ZAD events only within your own product code. If you see a ZAD event that is outside of your product code, and you do not suspect that it is an error, do not report it. If your product code runs only in a limited set of address spaces or jobs, you can limit the address spaces or jobs in which PER events can occur.
Focusing on report entries for in-house module names, inspect the code in the indicated module to determine whether the intent of the code was to access the PSA at virtual address zero.  You should strongly consider the possibility that the reference was NOT intended, and rather that the code was incorrectly executing with a register content of zero.  Correct any such entries.

If you encounter modules in the report that are intentionally accessing the PSA control block, consider the following coding suggestions to avoid triggering ZAD events.

  • Replace code that places a value of zero into a base register with code that specifies a base register number of zero.  For instruction formats where an index register is applicable, such as RX-format, replace code that places a value of zero into an index register with code that specifies an index register number of zero.  

    For example, replace the following assembler code:


       LHI   RegX,0
       L     RegY,PSATOLD-PSA(,RegX)


    with:

       L     RegY,PSATOLD-PSA(0,0)   

    or:

       USING  PSA,0
       L     RegY,PSATOLD


    As an example using C, given the following PSA definition:  

       struct psa {
       …
       void *__ptr32 psatold;
       …
              };

    replace:

       struct psa* psaptr = 0;
       if (psaptr -> psatold == 0) ...


    with:

       if (((struct psa *)0) -> psatold == 0) ...

     
  • When using an index to access an element of an array, ensure that the index register is used to hold the index value and the base register is used to point to the start of the array.  Reversing the use of the index register and base register will trigger a ZAD event when the base register contains zero.
     

If you encounter modules in the report that are accessing the page at address 0 in a data space, you can add ASIDSA=SA to the ZAD SLIP to filter out these events.  The events will still occur (and thus consume CPU cycles), but they will not appear in the report.  If you prefer not to filter out these data space references, you can prevent the ZAD event by defining the data space such that it does not have a page at address 0.  Doing this not only has the benefit of eliminating a ZAD event, but it also means that an unintended reference to the first page of the data space will result in a program interrupt.  One way to define a data space that does not include page 0 is to use the HIDEZERO=YES option of the DSPSERV CREATE macro invocation.  You will also need to make sure that your implementation is adjusted to accommodate the data space origin of X’1000’ rather than 0.

Document Location

Worldwide

[{"Type":"MASTER","Line of Business":{"code":"LOB56","label":"Z HW"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG90","label":"z\/OS"},"ARM Category":[{"code":"a8m0z00000009zAAAQ","label":"z\/OS-\u003ERTM \u0026 Dumping Services-\u003ESLIP"}],"ARM Case Number":"","Platform":[{"code":"PF035","label":"z\/OS"}],"Version":"2.3.0;2.4.0;2.5.0;and future releases"}]

Document Information

Modified date:
10 August 2023

UID

ibm16602085