<<< DOCD$:[NOTES$LIBRARY]SCT-GRYPHON.NOTE;1 >>> -< sct-gryphon >- ================================================================================ Note 1829.1 RMS: RENAME protection lost file bug fix 1 of 1 EVMS::CAMILLI 387 lines 10-JUL-1996 18:42 -< DIFFERENCES >- -------------------------------------------------------------------------------- Differences for Check-In for LC0008_RENAME_LOST_FILE BugFix Modules: [RMS]RM0FILFNC.MAR [RMS]RMS0RENAM.MAR RM0FILFNC.MAR ------------- ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;2 1 $BEGIN RM0FILFNC,15,RM$RMS0, 2 ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;1 1 $BEGIN RM0FILFNC,14,RM$RMS0, 2 ************ ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;2 7 ; * 1992, 1993, 1996 * 8 ; * All Rights Reserved. * ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;1 7 ; * 1992, 1993 * 8 ; * All Rights Reserved. * ************ ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;2 37 ; X-15 LC0008 Larry Camilli 7-JUN-1996 38 ; BUGFIX: In routine RM$SET_BYPASS, added enabling BYPASS 39 ; privilege and disabling security auditing for the (duration of) 40 ; restoration of a file name after a rename attempt fails. This 41 ; is to ensure that the restore can succeed (barring an asynchronous 42 ; event such as a hardware failure or the disk becoming 43 ; write-protected) regardless of protection of any files 44 ; with the original file name and lower version numbers. 45 ; ...And analogous code in RM$CLEAR_BYPASS. 46 ; For ALPHA only: 47 ; The code also checks for the condition of a forced attribute 48 ; write-back (used by the RMS Heuristic) to allow RM$SET_BYPASS 49 ; to be called for that condition. (This will allow the 50 ; code in RM0ACCESS to be replaced with calls to RM$SET_BYPASS 51 ; and RM$CLEAR_BYPASS.) 52 ; 53 ; X-14 NT Nora Tanner 25-Jan-1993 ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;1 37 ; X-14 NT Nora Tanner 25-Jan-1993 ************ ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;2 191 ; R0 contains qio function code 192 ; R3 set to (R3 | 1), if BYPASS requires removal 193 ; R3 set to (R3 | 2), if security auditing requires re-enabling 194 ; 195 ; If RMS is attempting to create or delete an RUJ file, 196 ; or if RMS is attempting to restore a file to a directory to 197 ; undo a rename that failed, or if RMS is attempting to write 198 ; back file attributes to a read-only file that the RMS Heuristic 199 ; has modified, then take BYPASS priv. 200 ; 201 ; If RMS is attempting to restore a file to a directory to 202 ; undo a rename that failed, or if RMS is attempting to write 203 ; back file attributes to a read-only file that the RMS Heuristic 204 ; has modified, then turn off security auditing, too. 205 ; 206 ; This routine is intended to be called just before the QIO, 207 ; and the companion routine, RM$CLEAR_BYPASS, should be called 208 ; right after the QIO (in fact, BEFORE the RM$STALL!). RM$CLEAR_BYPASS 209 ; actually must RESTORE the previous BYPASS state (and security auditing 210 ; state), R3 is used to signal whether or not BYPASS must be cleared 211 ; and whether or not security auditing must be restored. 212 ; 213 ; R3 must not be overwritten between the call to RM$SET_BYPASS and the 214 ; call to RM$CLEAR_BYPASS. 215 ; ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;1 175 ; r0 contains qio function code 176 ; r3 set to 1, if BYPASS reqires removal 177 ; 178 ; If RMS is attempting to create or delete an RUJ file, then take BYPASS priv. 179 ; ************ ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;2 223 CLRL R3 ; Assume will not have to remove BYPASS 224 BBS #IFB$V_RENAME_RECOVER,- ; If this is a rename recover 225 IFB$L_BKPBITSEXT(R9),- ; (re-entering original file name) 226 23$ 227 BBS #IFB$V_WRITE_RFMLRL,- ; If this is an attribute forced-write-back 228 IFB$L_BKPBITSEXT(R9),- ; (read-only no-sharing access to a file 229 23$ ; that the RMS Heuristic processed) 230 231 MOVL @#PIO$GL_CUR_ASB,R2 ; Get address of current ASB 232 BBC #ASB$V_RECURSIVE,- ; if recursive RMS call ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;1 187 CLRL R3 ; assume will not have to remove BYPASS 188 MOVL @#PIO$GL_CUR_ASB,R2 ; Get address of current ASB 189 190 BBC #ASB$V_RECURSIVE,- ; if recursive RMS call ************ ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;2 243 BNEQ 30$ ; N/A: return to caller 244 BRW 25$ ; Don't disable security auditing for journal file conditions 245 246 ; 247 ; Rename recover or RMS Heuristic attribute forced write-back. 248 ; First, turn off security audits to suppress the entry that 249 ; would otherwise be caused by the (successful) file access. 250 ; Indicate that security auditing must be restored (by RM$CLEAR_BYPASS). 251 ; Jump to merge with journaling code that sets BYPASS privilege. 252 ; 253 23$: PUSHL R0 ; save R0 (contains QIO function code) 254 PUSHL R4 ; save R4 (used by CHMK, etc., for PHD) 255 PUSHL #0 ; no arguments 256 $CMKRNL_S- 257 ROUTIN=KRNL_DISAUD,- 258 ARGLST=(SP) 259 POPL R0 ; Throw away the arglist. 260 POPL R4 ; restore R4 (was trashed by KRNL_DISAUD & CHMK) 261 BISL2 #2, R3 ; indicate that security auditing must be restored 262 BRW 26$ 263 264 ; 265 ; 266 ; RU Journal file create or delete, rename failure restore, 267 ; or RMS Heuristic attribute forced write-back: Turn on BYPASS 268 ; privilege. 269 ; 270 25$: PUSHL R0 ; Save R0 - this contains our QIO function 271 26$: SUBL #8,SP ; Allocate space for prev. priv. on stack 272 MOVL SP,R2 ; R2 points to prev priv 273 $SETPRV_S - ; Enable BYPASS and sense previous 274 ENBFLG = #1,- ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;1 201 BNEQ 30$ 202 203 25$: PUSHL R0 ; save R0 - this contains our QIO function 204 ; code 205 SUBL #8,SP ; allocate space for prev priv on stack 206 MOVL SP,R2 ; R2 point to prev priv 207 $SETPRV_S - ; enable BYPASS and sense previous 208 ENBFLG = #1,- ************ ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;2 278 ; No need to check status; code could fail only if system is hosed 279 BBS #PRV$V_BYPASS,(R2),27$ ; If did not previously have BYPASS, 280 BISL2 #1, R3 ; then set bit 0 to indicate BYPASS removal required 281 27$: ADDL #8,SP ; Pop priv. request mask from stack; throw away 282 POPL R0 ; Restore the QIO function code 283 30$: RSB 284 285 ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;1 212 ADDL #8,SP ; remove priv mask and request mask form stack 213 BLBC R0,SETPRV_FAIL ; if $SETPRV failed then bugcheck 214 POPL R0 ; restore the QIO function code 215 BBS #PRV$V_BYPASS,(R2),30$ ; if did not previously have BYPASS 216 INCL R3 ; set R3 = 1 to require BYPASS removal 217 30$: RSB 218 ************ ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;2 288 ; 289 ; R3 bit 0 set, then BYPASS reqires removal 290 ; R3 bit 1 set, then security auditing requires restoration 291 ; 292 RM$CLEAR_BYPASS:: 293 .RMS_JSB_ENTRY 294 ; 295 ; 296 ; If required (indicated by bit #1 in R3), then 297 ; restore security auditing to previous state by calling 298 ; the $RESTORE_AUDIT macro in kernel mode. (KRNL_RSTAUD 299 ; trashes R4.) 300 ; 301 BBC #1, R3, 20$ 302 PUSHL R4 ; save R4 (used by CHMK, etc., for PHD) 303 PUSHL #0 ; no arguments 304 $CMKRNL_S- 305 ROUTIN=KRNL_RSTAUD,- 306 ARGLST=(SP) 307 POPL R0 ; Throw away the arglist 308 POPL R4 ; restore R4 (was trashed by KRNL_RSTAUD & CHMK) 309 ; ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;1 221 222 RM$CLEAR_BYPASS:: 223 .RMS_JSB_ENTRY 224 225 ; r3 set to 1, if BYPASS reqires removal 226 ; ************ ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;2 312 20$: BLBC R3,40$ ; if BYPASS was taken then 313 $SETPRV_S - ; disable BYPASS privilege ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;1 229 BLBC R3,40$ ; if BYPASS was taken then 230 $SETPRV_S - ; disable BYPASS privilege ************ ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;2 317 ; No need to check status; code could fail only if system is hosed 318 40$: RSB 319 ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;1 234 BLBC R0,SETPRV_FAIL ; if $SETPRV failed then bugcheck 235 40$: RSB 236 237 ; 238 ; Bugcheck if we either could not take BYPASS privilege to create or delete 239 ; an RUJ file, or, once we had obtained BYPASS we could not give it back. 240 ; 241 SETPRV_FAIL: 242 RMSPBUG FTL$_RUHND 243 ************ ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;2 392 393 ; 394 ; 395 ; Kernel mode routine to disable security auditing and save 396 ; the previous audit setting(s) for restoration later. 397 ; ($DISABLE_AUDIT function must be executed in kernel mode.) 398 ; Upon entry, R4 will contain the PCB address (CTL$GL_PCB; placed 399 ; there by the CMKRNL dispatch routine). 400 ; 401 KRNL_DISAUD: 402 .CALL_ENTRY PRESERVE=<> 403 $DISABLE_AUDIT- 404 PCBREG=R4 405 MOVL #SS$_NORMAL, R0 ; always return success 406 RET 407 408 409 ; 410 ; 411 ; Kernel mode routine to restore security auditing. 412 ; ($RESTORE_AUDIT function must be executed in kernel mode.) 413 ; Upon entry, R4 will contain the PCB address (CTL$GL_PCB; placed 414 ; there by the CMKRNL dispatch routine). 415 ; 416 KRNL_RSTAUD: 417 .CALL_ENTRY PRESERVE=<> 418 $RESTORE_AUDIT- 419 PCBREG=R4 420 MOVL #SS$_NORMAL, R0 ; always return success 421 RET 422 423 424 DECLARE_DATA_PSECT ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;1 316 DECLARE_DATA_PSECT ************ Number of difference sections found: 11 Number of difference records found: 152 DIFFERENCES /IGNORE=()/MERGED=1/OUTPUT=WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR_DIFF;1- WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;2- WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RM0FILFNC.MAR;1 DIFFERENCES: RMS0RENAM.MAR ------------- ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR;2 1 $BEGIN RMS0RENAM,25,RM$RMS, 2 ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR;1 1 $BEGIN RMS0RENAM,24,RM$RMS, 2 ************ ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR;2 6 ; * 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, * 7 ; * 1992, 1994, 1995, 1996 * 8 ; * All Rights Reserved. * ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR;1 6 ; * 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1991, 1992* 7 ; * All Rights Reserved. * ************ ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR;2 36 ; X-25 LC0008 Larry Camilli 7-JUN-1996 37 ; BUGFIX: Added enabling BYPASS privilege and disabling 38 ; security auditing (via RM$SET_BYPASS) for the (duration of) 39 ; restoration of a file name after a rename attempt fails. 40 ; This is to ensure that the restore can succeed (barring an 41 ; asynchronous event such as a hardware failure or the disk 42 ; becoming write-protected) regardless of the protection of 43 ; any files with the original file name and lower version 44 ; numbers. 45 ; 46 ; X-24 EMW0048 Elinor M. Woods 22-Feb-1995 ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR;1 35 ; X-24 EMW0048 Elinor M. Woods 22-Feb-1995 ************ ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR;2 431 432 .DISABLE FLAGGING ; %AMAC-I-MUSTBEJSB, branch target must be declared JSB_ENTRY 433 BRW RM$CLSCU ; go evaporate ifab & return to user 434 .ENABLE FLAGGING 435 ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR;1 420 BRW RM$CLSCU ; go evaporate ifab & return to user 421 ************ ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR;2 438 439 .IF NOT_DEFINED,RMS_DEBUG ; Standard RMS (can't set BYPASS or CMKRNL from user mode for debug RMS) 440 BISL2 #IFB$M_RENAME_RECOVER,- ; indicate that this is a rename recover, so bypass will be enabled and 441 IFB$L_BKPBITSEXT(R9) ; security auditing will be disabled 442 .ENDC 443 444 BSBW FILFNC ; do the re-enter *ASSUMPTION -- R5 HAS 445 ; NOT CHANGED SINCE LAST ENTER. 446 447 .IF NOT_DEFINED,RMS_DEBUG ; Standard RMS (can't set BYPASS or CMKRNL from user mode for debug RMS) 448 BICL2 #IFB$M_RENAME_RECOVER,- ; indicate that this is NOT a rename recover 449 IFB$L_BKPBITSEXT(R9) ; 450 .ENDC 451 452 BLBS R0,80$ ; if re-enter worked, return the error from the first enter attempt 453 BRW ERRREENT ; if not, give up - file has been lost ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR;1 424 BSBW FILFNC ; do the re-enter *ASSUMPTION -- R5 HAS 425 ; NOT CHANGED SINCE LAST ENTER. 426 BLBS R0,80$ ; if enter worked, return an error 427 BRW ERRREENT ; if not, give up - file has been lost ************ ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR;2 529 530 .DISABLE FLAGGING ; %AMAC-I-MUSTBEJSB, branch target must be declared JSB_ENTRY 531 BRW RM$CLSCU ; Cleanup and exit. 532 .ENABLE FLAGGING 533 ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR;1 503 BRW RM$CLSCU ; Cleanup and exit. 504 ************ ************ File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR;2 690 691 .DISABLE FLAGGING ; %AMAC-I-MUSTBEJSB, branch target must be declared JSB_ENTRY 692 BRW RM$CLSCU ; go evaporate all internal structs 693 .ENABLE FLAGGING 694 ****** File WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR;1 661 BRW RM$CLSCU ; go evaporate all internal structs 662 ************ Number of difference sections found: 7 Number of difference records found: 40 DIFFERENCES /IGNORE=()/MERGED=1/OUTPUT=WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR_DIFF;1- WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR;2- WORK4:[CAMILLI.BUG_FIXES.LC0008_RENAME_LOST_FILE.CHECK-IN]RMS0RENAM.MAR;1