From patchwork Sun Jun 11 11:44:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?John_H=C3=B6gberg?= X-Patchwork-Id: 1793544 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.a=rsa-sha256 header.s=selector1 header.b=caAWzckj; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QfCnQ6Ywzz20Ww for ; Sun, 11 Jun 2023 21:50:49 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q8JZs-0005lA-0s; Sun, 11 Jun 2023 07:49:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q8JZp-0005kv-Rv for qemu-devel@nongnu.org; Sun, 11 Jun 2023 07:49:46 -0400 Received: from mail-vi1eur04on2075.outbound.protection.outlook.com ([40.107.8.75] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q8JZn-0006xZ-Ke for qemu-devel@nongnu.org; Sun, 11 Jun 2023 07:49:45 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lZBQqgzjsbWW9jHAG7CUMuQfN4b9IWWkMH2k32hPUvCM5CDZTLZOgVXPbVz7OcxcMUCaz/LN4o0yPI4Z62Boo12+SH7LVJ8Aeueu3Q7EWYSzVWzMNVulSyPm4il+XJ9TEm/j5CaMB2rKrbb7UVV7mTICaKKrwFpFoi6MoKULVcxESvRTML+0S+kvhGQnAikz1W+Yfiz7MRRgUAkwinQL3EiderLGbOTxn8arAFYH9NyNCkKmqQqjG58EOZsFBkw7tGyIUQ9aW9p2BWAwdIjcCvlqD2BgNkS/RenzQGpTjDAGow9O39OB7qSfOjxMDWEaJFwTn6YLSknZpmpWjjGx5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=HUO6zvaAmG0st79KcojVvBY0Woouunoi9B9FK7yEIGo=; b=lnejamYF6xNOtSpLL5PNNxLdOEys3y7471TtbyvnVlnt0iGfEdTo/6RY1irIh9TLB7aMPjCqY82vgLy4OxY8IsTH2EYIEFMHPYPX6vWGA4vkyCycMhK8GL7tF0M3uT6v62myLH+LnAtAW7GU1xyH+wck5MJnrs+Pz6I1t7qEYcH0nHnC/kvaZY2k/tOUAQl/RmYN13G/UDw13i7RNiNWxweMPG0UAt/xXXzLtQb5CSoa9Vz153skG5PjPGgbVpX4t2FOUMPdVzjloGnH78t2Ql9YnfVr6sUJoGXOUNc0MYq0ElN/rUjEpKVoTa0EtVBEN3PuYIKE9/n+1OYjtyH5bQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ericsson.com; dmarc=pass action=none header.from=ericsson.com; dkim=pass header.d=ericsson.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HUO6zvaAmG0st79KcojVvBY0Woouunoi9B9FK7yEIGo=; b=caAWzckja+gytK5+AuzMhw2EtOOx5pn6l1nhM95wboZHOhIpWH7GUos28OQAlfUq1EoxpsNTGRqBAwVSDYwzfAqPEfil5i9TKd8U47fQmPBuYPkCWW2UVLlTXbKVsPXkRGan5g3/0ZZUBNg8Ch2db3MGtOlR/00qi5fE6xeS3iQ= Received: from DU0PR07MB8833.eurprd07.prod.outlook.com (2603:10a6:10:310::5) by DU0PR07MB8396.eurprd07.prod.outlook.com (2603:10a6:10:353::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.36; Sun, 11 Jun 2023 11:44:36 +0000 Received: from DU0PR07MB8833.eurprd07.prod.outlook.com ([fe80::568:2863:92fb:8e85]) by DU0PR07MB8833.eurprd07.prod.outlook.com ([fe80::568:2863:92fb:8e85%7]) with mapi id 15.20.6455.030; Sun, 11 Jun 2023 11:44:36 +0000 From: =?utf-8?q?John_H=C3=B6gberg?= To: "qemu-devel@nongnu.org" CC: "peter.maydell@linaro.org" Subject: [PATCH 0/2] target/arm: Improve user-mode compatibility with JITs Thread-Topic: [PATCH 0/2] target/arm: Improve user-mode compatibility with JITs Thread-Index: AQHZnFoYHww65hpZGUWDxjw7BDeovQ== Date: Sun, 11 Jun 2023 11:44:36 +0000 Message-ID: <833e7382b3fb90a2bbb007932cb5dbb8cfff5a33.camel@ericsson.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ericsson.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DU0PR07MB8833:EE_|DU0PR07MB8396:EE_ x-ms-office365-filtering-correlation-id: a1b547eb-332d-4d04-028b-08db6a713b82 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: cjkQIQ9vTpHa4sBpIPU9l7KJ+eBeO+GoBKwdObgHTYLwxET2pKkatgQ/c4j6XQBSN/ESkjeKadyA2aTxQM8NwOFUpRjoEqUgx1Z45mw2M/NrUnwZ+/5CovPyD162fJegYUUvIXo33KWcTVfA5NP+yoKh6R5iZ9aLB10L7ORc+u97BJWwDASDWEbrOKwE9JVkjZ88IZog+vah5hYXQ2j3Ef2WkWdTfhJ9/YuluI8p2XK1ys/X4rsjrnjCBbwByiW+qL5Qn81fmtRGHRwZNoNNypSEMbgmL1/O9daWB9cgriOqJpx5pyJ2G3wk4SL2VMKJmkefMQivDl/Hnd3UZGu4VtzUhmz4tNgAiNktdW3eO5AQjLYdgSIHf1l0Ubf19Rxre0bzgsLW5tV1HxjyCXjY2CUaqkO7FgDH7t9vhc+4/7b5oo7K8PeMJxh6l4yoAjmMIYDwY2JSTgD1KHvEfUd3kuCUAqJd0LPYBJ5tRXDPN/6Yy05+PxV+iTDaSvprOkZGRRq7JRyuz5MUCqlnMTleMiZ0Gu7RQhcl+CZzHjjeHmN6xUKUwhuts1PxHaoPFre8IyU73Mgg0X6h2iKB6NjIiZzdJb5b3bQKc8x7mg2oXXQ= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU0PR07MB8833.eurprd07.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(376002)(366004)(39860400002)(396003)(136003)(346002)(451199021)(41300700001)(85182001)(71200400001)(966005)(8936002)(36756003)(8676002)(5660300002)(6916009)(64756008)(66476007)(91956017)(76116006)(66556008)(316002)(4326008)(66946007)(66446008)(478600001)(2906002)(38100700002)(6486002)(83380400001)(85202003)(6506007)(6512007)(26005)(186003)(38070700005)(2616005)(122000001)(82960400001)(86362001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount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=?utf-8?q?ax7mhcIDffGKdqknBLvMyQmEKlPCs3v5EXmxUNrx5ot3iYwSlf8IRi5ol4DpNRkWe?= =?utf-8?q?siRKZi/OS8SJtEMI7gYpaFjnE9J1O4Eq4lYeKkoJ6LYYwgIZyPgAMGAUN/50aBilQ?= =?utf-8?q?mupjGaNhMlaQ65EHYDp/ZLrgVPKWldR1ItcCTDiGUWvsFu5sEdGOfKErFp2lElKCz?= =?utf-8?q?nAcbbrnGZS0h/QyKrZ5vjSx2mkr+LksoMr1Rt2P0eJl56w/St9ess9+JUWXDk7RY7?= =?utf-8?q?wj60FaFb1HOORui8BBdsS/+pqL+WzxFhfEt4S7Xopb3ooNU2P0aI4bBU43HhX3tZu?= =?utf-8?q?zEf5js/BZkhAFig0ZLhRTB+GBhE/pA1zle9Ko/1nZMrt+Zl9OR259j34D1bGUD+Iy?= =?utf-8?q?DqUv0ZZidU6/QbW9clbESdSjuOq5xPJl3JPpCadRZExAO6fHLm6dYvJXk/0CkV7rG?= =?utf-8?q?JyTvbLA5djUr4t/Pyw+5/YhREs+0gkVoo63KMxcdBJ6e8OeEmbGjpldmU0wtDOSN9?= =?utf-8?q?yLlmAktgJd7AfQNk2zXuq2PbsOTcwGZMJY5KJ2o8fN/LkMjVHPad1t0PmEy0DSDD5?= =?utf-8?q?ncLed56aLYrGibZpOYxkw0FGAAO0qOncWFTl10M6SYfP6UoUzMUhW7rzJy6EpEAnJ?= =?utf-8?q?GY8L19t8kZItEydUeljAdTicjU+qEGFp7gNO8U4f5HX7HceGyvXC01DzuWn7Bx1D3?= =?utf-8?q?pJTTbVBTURVcoQuyhc+uPVY0xw9VCmgjqQ=3D=3D?= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DU0PR07MB8833.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a1b547eb-332d-4d04-028b-08db6a713b82 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jun 2023 11:44:36.5148 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: W6XONc+vN/4PeMXZmQzD/K4GrbjWm1r7ZZ8SPsM24nqwoUPMNJz1kogorGYVWCi4NLXXuW/PnyWbHC4rlhJ2MuCm47yJSgRZ2T+Sf2No+5k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR07MB8396 Received-SPF: pass client-ip=40.107.8.75; envelope-from=john.hogberg@ericsson.com; helo=EUR04-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When running in user-mode QEMU currently fails to emulate JITs that use dual-mapped code to get around W^X restrictions, where one mapping is writable and one is executable. As it has no way of knowing that a write to the writable region is reflected in the executable one, it fails to invalidate previously translated code which leads to a crash at best. (Note that system mode is unaffected as the softmmu is fully aware of what is going on.) This patch series catches changes to dual-mapped code by honoring the cache management instructions required to make things work on actual hardware. See https://gitlab.com/qemu-project/qemu/-/issues/1034 for more details John Högberg (2): target/arm: Handle IC IVAU to improve compatibility with JITs tests/tcg/aarch64: Add testcases for IC IVAU and dual-mapped code target/arm/helper.c | 47 ++++++- tests/tcg/aarch64/Makefile.target | 3 +- tests/tcg/aarch64/icivau.c | 204 ++++++++++++++++++++++++++++++ 3 files changed, 250 insertions(+), 4 deletions(-) create mode 100644 tests/tcg/aarch64/icivau.c