Hello all,
I have noticed, that pxefixup does not set IMAGE_SCN_MEM_NOT_PAGED flag
for read-only data section ".rdata". May it be, that it is problem
for my own build of tools
586-mingw32-gcc (GCC) 4.4.2 and
GNU ld (GNU Binutils) 2.20.51.20100608
I have fixed the problem by preparing modified LD script version
which collect object files .rdata section into .text section
for my driver build.
But .rdata is legitimate section and it is automatically
generated by GCC. I have not found information in Wiki
or list archives, that there is some way/patch to deal
with this situation. But if it is allowed, that WDM
driver binaries contains readonly section then data paging
could lead to horrible consequences. Possible fix
diff --git a/reactos/tools/pefixup.c b/reactos/tools/pefixup.c
index f908a9a..d6ec1f4 100644
--- a/reactos/tools/pefixup.c
+++ b/reactos/tools/pefixup.c
@@ -381,6 +381,7 @@ int main(int argc, char **argv)
if (!strcmp((char*)section_header->Name, ".text") ||
!strcmp((char*)section_header->Name, ".data") ||
!strcmp((char*)section_header->Name, ".idata") ||
+ !strcmp((char*)section_header->Name, ".rdata") ||
!strcmp((char*)section_header->Name, ".bss"))
{
section_header->Characteristics |= htodl(IMAGE_SCN_MEM_NOT_PAGED);
If .rdata are not allowed or should be used only for pseudo_reloc,
then the ldscript for kernel code should be provided.
Missing flag for .rdata section in objdump ouput
$ i586-mingw32-objdump --headers ul_wdm.sys
BFD: ul_wdm.sys: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .text
BFD: ul_wdm.sys: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .data
BFD: ul_wdm.sys: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .bss
BFD: ul_wdm.sys: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .idata
ul_wdm.sys: file format pei-i386
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 0000cabc 00011000 00011000 00001000 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 000000e8 0001e000 0001e000 0000e000 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .rdata 00003c20 0001f000 0001f000 0000f000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .bss 00000050 00023000 00023000 00000000 2**2
ALLOC
4 .edata 00000033 00024000 00024000 00013000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
5 .idata 000008c4 00025000 00025000 00014000 2**2
CONTENTS, ALLOC, LOAD, DATA
6 .rsrc 0000035c 00026000 00026000 00015000 2**2
CONTENTS, ALLOC, LOAD, DATA
7 .reloc 00000cd4 00027000 00027000 00016000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
8 .rossym 0001576d 00028000 00028000 00017000 2**2
CONTENTS, READONLY, NEVER_LOAD, EXCLUDE