From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id E4D58385782B for ; Wed, 25 Aug 2021 09:27:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E4D58385782B Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-346-HT7OVidJM_WOY9D-fWk_FQ-1; Wed, 25 Aug 2021 05:27:06 -0400 X-MC-Unique: HT7OVidJM_WOY9D-fWk_FQ-1 Received: by mail-wr1-f71.google.com with SMTP id p1-20020adfcc81000000b001576cccf12cso906911wrj.6 for ; Wed, 25 Aug 2021 02:27:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=obm3/rjPUo6ZpQ92fbpUjFKPuFlJgTrCHOC/RAsL91Q=; b=i1iJCKG9LeY0bBEpfP1W+7SXGzj9Ok4PA/6KM89oSlae/uDDzX4XuZfUq/kUCCV6d0 KXaKme2S+F3DJpTuJX1J3z2smpmfZrz2Dnkgp2ZTBzs4zjHg8TRzdEBSJdfmAgFQtg+A bqC0vhckMlhZGGe+aPmK1Aul9Z/4ZlBj2K/fImoFQTikMZwMFWIImDJPy/UymO3mzIjn ldOki/kstdrLKdrqeaTBGuG4yOQRJd0/Y6HMZ4/6qvsvSKL/l0CEjHx7+pDjOftzP7KU NmjAxmStGDNTMjSm3B8WBSfgVEvXwAWj7fEbSfUKktZ6iCZAD0Cd7Vokq7SHYlbuLaUx taPw== X-Gm-Message-State: AOAM5339cQfZTZqqFkvX/W3cz+ymnO+PRFFV7RGstGF1GBfi5xW1Q2sl OvQ5zXt7OCqoTiO3pTPaju+b75MqPWlmh1ujA178kkcZCD1WxqxYNsMgi/AYBNB9MAWVsW/UBgH 6EyYLfmCyts2mGfK3oiRpPW0y5AzQZwrw6Y3sF+FO5+J6K86UoNT2lbKtH8PMNjLy599l8Fs= X-Received: by 2002:a05:600c:2f9a:: with SMTP id t26mr8206570wmn.110.1629883624779; Wed, 25 Aug 2021 02:27:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6uTHJO2y+5u7yVwlpV6Pkn/u1Hr1uIylQCwLmXwJa3afmbkCnYLemCxaCGGdAM09CHxCTsg== X-Received: by 2002:a05:600c:2f9a:: with SMTP id t26mr8206548wmn.110.1629883624559; Wed, 25 Aug 2021 02:27:04 -0700 (PDT) Received: from zarquon.pink (cpc108959-cmbg20-2-0-cust731.5-4.cable.virginm.net. [80.0.22.220]) by smtp.gmail.com with ESMTPSA id d124sm4757941wmd.2.2021.08.25.02.27.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Aug 2021 02:27:03 -0700 (PDT) To: libffi-discuss@sourceware.org References: <09e0d2b62f62482b2fa1c29120a43078@mail.kylheku.com> From: Andrew Haley Subject: Re: is fork() supported? Message-ID: <4da1a4e5-fbac-5d5f-b5ee-abe0b252ed80@redhat.com> Date: Wed, 25 Aug 2021 10:27:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libffi-discuss@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libffi-discuss mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Aug 2021 09:27:19 -0000 On 8/24/21 10:58 PM, Jay K via Libffi-discuss wrote: > I believe MacOSX also has this as an extension like this, in that > instead of giving an fd to map, you can give an address, to another > function, I cannot find the name. This can be used, I guess, to > avoid remapping the entire .so. Mac solves the problem in a much nicer way, one that is JIT-friendly but does not allow pages to be both W and X. Here's how it works: Call mmap with the MAP_JIT option to create a memory region for the new machine instructions. Call pthread_jit_write_protect_np() with the value false to disable JIT write protections for the memory region in the current thread. Write the machine instructions to the memory region. Note that this is *per thread*. other threads will simply continue to execute code in the JITted region. The JIT can generate code, but can not execute any JITted code until it calls pthread_jit_write_protect_np(true). Of course this requires threads to have differently-mapped regions. It would be very nice to have in Linux. It is the right way to do it. https://developer.apple.com/documentation/apple-silicon/porting-just-in-time-compilers-to-apple-silicon -- Andrew Haley (he/him) Java Platform Lead Engineer Red Hat UK Ltd. https://keybase.io/andrewhaley EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671