public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* I discovered the problems why the program I'm trying to port crashed
@ 2023-02-19 16:56 w6b7rk5yu4mt25v3
  2023-02-20 19:38 ` Brian Inglis
  0 siblings, 1 reply; 2+ messages in thread
From: w6b7rk5yu4mt25v3 @ 2023-02-19 16:56 UTC (permalink / raw)
  To: cygwin, cygwin-developers

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).

Goodbye. It's better to use WSL directly than messing with Cygwin nowadays.

Sent with Proton Mail secure email.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: I discovered the problems why the program I'm trying to port crashed
  2023-02-19 16:56 I discovered the problems why the program I'm trying to port crashed w6b7rk5yu4mt25v3
@ 2023-02-20 19:38 ` Brian Inglis
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Inglis @ 2023-02-20 19:38 UTC (permalink / raw)
  To: cygwin; +Cc: w6b7rk5yu4mt25v3

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-20 19:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-19 16:56 I discovered the problems why the program I'm trying to port crashed w6b7rk5yu4mt25v3
2023-02-20 19:38 ` Brian Inglis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).