I discovered the problems why the program I'm trying to port crashed
Brian Inglis
Brian.Inglis@Shaw.ca
Mon Feb 20 19:38:31 GMT 2023
On 2023-02-19 09:56, w6b7rk5yu4mt25v3 via Cygwin wrote:
> Quoted from https://cygwin.com/pipermail/cygwin-cvs/2020q3/014516.html:
>
> "The file mapping will be only a single page, 4K, and since 64 bit systems don't support the AT_ROUND_TO_PAGE flag, the remainder of the 64K slot will result in a SEGV when accessed."
>
> "The justification is that there's very likely no application actually utilizing the map beyond EOF, and we know that all bytes beyond EOF are set to 0 anyway."
>
> Unfortunately, the application I'm trying to port do exactly that. If you set JIT_PAGE_SIZE to 64k (same as PAGE_SIZE) to satisfy mprotect then it will expect the whole 64k to be accessible. On other systems, no problems. On Cygwin, crashed with segmentation fault. I was right. Not the application's bug, but Cygwin's quirk (I called it as a quirk but not a bug, because it's a limitation of the platform).
SMOP: YMMV
Round up the page size yourself and allocate that value if allocation round up
not supported on platform or version.
I think if 1 byte is mapped, access to byte 2 should be SEGV/UB/)\;`a__!
)/ /-." ~~
sb/dwb
> Goodbye. It's better to use WSL directly than messing with Cygwin nowadays.
For small amounts of Windows interoperability with MS "Linux".
May be useful for comparing compatibility, but so are VMs, with fewer MS "quirks".
--
Take care. Thanks, Brian Inglis Calgary, Alberta, Canada
La perfection est atteinte Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut
-- Antoine de Saint-Exupéry
More information about the Cygwin
mailing list