From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-40137.protonmail.ch (mail-40137.protonmail.ch [185.70.40.137]) by sourceware.org (Postfix) with ESMTPS id CB86C3858D35 for ; Wed, 15 Feb 2023 09:38:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CB86C3858D35 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=protonmail.com Date: Wed, 15 Feb 2023 09:38:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1676453897; x=1676713097; bh=E3EzeWVJT9Me1sGXAPkw6KjiX4l/U8eVFr9ccnh079A=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=C5uKsoSxEucMAUQ3xbZDty6vo1VhFbVVFUf8a2ZjRljUnA2BYE8+ktS/cHtBenddO PtkbPrnAdn68+9yw//ZTQiBtqR5O+Xlu1YvRzEoKEyoIFaQ+BwmAkBzVjHhNVLqdBl DhK//KEOtpnVhJu/u7jDB22dPn+IAurT9Pih4CYbxErJfizsaJ81xj4tdzuq5spznY iS/3XbX7aghxtzIeCqNP1cR6EwrTZi/lX2eqpeNWyMuu6tuLO7LIrhP1BDeaMYiR7J QVBqMBxWv8waIVeq0W0CsAdVBHVs676zOtDrXPkjRQYhtP0VU022CKqlclY8r/AGtk sIqIduIPuFU+Q== To: "cygwin@cygwin.com" , "cygwin-developers@cygwin.com" From: w6b7rk5yu4mt25v3 Subject: Why do these mprotect always fail? Message-ID: Feedback-ID: 67221101:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.0 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=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: mprotect 1: unsigned char* buffer; int32_t available, size; if(size > PAGE_SIZE) { factor =3D size / PAGE_SIZE + 1; } available =3D factor * PAGE_SIZE; if(posix_memalign((void**)&buffer, PAGE_SIZE, available)) { std::wcerr << L"Unable to allocate JIT memory!" << std::endl; exit(1); } if(mprotect(buffer, available, PROT_READ | PROT_WRITE | PROT_EXEC) < = 0) { std::wcerr << L"Unable to mprotect" << std::endl; exit(1); } mprotect 2: if(posix_memalign((void**)& buffer, PAGE_SIZE, PAGE_SIZE)) { std::wcerr << L"Unable to allocate JIT memory!" << std::endl; exit(1); } if(mprotect(buffer, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC) < 0) { std::wcerr << L"Unable to mprotect" << std::endl; exit(1); } Sent with Proton Mail secure email.