From 8d60d2e115111e7203bd0546947f814d1eff2133 Mon Sep 17 00:00:00 2001 From: Joachim Henze Date: Wed, 13 May 2020 17:08:25 +0200 Subject: [PATCH] [0.4.14][NTOSKRNL] Restore section layout for NTOSKRNL to fix BSOD regression CORE-14683 This version (after .rsrc) works different than the proper version I used for 0.4.12 (after .reloc). Inserting after .rsrc is actually not correct, but Thomas believes it can be used as a temporary trick to avoid random memory corruption upon relocations of the kernel, caused by ROSBE-154. I follow his advice, although when judging from practical tests only: as long as we limit this script to NTOSKRNL like I do for releases there have no negative consequences been observed in real life yet even with the proper version of 0.4.12. Up to now those problems have only been observed when used for drivers MODULE TYPE sdk/cmake/gcc.cmake as well, like it was tried for a moment in master 0.4.13-dev-609-g c4d8e2a6e9660c1f0d0d24877219baca443bbce0 Using for drivers immediately did lead to BSODs like CORE-16183 and therefore was mitigated in master by total disabling of the scripts for both, kernel and drivers in 0.4.13-dev-621-g 36e9a6f8ddc70018b55b0cad0b13128b1cbb60c2 To allow installing DVDWritenow without BSOD, we need the script at least for ntoskrnl! I committed this patch (after .rsrc) already into 0.4.13RC and master cherry picked from commit 0.4.15-dev-220-g d28677795e98cdd4fdf0f4aff2773197a6b39718 --- ntoskrnl/CMakeLists.txt | 3 +-- sdk/cmake/init-section.lds | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ntoskrnl/CMakeLists.txt b/ntoskrnl/CMakeLists.txt index 96fcab407d9..be575b9892f 100644 --- a/ntoskrnl/CMakeLists.txt +++ b/ntoskrnl/CMakeLists.txt @@ -38,8 +38,7 @@ else() else() set_image_base(ntoskrnl 0x80800000) endif() - #Disabled due to LD bug: ROSBE-154 - #add_linker_script(ntoskrnl ${REACTOS_SOURCE_DIR}/sdk/cmake/init-section.lds) + add_linker_script(ntoskrnl ${REACTOS_SOURCE_DIR}/sdk/cmake/init-section.lds) endif() target_link_libraries(ntoskrnl cportlib csq ${PSEH_LIB} arbiter cmlib ntlsalib rtl ${ROSSYM_LIB} libcntpr wdmguid ioevent) diff --git a/sdk/cmake/init-section.lds b/sdk/cmake/init-section.lds index 2b815150105..ca46bd1451e 100644 --- a/sdk/cmake/init-section.lds +++ b/sdk/cmake/init-section.lds @@ -8,4 +8,5 @@ SECTIONS __init_end__ = . ; } } -INSERT AFTER .reloc; +/*INSERT AFTER .reloc;*//*This is what we actually want to do, but do not dare due to LD bug ROSBE-154*/ +INSERT AFTER .rsrc; /*This is what we do instead to at least fix CORE-14683*/