From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1C09C433E0 for ; Thu, 21 Jan 2021 20:07:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 86AA923A54 for ; Thu, 21 Jan 2021 20:07:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 86AA923A54 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=csgraf.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:52928 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2gF6-0003Tn-Ga for qemu-devel@archiver.kernel.org; Thu, 21 Jan 2021 15:07:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2gEI-000205-1Q for qemu-devel@nongnu.org; Thu, 21 Jan 2021 15:06:54 -0500 Received: from mail.csgraf.de ([188.138.100.120]:51356 helo=zulu616.server4you.de) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2gEG-0006Ch-0W for qemu-devel@nongnu.org; Thu, 21 Jan 2021 15:06:53 -0500 Received: from macbook.alex.local (dynamic-095-117-099-148.95.117.pool.telefonica.de [95.117.99.148]) by csgraf.de (Postfix) with ESMTPSA id 6C07C39001A8; Thu, 21 Jan 2021 21:06:49 +0100 (CET) Subject: Re: [PATCH v4] tcg: Toggle page execution for Apple Silicon From: Alexander Graf To: Richard Henderson , qemu-devel@nongnu.org References: <20210121184752.1395873-1-richard.henderson@linaro.org> <6d5d9d93-30b6-2f71-e71b-94bd8f18198a@csgraf.de> Message-ID: Date: Thu, 21 Jan 2021 21:06:48 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <6d5d9d93-30b6-2f71-e71b-94bd8f18198a@csgraf.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Received-SPF: pass client-ip=188.138.100.120; envelope-from=agraf@csgraf.de; helo=zulu616.server4you.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roman Bolshakov , j@getutm.app Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 21.01.21 21:01, Alexander Graf wrote: > On 21.01.21 19:47, Richard Henderson wrote: >> From: Roman Bolshakov >> >> Pages can't be both write and executable at the same time on Apple >> Silicon. macOS provides public API to switch write protection [1] for >> JIT applications, like TCG. >> >> 1. https://developer.apple.com/documentation/apple_silicon/porting_just-in-time_compilers_to_apple_silicon >> >> Signed-off-by: Roman Bolshakov >> Message-Id: <20210113032806.18220-1-r.bolshakov@yadro.com> >> [rth: Inline the qemu_thread_jit_* functions; >> drop the MAP_JIT change for a follow-on patch.] >> Signed-off-by: Richard Henderson >> --- >> >> Supercedes: <20210113032806.18220-1-r.bolshakov@yadro.com> >> >> This is the version of Roman's patch that I'm queuing to tcg-next. >> What's missing from the full "Fix execution" patch is setting MAP_JIT >> for !splitwx in alloc_code_gen_buffer(). > > This patch segfaults in tcg_out32() for me if I add the MAP_JIT flag > manually to the mmap call: I take it all back. I forgot to actually git am the patch :(. It works just fine. Tested-by: Alexander Graf Alex