Skip to content

Commit 1cc00e1

Browse files
committed
avoid race condition that could corrupt user stack if DOS re-entered too soon
apply suggested fix from SF bug 215 (https://sourceforge.net/p/freedos/bugs/215/), InDOS cleared but small chance DOS re-entered before user stack restored thus corrupting user stack
1 parent dabfaf7 commit 1cc00e1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

kernel/entry.asm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ int21_normalentry:
406406
push bp
407407
call _int21_service
408408

409-
int21_exit: dec byte [_InDOS]
409+
int21_exit:
410410
%IFDEF WIN31SUPPORT
411411
call end_dos_crit_sect ; release all critical sections
412412
%if 0
@@ -417,6 +417,10 @@ int21_exit: dec byte [_InDOS]
417417
%endif
418418
%ENDIF ; WIN31SUPPORT
419419

420+
; tiny chance DOS re-entered between clearing InDOS and restoring user stack,
421+
; so we disable interrupts until user stack restored; see SF bug# 215
422+
cli
423+
dec byte [_InDOS]
420424
;
421425
; Recover registers from system call. Registers and flags
422426
; were modified by the system call.

0 commit comments

Comments
 (0)