DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 4BGJx8Ut3831587 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 4BGJx8Ut3831587 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=PxHn6Q/L X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B1D53857C63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1734379145; bh=FvqwbHFTKL64xyMo5bAf96gnzFkQXpnjXra3tGaSXME=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=PxHn6Q/LXTM9EKhtXrfOOxLh0iuXFClQEy6eEZ1125mq2XqYIbKXuGX3G/PVpbQNz HdMO6CvsEF/B0gM24EWb2jKR1j1iB1bLPaa7FRsntdOCcwsQfYbKVI7GNP8oR/RmLY BrSzmqIYxb4yiBm+heFCDTmzIEWELyre6ePZpG4Q= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E050A3857C5D ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E050A3857C5D ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1734379119; cv=pass; b=NOePvDD6bnwh93pMdig6P3USVDuUMjcKlka/wKI+Gd8ayoLqLJc1BRLy2PfFOrCL5ez5+g7oCQMcyUBFyLTPZ/5yQlhpXkz5CFz+NtKNPHiAClbOrMTiOsIgAmwRWVqZ7YeIVc5X+HsugDSpOiWWdfc8XXHpDzJCGQkLtnI1f1w= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1734379119; c=relaxed/simple; bh=etpZYWxN1Ok9q9PplWa6LxMP9TU57bu01ZQe2lwb/Zo=; h=DKIM-Signature:Message-ID:Date:Subject:To:From:MIME-Version; b=DjrOh/S8r6YtAqWt9e0E7HK9ncQMxMgOC2+7duj1y3vpwoeH2H6NydsjEJfJiCpLZpodsrkqVX5569uQMLJ5sq8oVMkL4NfabvFkFx+jrH9EqVnnRBTMkfa5xs7NkPGSitQOqQyn8HfAn3nCwT0+8s3VjKN6Ij4PPkEYM5G1MkI= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E050A3857C5D ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jbu51o1IXcUXpzTuJH8E27uJ7jWULDvQEWys0cpo6w27VrwL0irHOFbA9lH+pO7dhPnxbHbyAVrogIJ8Imk4T9/fT15yfU8NYpp4m3uie4Tsma3flI5Tdum+rZ90OS3zt7wy4v2HLkTdaVEjcNkShS/ooHqL8YofAX83+65bM+r0Ox+Vdy5/bwf/a3jEQJJzoc6TuhmTgbyj/XvpC07UfWLWEeaOIYJ1OZGWsNL9PRwHQXXqHPZPMlf/Xmled6avMh7pdkztqE3Be9XWBxxUpjet7pqsnrzUJF6kYpLcpZs1jjirrd3Zx/2zFDX4wluKmepHoqkQmBa49yQPhKkjzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=G4pKiWK0lLYbtZkn2ZYpFGrFsYx8JqL6kPBOKhLn1OQ=; b=sW4UCdHLn2kxq3hDI4FHzt05La44MuWPA4+zbe5AdMrXMyHy2P1zAv9stRtYyDDgz8fHb/UC/zJjAR/mv8E3zFzLW8fnrQmTHk44JkLXN9Efy8n4NW7o32fLXD+tmY76h3zY1vNCrYA2soWKAJVVnIQJ50klwSy9b98/pt+Z5Ynbdy+TCzwcEbEIyZskPyAPFahMaqlPS8Xmb5BfVAC2wI17cM0Qs/6rcfkaWZaEDKCzSVK0qpN5ddZJLHxKL/dD8HwE2hZsTCDiiSiDH6k6SPVU1Mo279t1+nVlkuhzrepxpBNELaNudn6BrKdz9R0ybXLelOza9aGZb0sQm6S+QA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none Message-ID: Date: Mon, 16 Dec 2024 14:58:35 -0500 User-Agent: Mozilla Thunderbird Subject: Re: Atomic mmap replacement To: cygwin AT cygwin DOT com References: <66bf4f86-4618-b9a3-3e33-2c240b9204d0 AT cornell DOT edu> <20180219090042 DOT GC3417 AT calimero DOT vinschen DOT de> Content-Language: en-US In-Reply-To: X-ClientProxiedBy: BLAPR03CA0118.namprd03.prod.outlook.com (2603:10b6:208:32a::33) To SN6PR04MB5151.namprd04.prod.outlook.com (2603:10b6:805:90::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR04MB5151:EE_|PH0PR04MB7255:EE_ X-MS-Office365-Filtering-Correlation-Id: af7b2050-69b4-4d30-bf2e-08dd1e0c0756 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?B?MzNPWEFuTjBYd2poNHBUQ00yaDhEZXA2YXRxMHhsZEJPZnpTY3Nmakx6U3I2?= =?utf-8?B?dDMwMTUwZE9rbXdSNUxjK0VQdXYzaVdlS2pINTJmUGVFR1hacnkxYmxENTJz?= =?utf-8?B?emRXcHJzQ3JRYWFsQ3d6QTNMUndvZHBpM1ZVRzZQTTA0eHRvS0xxNTJjVGNl?= =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.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Q0x4M2ZLazBDSFN0cjZ0QWtUMkRYWDNnZEJWN0lZcDZ4VURTNFZsUjNBcmlS?= =?utf-8?B?VGdKUzFvbW5ZdEk5aG4yZXVodW83Q3ZaNDNMZnYwNEZOejBYSkZGVWdwaUFG?= =?utf-8?B?UUo1U1k3a3k4Mk9zNVBManBNKy9YMTd1Z3VBUjl0S0ZPUXN5bnZFNzN5bklG?= =?utf-8?B?VkRCQTRjQUF4ZnVPNW54b0JROGhFSjRzQkRpV1ZvaWxvU2FqZlhsZ2d1eXlW?= =?utf-8?B?OHVjTUdCN08zdkFHMHBkZ0QydXdJRCtFcjdaNm9waWZSTHlRRVIwUkFHbTgw?= =?utf-8?B?YkJOTm93TWZGR2xhL0RESys0NDN3c0s3empQV1lmNnlPSlM2UzR0OS9kUEVG?= =?utf-8?B?ajFib2E4dm1vaFBCVUhQR3FtWjZObEMxODg1WFdRTEZtSkxUWGl3cVpXVmhK?= =?utf-8?B?N1ZtMWp3b2FaczQ2VzQ1RDQ2elJFYXNiOE4zbG00eTIwRlFjeUN3eDBIMXVq?= =?utf-8?B?RHFOYTRmUkE4MEN5TGNPT2FnQllMZ2JHNUlSSFk5R3U0OVg2NXFYZCszRnFY?= =?utf-8?B?cG9HS3p2TW9oNXp5NW85L0FCTVdWVktOSUZMTXhjOXZuRGRGeEw2MWkxZ1hZ?= =?utf-8?B?d1lGeEhMY3I0R29GdXNuRXhOVC9XOWw4dGQ5SkJGdGJCa2RGMnREV1BhRHRK?= =?utf-8?B?ZE5XTXljelRzbXNWbmxlNW9zWE9hUVlGbUljcmNxaTVCSDYvVE91c0x4bzRX?= =?utf-8?B?aEVab2ZWVHo5dFJaOERma2FhQ1lvbzJGQStrK0JidXpSd0w3VmhmQVJtSHdN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FdVQU0vT1g2ZkMycUps?= =?utf-8?B?bFJEaGtRencwMDlDTHp2K1hVUGhvMVl3NlpIUWJFWm42czE5bzNpMldleVg1?= =?utf-8?B?c21uc3ZoTDNrbjhVQ1ErSUFDOXZSbEppdTg5bno4TFVLb0JqR1pRWGtKenda?= =?utf-8?B?V2dpZ1JITDcrNzExRzl1eHRaRFdJTFoxS3hCemp1ZG9SZ2E2WnFMaFpWNGxV?= =?utf-8?B?OGV2WThtdDdabG5BSm84K3E5dHhnQjlJajZVbk9TeFl5Z2l1WTNiS1dLbEs5?= =?utf-8?B?cXIxMWd6bmRFU25aSzdKZXk4eFM2UkRjVk52eUxQdHJsT202MTRRUVprOVRF?= =?utf-8?B?L05HMmllckx6bnJGcHVYa2ZOdE1WQlNJbE83SkZQbTJPMXVBejBJTC9YUlNE?= =?utf-8?B?VzdZcHhWL2hWWVAvMzdiUmxBenNneWpyaEVjd1EzSkJteDlneThGSFlwM2Vm?= =?utf-8?Q?8nQyms76yQdmX/XTQEPQaWu2s?= X-OriginatorOrg: cornell.edu X-MS-Exchange-CrossTenant-Network-Message-Id: af7b2050-69b4-4d30-bf2e-08dd1e0c0756 X-MS-Exchange-CrossTenant-AuthSource: SN6PR04MB5151.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2024 19:58:36.9710 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d7e4366-1b9b-45cf-8e79-b14b27df46e1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NdH+/1++B77k1hszyxmmkA+Gk0E9U3pGXVdlxDtqOS3IHtZt6xaMkVz7HMZ4WhiuSsDijLujRYICT57PFFXlLQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR04MB7255 X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Ken Brown via Cygwin Reply-To: Ken Brown Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" On 12/16/2024 8:32 AM, Corinna Vinschen via Cygwin wrote: > Right now, mmaping with PROT_NONE and then re-mmaping with PROT_WRITE > doesn't work. Cygwin implements PROT_NONE not as MAP_RESERVE, but as > MEM_COMMIT with PAGE_NOACCESS. mmap() doesn't check if the requested > pages are already allocated with PAGE_NOACCESS and then succeeds while > in fact just changing the page protection. This is basically what > you want. Right now, you'd have to call mprotect() instead. > > With anonymous mappings only, this is all just adding a bit of code to > mmap() to do what mprotect() does in this case. [...] > So only anonymous mappings would be possible, assuming we tweak mmap() > to check if the old mapping was anonymous either and then allow to > just change the page protection, as if mprotect has been called. > > And, funny enough, something pretty similar already exists in mmap(). > See mmap.cc, line 1051 and the mmap_list::try_map() method. Right > now it only checks if an anonymous mapping has been partially unmapped > and can be recycled. But it could be improved by allowing to recycle > the anonymous mapping either way, as long as the new mapping is also > anonymous and the SHARED/PRIVATE flags match. Thanks! This looks doable. I hope to get back to you with a patch in the not-too-distant future. Ken -- 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