Skip to content

Commit

Permalink
Make sure CEE3ERP is invoked in LE 31-bit XPLINK; add tests
Browse files Browse the repository at this point in the history
When an ABEND occurs and there is a user-defined ESTAEX in
an LE application, the language environment must be notified
via a call to CEE3ERP; that way LE has a chance to handle
things like hitting a stack guard page. If we don't call
CEE3ERP, things can go terribly wrong.

At some point, the ZSS 31-bit build was changed to use
XPLINK and the CEE3ERP call in the recovery facility was
erroneously limited to non-XPLINK 31-bit LE environments.

This commit changes the code to call the CEE3ERP routine
in XPLINK 31-bit LE applications.

Fixes:
* zowe/zss#600
* zowe/zss#736

Signed-off-by: Irek Fakhrutdinov <[email protected]>
  • Loading branch information
ifakhrutdinov committed Nov 29, 2024
1 parent e8cd124 commit 45c46a7
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Enhancement: module registry (#405)
- Enhancement: Adding more arguments to httpClientSessionInit to allow passing back internal rc and
removing the reference from changelog in `3.0.0`. (#499).
- Bugfix: make sure CEE3ERP is invoked in LE 31-bit XPLINK (#504)

## `3.0.0`
- Feature: added javascript `zos.getStatvfs(path)` function to obtain file system information (#482).
Expand Down
2 changes: 1 addition & 1 deletion c/recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ static void * __ptr32 getRecoveryRouterAddress() {
" USING RCVCTX,11 \n"
" CLC RCXEYECT,=C'RSRCVCTX' EYECATHER IS VALID? \n"
" BNE RCVRET NO, LEAVE \n"
#if !defined(METTLE) && !defined(__XPLINK__)
#if !defined(METTLE) && !defined(_LP64)
/* check if the LE ESTAE needs to handle this */
" L 12,RCXCAA LOAD CAA \n"
" USING CEECAA,12 \n"
Expand Down
15 changes: 15 additions & 0 deletions tests/build_recoverytest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ xlc -D_OPEN_THREADS=1 "-Wa,goff" "-Wc,LANGLVL(EXTC99),FLOAT(HEX),agg,exp,list(),
../c/zos.c
xlc -D_OPEN_THREADS=1 "-Wa,goff" "-Wc,XPLINK,LANGLVL(EXTC99),FLOAT(HEX),agg,exp,list(),so(),goff,xref,gonum,roconst,gonum,ASM,ASMLIB('SYS1.MACLIB'),ASMLIB('CEE.SCEEMAC')" '-Wl,ac=1' \
-DRCVR_CPOOL_STATES \
-I ../h -o recoverytest31_xplink recoverytest.c \
../c/alloc.c \
../c/cellpool.c \
../c/collections.c \
../c/le.c \
../c/logging.c \
../c/recovery.c \
../c/scheduling.c \
../c/timeutls.c \
../c/utils.c \
../c/zos.c
xlc -D_OPEN_THREADS=1 "-Wa,goff" "-Wc,LP64,XPLINK,LANGLVL(EXTC99),FLOAT(HEX),agg,exp,list(),so(),goff,xref,gonum,roconst,gonum,ASM,ASMLIB('SYS1.MACLIB'),ASMLIB('CEE.SCEEMAC')" '-Wl,ac=1' \
-DRCVR_CPOOL_STATES \
-I ../h -o recoverytest64 recoverytest.c \
Expand Down
18 changes: 18 additions & 0 deletions tests/recoverytest.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ LE 31-bit:
xlc -D_OPEN_THREADS=1 "-Wa,goff" "-Wc,LANGLVL(EXTC99),FLOAT(HEX),agg,exp,list(),so(),goff,xref,gonum,roconst,gonum,ASM,ASMLIB('SYS1.MACLIB'),ASMLIB('CEE.SCEEMAC')" '-Wl,ac=1' \
-I ../h -o recoverytest recoverytest.c ../c/alloc.c ../c/collections.c ../c/le.c ../c/logging.c ../c/recovery.c ../c/scheduling.c ../c/timeutls.c ../c/utils.c ../c/zos.c
LE 31-bit XPLINK:
xlc -D_OPEN_THREADS=1 "-Wa,goff" "-Wc,LANGLVL(EXTC99),FLOAT(HEX),agg,exp,list(),so(),goff,xref,gonum,roconst,gonum,ASM,ASMLIB('SYS1.MACLIB'),ASMLIB('CEE.SCEEMAC')" '-Wl,ac=1' \
-I ../h -o recoverytest recoverytest.c ../c/alloc.c ../c/collections.c ../c/le.c ../c/logging.c ../c/recovery.c ../c/scheduling.c ../c/timeutls.c ../c/utils.c ../c/zos.c
LE 64-bit:
xlc -D_OPEN_THREADS=1 "-Wa,goff" "-Wc,LP64,XPLINK,LANGLVL(EXTC99),FLOAT(HEX),agg,exp,list(),so(),goff,xref,gonum,roconst,gonum,ASM,ASMLIB('SYS1.MACLIB'),ASMLIB('CEE.SCEEMAC')" '-Wl,ac=1' \
Expand Down Expand Up @@ -434,6 +439,15 @@ static void *thread2(void *data) {
return NULL;
}

static int testXPLINKStackInterrupt(void) {
// this should trigger LE's stack interrupt, so we're making sure our
// recovery doesn't interfere with it
#define STACK_BUFFER_SIZE (32 * 1024 * 1024)
int stackBuffer[STACK_BUFFER_SIZE] = {0};
stackBuffer[STACK_BUFFER_SIZE - 1] = (int)stackBuffer;
stackBuffer[STACK_BUFFER_SIZE - 1]++;
return stackBuffer[STACK_BUFFER_SIZE - 1];
}

int main() {
#ifdef METTLE
Expand All @@ -460,6 +474,10 @@ int main() {
printMessage, "top level recovery",
NULL, NULL);

#ifdef __XPLINK__
printf("xplink call result value = %d\n", testXPLINKStackInterrupt());
#endif

if (pushRC != RC_RCV_OK) {
printf("warn: something went wrong #1\n");
}
Expand Down

0 comments on commit 45c46a7

Please sign in to comment.