delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/02/15/10:32:53

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2DF6B385841C
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1676475129;
bh=CX/9VS85CwVmI7tjTBn1v+1WkJDVPEdlQSbq1pp3et4=;
h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=agX34BXkdfdQADApPz6dYqOi3o/XQveB3cBgDt8Q1olysugqF2mwE0tkrcQoARifK
RgABOHPzEes8KbZkZ+viCWkBkd6A/6IpsR72u3GSL9mOwmzT/yxnEpMWVk1E7FVnVz
cQg8G7kGVtvC1cMBKewcWj03RJ33XmeSe8ZO6ubQ=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 007B13858D35
Date: Wed, 15 Feb 2023 15:31:38 +0000
To: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: Fw: Re: Fw: Re: Why do these mprotect always fail?
Message-ID: <3HScWpQC8pjnPC4OBYIhgMMGaPTBCH_T8o8mMC72UMMMgtodqjjUCRpC81hW8SF9PUk-e3rmxeI8y45aaOGTrZ1MFu7FK3tJ-3XXclG2i3I=@protonmail.com>
In-Reply-To: <d594b5d0-8810-c752-97ff-a28b2524552f@oskog97.com>
References: <yxifinJpR7DQ4XDFwpYMrUknNpsg8wu5T1KYPeNIwjf3FL_lYou0whmzg-XCoFgYlcz96k0yEjkrxCOQOOTztnk_tvW7ZNi8_riHbsOn-ZU=@protonmail.com>
<ruVqVpKyYTyh3m-4mzaAg2pyhJAqlamcbUYKB8ghh_LwAKIqpabv0LNqlt8_Owfzx0Hc6c1C6nJE4Czf4hod2ukAWe3b6p_WAaaGLPk7CI8=@protonmail.com>
<Y+y0zRQWVRWBkhCX AT calimero DOT vinschen DOT de>
<TlepM9ESIu1ZpPCpz1vzmSoBKsKnuUABID2BREun8gb9tEPApKByf5s-_DHR9C6h48OdPFnU5uZ0Xc4JTTd-gtPH2RqhOHgOiSh-spI9K88=@protonmail.com>
<Y+zMcAP/eIZ1DTi8 AT calimero DOT vinschen DOT de>
<0Qjpbo0t_1WTd9--kVw5gLR1PdJzG7myKYzhxdzDIqnWYwLnywFCtSbekykskWViaSJM_bcLQBEFT_wg4-IApgEYrX5bHFIZH7Ro40oDYGs=@protonmail.com>
<d594b5d0-8810-c752-97ff-a28b2524552f AT oskog97 DOT com>
Feedback-ID: 67221101:user:proton
MIME-Version: 1.0
X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT,
FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS,
TXREP autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: w6b7rk5yu4mt25v3 via Cygwin <cygwin AT cygwin DOT com>
Reply-To: w6b7rk5yu4mt25v3 <w6b7rk5yu4mt25v3 AT protonmail DOT com>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

This is a multi-part message in MIME format.

--b1_mOVn5HWGsfcHaCWZ49eZWY9kAWoYeplUEw37MWGrZk
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

I asked the developer of the interpreter. He said it's OK to use the PAGE_S=
IZE value different than 4096. So I used this dirty hack:

#ifndef __CYGWIN__
#define PAGE_SIZE 4096
#endif

This means on Cygwin it will use the default PAGE_SIZE defined on limits.h =
(I'm taking advantage of the naming conflict here so I don't have to rename=
 PAGE_SIZE to JIT_PAGE_SIZE as suggested by the developer of the interprete=
r).

The result is it's no longer error with "Unable to mprotect" but will silen=
tly crashed without any error messages printed on the screen. So after all,=
 it's Cygwin's quirks here.

Sent with Proton Mail secure email.

------- Forwarded Message -------
From: Oskar Skog via Cygwin <cygwin AT cygwin DOT com>
Date: On Wednesday, February 15th, 2023 at 20:02
Subject: Re: Fw: Re: Why do these mprotect always fail?
To: cygwin AT cygwin DOT com <cygwin AT cygwin DOT com>


> On 2023-02-15 14:40, w6b7rk5yu4mt25v3 via Cygwin wrote:
>=20
> > You misunderstood what I said.
> >=20
> > 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 (n=
ot the system page size, but the page size defined internally by the interp=
reter). 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 confli=
ct:
> >=20
> > #define __PAGESIZE 65536
> > #define PAGESIZE __PAGESIZE
> > #define PAGE_SIZE PAGESIZE
> >=20
> > But the problem not related to the naming conflict. If I renamed PAGE_S=
IZE to JIT_PAGE_SIZE, the problem is still there. The problem is Cygwin wil=
l not work with JIT_PAGE_SIZE =3D 4096. Please have a look at the code I po=
sted. It will always error with "Unable to mprotect".
>=20
>=20
> The Linux man page for mprotect says that the address MUST be aligned
> (with the systems PAGE_SIZE). Your call to posix_memalign is NOT
> aligning the allocation with the systems PAGE_SIZE (65536), but with
> your PAGE_SIZE (4096).
>=20
> You need to allocate memory that is aligned with the systems PAGE_SIZE.
>=20
> Eg.
> if(posix_memalign((void**)&buffer, (PAGE_SIZE>JIT_PAGE_SIZE) ? PAGE_SIZE
>=20
> : JIT_PAGE_SIZE, available)) { ... }
>=20
> --
> Problem reports: https://cygwin.com/problems.html
> FAQ: https://cygwin.com/faq/
> Documentation: https://cygwin.com/docs.html
> Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
--b1_mOVn5HWGsfcHaCWZ49eZWY9kAWoYeplUEw37MWGrZk
Content-Type: application/pgp-keys; name=OpenPGP_0x473CD05C78734E49.asc
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=OpenPGP_0x473CD05C78734E49.asc

LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgp4c0ROQkdFQUMwc0JEQUMwT0Fu
MnYrMitORkxrMy9IdExsa2ZUUlBqbjdVWTJ2NzAwaGw3WTNLc3hLRmZibmdQCmxIcVBPS3MraExk
M2tpRHlWNmZad1RGYUxSNEpXQUZQcEVLMmI5clkxcDlXS0t2R24xTnUvTlpsUEVvSGZrOXIKVnBo
Q0hLdU9pdzFvQTk3Ly9yQlh1bStoN1lzVmF2YTNRZFZVOWZoK2VGdWFlV1grSTJyVlhvN1lPbWFT
dlc0dAprdWszTUpQNk05VU55bnYyaFNGMysvTm1rbktENXV3ZTl3ZTNYQzNiNE8zYjZpMXNYbWp0
KzdhcU5jWmJtbDdRCkF1cVRIc3MzTlZzcndPVVZ0ZHV6MTI1eFF0Tm1YL3o5M0JMOFc3UXY0bnJL
S08xNzIrR1kyeUJMa3l2U1J2Ry8KRldKTmREMkNwNnpBd2p1a0RZOHZaRWNvd3RWYlZVSFhYNU5z
UU9jT0lNYVh5S2V3b1pKRUJ5akQwOW5vb2VhdgpwdUdyNERQdVB6bnV6VFBGK0xzcWJmU1lwSVJ2
QVI2eHdrK2p2Z0g0Vm1oNjVDMS9xLzBr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zEwR3JKbHZLOFljWS84enc5ZUhh
Cnh6RkpPMG50K3p3NVM0OUFpWUpXSXNLclpwK2dPZmFzRmtQZmtnT0kySWkwR25wVEM1dmd0bXpT
Um1GTlFMajYKSmlqVTlpU2hTdFVGMkZsZ2toZWhCdExMMEJ5bTNONUU3ZnpzT2VTemtxWWkyNFZp
K0NVVWNWakZQYnAyZlhWegpuc1pZSi9uY3hXT0JVVloxRzRnRkhDKy9OVm9HT0p2VUN1MUg4VkZk
ZkhncG9wbXc2U2VGaHY0azBLcU5yRU40CkkrNTE0cXRUQS9NRlZZaDNMVDJHOXdIUzVZRExDTGRy
VFpwY2JVL0p0bXBPNktuNXByZENjWk9lYnpLN0tSeHIKWmNzQjlEY3ZhOERJWWhQU1hiN3IvRExw
cm56VEdVb1d0ZnptellLblBhT0J3V2hHdFpCYUZZc2dXZnlhRlMyZApqRm4xK0tyMXRYRi9JNWF5
MGI0djN1ND0KPTdXWFkKLS0tLS1FTkQgUEdQIFBVQkxJQyBLRVkgQkxPQ0stLS0tLQo=

--b1_mOVn5HWGsfcHaCWZ49eZWY9kAWoYeplUEw37MWGrZk
Content-Type: application/octet-stream; name=OpenPGP_signature.sig
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=OpenPGP_signature.sig

wsD5BAABCAAjFiEEQtZagxq7BWVG4ZGeRzzQXHhzTkkFAmPs19EFAwAAAAAACgkQRzzQXHhzTklf
bwv+NcPVT+I954LE4gGDBJK7LafTCrb6PVc9n9/wNEMv2QYH2zvNpXJrPpdnkaKb/6Hcp8DPVMiI
wy3s4G4BNj1DbnyBkRmj2IPFFa7nlOBiMyNUCuwREUGFiCcP9g10yVv4FmvXfMzxhWVIXS0AFD3H
YxjFkUEXb5xkcIdm0dczdK5od+h1oRsNoNdztTcZbtl9pMvUhlkkcoR1w6sf5MUz2eH1RCLEIfHp
SY9G7ZfL9a8LFYaSCud9/wc8t170WT8wY9nHlGJ4llFutbs2HXUZuJFQXOvsW0YJIPUiOinKymbA
JLmGnOrzSBRFVjCKbaLAV/7+jwGNWk1CNYkIagbARHMg6boRS1ITgW4jc9gBdDkitJgnsZyMqisC
AkfYyCcCL+AADi8Z/ITMLmETapypQKFcyP/8ko3FwtIRekDpWUw76QbY2YuxPLHicCgOHf0R9o0j
g8AiNsMoqiXdkGIhAHl/FUyGH5/1UUyZ9HUZf42dB1i9GBswFRwxG9IdXfgL

--b1_mOVn5HWGsfcHaCWZ49eZWY9kAWoYeplUEw37MWGrZk
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

--b1_mOVn5HWGsfcHaCWZ49eZWY9kAWoYeplUEw37MWGrZk--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019