reactos/ntoskrnl
George Bișoc fe23a4aaeb
[NTOS:CM] Lock the entire registry down when we unload a hive
The PR #6649 which fixed an issue with orphaned KCBs leaking in memory which also pointed to unloaded registry hives, it also brought a problem.
In CmpEnumerateOpenSubKeys there is a risk of getting hit by a deadlock as we enumerate the cache table to remove empty cache entries.

Fundamentally CmpEnumerateOpenSubKeys locks down a KCB from cache for exclusive use in order to tear down its contents from memory but it doesn't address the fact a KCB might have already been locked in the same calling thread, leading to a recursion.
This leads to random hangs when unloading a hive during system startup (tipically on a clean install).

The solution here is to simply lock the whole registry when we unload a hive so that we don't have to worry the KCBs are getting tampered by anybody else. This also simplifies the code.
Although locking the entire registry while other apps are doing registry related operations to other hives can cause overhead. If this turns out to be bad then we have to rethink the locking mechanism here.

CORE-19539
2024-06-01 16:17:47 +02:00
..
cache
cc [NTOS:CC] Restore unlock/reacquire locks around MmPageOutPhysicalAddress (#5735) 2024-04-30 13:59:50 -05:00
config [NTOS:CM] Lock the entire registry down when we unload a hive 2024-06-01 16:17:47 +02:00
dbgk
ex [NTOS:EX] Various fixes for Daylight Saving Time transitions (#5868) 2024-05-05 21:32:04 -05:00
fsrtl
fstub [NTOS:FSTUB] Pack the MASTER_BOOT_RECORD structure (#6416) 2024-02-08 01:02:19 +03:00
inbv [NTOS:EX] Fix a loop bug 2024-03-19 07:43:20 +01:00
include [NTOS:CM] Lock the entire registry down when we unload a hive 2024-06-01 16:17:47 +02:00
io [NTOS:IO] IoDisconnectInterrupt(): Switch to ExFreePoolWithTag() (#6503) 2024-05-05 17:03:42 +02:00
kd
kd64 [NTOS:KE/x64] Implement Kd processor switching 2024-04-23 15:50:06 +02:00
kdbg
ke [NTOS:IO] IoConnectInterrupt(): Fix default spinlock initialization (#6503) 2024-05-05 17:03:20 +02:00
lpc
mm [NTOS:MM] section.c: some trivial cleanup (#5651) 2024-05-21 11:08:40 +02:00
ntkrnlmp
ob
po [NTOS:PO] Set SystemBatteriesPresent when having a battery device in the system 2024-02-05 18:04:02 +01:00
ps
rtl [RTL] Minor formatting, remove redundant 'return'. 2023-11-16 17:06:40 +01:00
se
tests
vdm
vf
wmi
CMakeLists.txt
guid.c
KrnlFun.c
ntdll.S
ntos.cmake [NTOS:KE/x64] Implement processor freeze code 2024-04-23 15:50:06 +02:00
ntoskrnl.rc [NTOS:INBV] Isolate the bitmap resources pertaining to the boot theme/animation into their resource sub-file. 2023-12-24 22:39:36 +01:00
ntoskrnl.spec [MSVCRT][NTDLL][NTOS] Add import aliases for _swprintf and _vswprintf 2024-05-22 17:55:38 +02:00
sysfuncs.lst