public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: w6b7rk5yu4mt25v3 <w6b7rk5yu4mt25v3@protonmail.com>
To: cygwin@cygwin.com
Subject: Re: Fw: Re: Why do these mprotect always fail?
Date: Wed, 15 Feb 2023 12:40:50 +0000	[thread overview]
Message-ID: <0Qjpbo0t_1WTd9--kVw5gLR1PdJzG7myKYzhxdzDIqnWYwLnywFCtSbekykskWViaSJM_bcLQBEFT_wg4-IApgEYrX5bHFIZH7Ro40oDYGs=@protonmail.com> (raw)
In-Reply-To: <Y+zMcAP/eIZ1DTi8@calimero.vinschen.de>

You misunderstood what I said.

It's really just a naming conflict and a coincident. On the context of the source code (it's an interpreter), PAGE_SIZE is indeed JIT_PAGE_SIZE (not the system page size, but the page size defined internally by the interpreter). On Linux, the name doesn't conflict. On Cygwin, I found on limits.h and cygwin/limits.h already defined PAGE_SIZE so it caused a naming conflict:

#define __PAGESIZE 65536
#define PAGESIZE __PAGESIZE
#define PAGE_SIZE PAGESIZE

But the problem not related to the naming conflict. If I renamed PAGE_SIZE to JIT_PAGE_SIZE, the problem is still there. The problem is Cygwin will not work with JIT_PAGE_SIZE = 4096. Please have a look at the code I posted. It will always error with "Unable to mprotect".

Sent with Proton Mail secure email.

------- Original Message -------
On Wednesday, February 15th, 2023 at 19:13, Corinna Vinschen <corinna-cygwin@cygwin.com> wrote:


> On Feb 15 11:14, w6b7rk5yu4mt25v3 via Cygwin wrote:
> 
> > Corinna Vinschen wrote:
> > 
> > > cygwin-developers is for developers woking on Cygwin itself, not for
> > > developers using Cygwin to develop something else. I dropped the ML
> > > from the recipient list.
> > > 
> > > And please don't top-post. Thanks.
> > > 
> > > On Feb 15 09:43, w6b7rk5yu4mt25v3 via Cygwin wrote:
> > > 
> > > > Almost forgot, PAGE_SIZE is set to 4096. This is a Linux application,
> > > > when I compile on Cygwin it complained that PAGE_SIZE is redefined but
> > > > the compilation was success nevertheless. Only when I run the
> > > > application, I always exited with "Unable to mprotect".
> > > 
> > > PAGESIZE is 64K on Cygwin. If you change that, it breaks and you can
> > > keep the pieces.
> > > 
> > > It would be nice to send a complete, self-contained STC() in plain C,
> > > so reproducing your issue is simple and doesn't require to rework
> > > your code to get a running, debuggable testcase.
> > 
> > PAGE_SIZE is just a naming conflict. If you change it to something
> > else, JIT_PAGE_SIZE for example, it still fails.
> 
> 
> You're misunderstanding what PAGESIZE or PAGE_SIZE means. It's the
> system page size used for mappings, and it's a fixed value defined by
> the system and provided to you by the system headers and, especially,
> sysconf(_SC_PAGE_SIZE).
> 
> It's NOT something you can just change and think the result will still
> work. Especially given that mmap doesn't know that you changed a macro
> in your application code...
> 
> > The problem is Cygwin
> > is not fine with the particular value 4096 but the program needs the
> > value to be exactly 4096.
> 
> 
> Sorry, but that can't work. If the program actually demands it, it's
> non-portable.
> 
> 
> Corinna

  reply	other threads:[~2023-02-15 12:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15  9:38 w6b7rk5yu4mt25v3
2023-02-15  9:43 ` w6b7rk5yu4mt25v3
2023-02-15 10:32   ` Corinna Vinschen
2023-02-15 11:14     ` Fw: " w6b7rk5yu4mt25v3
2023-02-15 12:13       ` Corinna Vinschen
2023-02-15 12:40         ` w6b7rk5yu4mt25v3 [this message]
2023-02-15 13:02           ` Oskar Skog
2023-02-15 15:31             ` Fw: " w6b7rk5yu4mt25v3
2023-02-15 16:33               ` Corinna Vinschen
2023-02-15 17:20                 ` [EXTERNAL] " Lavrentiev, Anton (NIH/NLM/NCBI) [C]
2023-02-19 13:08                 ` w6b7rk5yu4mt25v3
2023-02-19 15:40                   ` Fw: " w6b7rk5yu4mt25v3
2023-02-15 13:41           ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='0Qjpbo0t_1WTd9--kVw5gLR1PdJzG7myKYzhxdzDIqnWYwLnywFCtSbekykskWViaSJM_bcLQBEFT_wg4-IApgEYrX5bHFIZH7Ro40oDYGs=@protonmail.com' \
    --to=w6b7rk5yu4mt25v3@protonmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).