bitwiseworks / libcx

kLIBC Extension Library
GNU Lesser General Public License v2.1
11 stars 1 forks source link

Assertion on PAG_WRITE-only mmap #47

Closed dmik closed 7 years ago

dmik commented 7 years ago

If only PAG_WRITE is passed to a MAP_SHARED memory mapping, an assertion may happen during msync like this one:

LIBCx version : 0.6.0_dev
LIBCx module  : C:\USR\LIB\LIBCX0.DLL (hmod=05ea)
004f7b65 01 ff 0000 Asrt: Assertion Failed!!!
004f7b65 01 ff 0000 Asrt: Function: <NULL>
004f7b65 01 ff 0000 Asrt: File:     D:/Coding/libcx/master/src/mmap/mmap.c
004f7b65 01 ff 0000 Asrt: Line:     1200
004f7b65 01 ff 0000 Asrt: Expr:     arc == NO_ERROR
004f7b65 01 ff 0000 Asrt: 87

A live use case is described here https://github.com/bitwiseworks/mozilla-os2/issues/247#issuecomment-346048314

dmik commented 7 years ago

The assertion happens because DosSetMem ends up with zero flags being passed which causes it to return error 87 (ERROR_INVALID_PARAMETER). A fix is trivial, I've already applied it and testing Mozilla JS Shell again.