From patchwork Mon Nov 18 19:35:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 844115 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp802989wrx; Mon, 18 Nov 2024 11:38:17 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXAzu7L5o34dQTSpqBb6H13llcn0ki4ubWtkZMglQqIiyuE/x6Cvc92qClgtl7lMyq9SnTHnA==@linaro.org X-Google-Smtp-Source: AGHT+IHnN+P4Ufg2GZXBgWsZWPd4Vui1X6kREFWBohVoSNAsnNbFoKEeoDE7pfGpumg6AU61Ss0R X-Received: by 2002:a05:620a:44d5:b0:7a9:c129:504f with SMTP id af79cd13be357-7b37aa80df8mr113503985a.23.1731958696734; Mon, 18 Nov 2024 11:38:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731958696; cv=none; d=google.com; s=arc-20240605; b=jHOE0TeyoIZG2/lqQ9mfsHqjA6QoQqW3pl9XbY+W1/c+1/YAAhl0TuV+dCELF9/XBO 7qYzH1VPrWfe+e2Y/BoAcczZWdm3GeaxMiY73ctVI4nugXwErlhzlXg4//I7owRxMoT0 sMO6EzZwuhyygA2VPaXFVmKxrHjODqFevwj451IY9isXKDxF6GjJWrygeL8cEIvJISKn kwq1C02SmigawP9R4x1XHE/DBka4fd8sQgUHFq7itRrZn/A4SmpGR7o+yP/fdV7S/QDU YwT7mHai6dnC1GieBCr9UtnS/V4d7FZDR92rO7KVdbtQiwTnRoatFp8dO8XDsTEvpC3L 0GUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=IeDvBIDZFLfUkn9dhrxMPrq9uQrr0LtxkH6TX/BKqpk=; fh=NoJ7n5JVE2hviRF6uNBFRIJvWH7igafuy1AIwg26ToM=; b=hXRgv0RB3vjW9ctOvHgD6JT4OGe7DVrgkGr0j4KwOJEJDuls9BLrwTXj7mbH6u8VYe uyMyZOboJwuIwVtGaqp9k/kKYfLPC1xuoFL5sJnltjC9Kl4NFbpoYhz3P7BfZFCMv5Uq AnxiPjjtCahXbZOPws268LZ0C0wBFr52KXdAG+oWseE2ifEsKQ2tn23YRoAWFZRrJM2Z DjkRX6+qtrTk0nW9R5FOm63peeLHwXNUVIEf4+yJ7ENLbJ6MLFBI1J6zMUq/E9idK4vE PZZqN/rcm4vnV63bBb8Z0mD1hfpU8NAniae7y7XIKLGRn/y+7oet6g87SFV9mgJYt9yd qjIQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b37a83c675si41525185a.69.2024.11.18.11.38.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 11:38:16 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD7X8-0006a4-2O; Mon, 18 Nov 2024 14:35:38 -0500 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 1tD7X4-0006Y2-F5; Mon, 18 Nov 2024 14:35:34 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tD7Wz-0002fl-39; Mon, 18 Nov 2024 14:35:34 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 6B92CA54DF; Mon, 18 Nov 2024 22:35:17 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id DF41A17359D; Mon, 18 Nov 2024 22:35:20 +0300 (MSK) Received: (nullmailer pid 2312676 invoked by uid 1000); Mon, 18 Nov 2024 19:35:20 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Richard Henderson , Peter Maydell , Michael Tokarev Subject: [Stable-8.2.8 51/61] target/arm: Drop user-only special case in sve_stN_r Date: Mon, 18 Nov 2024 22:35:06 +0300 Message-Id: <20241118193520.2312620-3-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson This path is reachable with plugins enabled, and provoked with run-plugin-catch-syscalls-with-libinline.so. Cc: qemu-stable@nongnu.org Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-ID: <20241112141232.321354-1-richard.henderson@linaro.org> (cherry picked from commit f27550804688da43c6e0d87b2f9e143adbf76271) Signed-off-by: Michael Tokarev diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index 5699dfe667..9694201550 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -6306,9 +6306,6 @@ void sve_stN_r(CPUARMState *env, uint64_t *vg, target_ulong addr, flags = info.page[0].flags | info.page[1].flags; if (unlikely(flags != 0)) { -#ifdef CONFIG_USER_ONLY - g_assert_not_reached(); -#else /* * At least one page includes MMIO. * Any bus operation can fail with cpu_transaction_failed, @@ -6339,7 +6336,6 @@ void sve_stN_r(CPUARMState *env, uint64_t *vg, target_ulong addr, } while (reg_off & 63); } while (reg_off <= reg_last); return; -#endif } mem_off = info.mem_off_first[0]; From patchwork Mon Nov 18 19:35:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 844116 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp803036wrx; Mon, 18 Nov 2024 11:38:23 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUoJIyphuWUVSvZeSxLZ0u80aXKUu1x5zB9kmKJ0RzB3rgeC/RjcysCQI33x8D880xRU2oLNA==@linaro.org X-Google-Smtp-Source: AGHT+IEgWvVnm1/szdlzeOMa/7UptbeAF+XOQdxE+IAvTVf4hoCCvb+a+6a07BVo2lWPXt8SSF2s X-Received: by 2002:a05:6214:e61:b0:6d4:22fc:ce3e with SMTP id 6a1803df08f44-6d422fcd24fmr62542036d6.44.1731958703422; Mon, 18 Nov 2024 11:38:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731958703; cv=none; d=google.com; s=arc-20240605; b=KWToXHOvo6mKEe3aPNN6Lip/QSCqyuyjzMHlaUCwu9yzzhnU6Ykv9V/NhpffCSNAmU pJr4OVS/gLEOGxvhOltZWS3H6aqhs5b4s6/e8v+dmqSgAceTVPHb67ANzXSgoxGFZjQ2 ghcuVMGIdpZmvds8jt7616H2k31DqG96NcYGnYQ5+gZnCh1c3dylgUvJwoRaaD7S7obA Ktdx6FNmy+Zs300HAUaQ8uoo88Vsi/KlM7QhW99lv8QfaxWLcVSDuwCDbM9yce5VPApl XYMT40nwmR8w1V5eglJ8MnGo6Kt4M95fy1G9GES+1pnjOAKOkKL43jj512CGkNUBiREI C02A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=hsAhJ7yKKRMCogFt+pR3tGm3W2vo3yTT665gB9zWgEc=; fh=fA8wXgZkOijV3QzeJqIqYxlGqKQb9nNVVJRQwjQ6hao=; b=BEnZHBa5fT1lnR/xsw7PrcN9Btb68yE2SIFZSUovmaT9GSpuLsTr418DZUr13l23ll kdcfGLXM0SE2Uu5ccZ4tCl/QoqXcRENwVbP0tnWMKURoJAPiO/J0rMQ8s28shtFt60YJ yHSv+nWeItV/9P1wRXx2UxIMXTDRCd/Xb8tWjAMgGrgOMQgrMrSQiVJykHhq8v94XvCI fq/sw4uPXJ45G7ckmjotZhddGEcyRhP/F4sgFQjoTpWPQEHrGbQjR60qnnyrhLKJrHoc Q/1KB1pvNBMEDuQjyX1ORWgrL+3Y+Wlb4B+YuwP8YAV4Ki0/oAOFueYOtpSvBqewUBkB iMow==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d40dcbca41si71726386d6.388.2024.11.18.11.38.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 11:38:23 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD7XC-0006dh-7R; Mon, 18 Nov 2024 14:35:42 -0500 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 1tD7X5-0006Z0-KY; Mon, 18 Nov 2024 14:35:35 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tD7X1-0002gF-Sm; Mon, 18 Nov 2024 14:35:35 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 793D6A54E0; Mon, 18 Nov 2024 22:35:17 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id ED1D617359E; Mon, 18 Nov 2024 22:35:20 +0300 (MSK) Received: (nullmailer pid 2312679 invoked by uid 1000); Mon, 18 Nov 2024 19:35:20 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9e?= , Michael Tokarev Subject: [Stable-8.2.8 52/61] accel/tcg: Fix user-only probe_access_internal plugin check Date: Mon, 18 Nov 2024 22:35:07 +0300 Message-Id: <20241118193520.2312620-4-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson The acc_flag check for write should have been against PAGE_WRITE_ORG, not PAGE_WRITE. But it is better to combine two acc_flag checks to a single check against access_type. This matches the system code in cputlb.c. Cc: qemu-stable@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2647 Signed-off-by: Richard Henderson Message-Id: 20241111145002.144995-1-richard.henderson@linaro.org Reviewed-by: Alex Bennée (cherry picked from commit 2a339fee450638b512c5122281cb5ab49331cfb8) Signed-off-by: Michael Tokarev diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index 68b252cb8e..e87848a5e2 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -794,7 +794,7 @@ static int probe_access_internal(CPUArchState *env, vaddr addr, if (guest_addr_valid_untagged(addr)) { int page_flags = page_get_flags(addr); if (page_flags & acc_flag) { - if ((acc_flag == PAGE_READ || acc_flag == PAGE_WRITE) + if (access_type != MMU_INST_FETCH && cpu_plugin_mem_cbs_enabled(env_cpu(env))) { return TLB_MMIO; } From patchwork Mon Nov 18 19:35:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 844114 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp802959wrx; Mon, 18 Nov 2024 11:38:11 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVgich3oZl1NAsZrx2uFpKoJj8alZ0DLEmaxhCNKuUEbjk+dvTbVtqUh+QNc0QMbQbypKoUAg==@linaro.org X-Google-Smtp-Source: AGHT+IEb5Fn9fCmc06UihSlpXw3UpgBATj3aSU6jz+yQqGaNnN3M+fRmZ3Wpevr5QYa7s5AocPb+ X-Received: by 2002:a05:6358:170d:b0:1c3:90ff:9721 with SMTP id e5c5f4694b2df-1c6cd12b1cemr562104755d.23.1731958690900; Mon, 18 Nov 2024 11:38:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731958690; cv=none; d=google.com; s=arc-20240605; b=SX5fkUFADnpkKADjOdcEOYOPzN9DK6j534k1pGm93627tfwlyPAEhDidu6R8ltkWYH DwXwqFftaFOBix/yAzfiTpm/GEXWz4UvpYjwgI4c9ibSTd9drEKHLyAX66NXEJHUE1E+ m8SUzrMGACHbbyDvtECiWSKCnCq21IJjEVG5vsqAxr7I+QdlEiM+GQ7oa7Yk1CwXA96l lB1Ox3KChRsdJuB4gg084rjtDa1N+CzY0/oAl256BtJ4fLIOGxZ538Cku58YB8XOPTGe tTBAWwHV+q8h8CWQQYBHLvPpTeiq8I5iX9cDUq8T0mfRy5GLmEdUZkqBy5QX4m70OOmG 4Nlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=UAF4xrnSiDr+6+n8Ih/c+HXHjjKo4DYLm/IpHVBiYaE=; fh=K4abbxCgZAPvqzOXA+PZ7RIZh+KufMVJze7rXLOwES0=; b=WApDf4zO3hOznuI6BC0B6pp6QIYDiGXsIkGO7G/qJqKvQx4XzwtvnFGDjZKvGoedxR 96/z3yQdNWoZFM3KtoJIdbuKt466et9bKsWdMkXaWA2TlDQvuSuWCq2SrBVW7IYJpKfC tyEnowD5+TZlhx2WB4vOptrgQStupeFLxPVvWIwyAhprhcKkfIdokV0LerFLqeWHtf3v T9jroha/oCPhoLuEsBhE8+OKdzdcpw1k9H03pllrbNooX4yq6F2ew27TnlCSSSUJHaEY X2xT1tZQIr9CNdmQt/A5c97JZgzStp2NrqdiRSUCNlMVN7erno3KlpMUq+Pv12QFx5Uh zOTg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d40db97e92si71472816d6.124.2024.11.18.11.38.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 11:38:10 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD7XC-0006dg-7n; Mon, 18 Nov 2024 14:35:42 -0500 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 1tD7X8-0006aD-J9; Mon, 18 Nov 2024 14:35:38 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tD7X6-0002h9-Vp; Mon, 18 Nov 2024 14:35:38 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 94BE2A54E3; Mon, 18 Nov 2024 22:35:17 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 148CC1735A0; Mon, 18 Nov 2024 22:35:21 +0300 (MSK) Received: (nullmailer pid 2312685 invoked by uid 1000); Mon, 18 Nov 2024 19:35:20 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Michael Tokarev Subject: [Stable-8.2.8 54/61] linux-user/arm: Reduce vdso alignment to 4k Date: Mon, 18 Nov 2024 22:35:09 +0300 Message-Id: <20241118193520.2312620-6-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson Reduce vdso alignment to minimum page size. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson (cherry picked from commit f7150b2151398c9274686d06c2c1e24618aa4cd6) Signed-off-by: Michael Tokarev diff --git a/linux-user/arm/vdso-be.so b/linux-user/arm/vdso-be.so index 69cafbb956..bed02804a4 100755 Binary files a/linux-user/arm/vdso-be.so and b/linux-user/arm/vdso-be.so differ diff --git a/linux-user/arm/vdso-le.so b/linux-user/arm/vdso-le.so index ad05a12518..38d3d51047 100755 Binary files a/linux-user/arm/vdso-le.so and b/linux-user/arm/vdso-le.so differ diff --git a/linux-user/arm/Makefile.vdso b/linux-user/arm/Makefile.vdso index 2d098a5748..8a24b0e534 100644 --- a/linux-user/arm/Makefile.vdso +++ b/linux-user/arm/Makefile.vdso @@ -6,7 +6,7 @@ VPATH += $(SUBDIR) all: $(SUBDIR)/vdso-be.so $(SUBDIR)/vdso-le.so # Adding -use-blx disables unneeded interworking without actually using blx. -LDFLAGS = -nostdlib -shared -Wl,-use-blx \ +LDFLAGS = -nostdlib -shared -Wl,-use-blx -Wl,-z,max-page-size=4096 \ -Wl,-h,linux-vdso.so.1 -Wl,--build-id=sha1 \ -Wl,--hash-style=both -Wl,-T,$(SUBDIR)/vdso.ld From patchwork Mon Nov 18 19:35:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 844113 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp802911wrx; Mon, 18 Nov 2024 11:38:01 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVD7qCmg9Owm2ghaxmsOuusQQ/xHEQx6suvlwwAonsvhDdQ962hIE5/vGq014EXYu79dhVWlQ==@linaro.org X-Google-Smtp-Source: AGHT+IEQ51JcfU7gz77kOppc6Ag3KjXERnbY+JKJSpHu5PqQhV5Vnk5RZuniBdwn+M4f4lalNsXY X-Received: by 2002:a05:622a:1826:b0:463:1039:e222 with SMTP id d75a77b69052e-46363e39b36mr192927791cf.30.1731958680915; Mon, 18 Nov 2024 11:38:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731958680; cv=none; d=google.com; s=arc-20240605; b=IP9SvbdoWWbBM09VR2scWgtyoX1/eFJXsKSnnnphePUa0yknitIEBiFrRK/YuchZtJ iXm50nZBsQ4LI+gIz+kS8DSoWYpq2e5ywVP5FBmCJsVzWyR43vZZtzjrewqi280yGCRr yOPcXYwQA+uzZagccU0G4CpY1Y3NXOqf7qoXCyCAbGfBknkjL9hzuZX2ILGJypOG6NKy 9WXGfrX1zhas8YF/mjhxjY1jo3N30dSnmtdbPnQwO2krTPMhtSP4mATRcQb63tjsc3b7 VcE5K8PdeIjVqCeWIIU/LqQpLdtizKFSlCJqTc466OUwg5l+fxrYs8h6dK406s5P3XBR CUNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=yITNLoPKXLUULxKxxb8Yn0jzK3a4YxvAx4+HwzZAHFE=; fh=K4abbxCgZAPvqzOXA+PZ7RIZh+KufMVJze7rXLOwES0=; b=Qwd02beyQSgEvB0BecopQIFaySoWU4rhh8wW0l64DSnG7WwmuQ4xC4unKkMTlSUYT0 YFpVdhaEDkkx+/6pI7wX7/exShHO+EOImGkkuY9azyQH1ExDKIP8p0FHGa8CnTRW1+5W Sg+DGibELMaQ/dnT00wbxxx549wjGYI+lj2JdGxOKgJaLXg8iauJJRCLM4AKq2rClSby wzJ9gboycy5wcAXhHGOlHAnlHpdp+6jLTjZxXfUPtPrA3FB3/8OvyEfp8DRrAxZoqCFJ o7OuLtHwV+yJsAoZprmU2CuLAh0XP7QFHaZXzprkMFZB8Jz+ayRlyLzFmam+eYXYl/9K 2aKw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-46392c1e968si3512221cf.302.2024.11.18.11.38.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 11:38:00 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD7XE-0006dw-NI; Mon, 18 Nov 2024 14:35:45 -0500 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 1tD7XB-0006d4-9V; Mon, 18 Nov 2024 14:35:41 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tD7X9-0002hV-1W; Mon, 18 Nov 2024 14:35:41 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id A38A3A54E4; Mon, 18 Nov 2024 22:35:17 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 221101735A1; Mon, 18 Nov 2024 22:35:21 +0300 (MSK) Received: (nullmailer pid 2312688 invoked by uid 1000); Mon, 18 Nov 2024 19:35:20 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Michael Tokarev Subject: [Stable-8.2.8 55/61] linux-user/arm: Select vdso for be8 and be32 modes Date: Mon, 18 Nov 2024 22:35:10 +0300 Message-Id: <20241118193520.2312620-7-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Richard Henderson In be8 mode, instructions are little-endian. In be32 mode, instructions are big-endian. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2333 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson (cherry picked from commit 95c9e2209cc09453cfd49e91321df254ccbf466f) Signed-off-by: Michael Tokarev diff --git a/linux-user/arm/Makefile.vdso b/linux-user/arm/Makefile.vdso index 8a24b0e534..ede489e236 100644 --- a/linux-user/arm/Makefile.vdso +++ b/linux-user/arm/Makefile.vdso @@ -3,15 +3,18 @@ include $(BUILD_DIR)/tests/tcg/arm-linux-user/config-target.mak SUBDIR = $(SRC_PATH)/linux-user/arm VPATH += $(SUBDIR) -all: $(SUBDIR)/vdso-be.so $(SUBDIR)/vdso-le.so +all: $(SUBDIR)/vdso-be8.so $(SUBDIR)/vdso-be32.so $(SUBDIR)/vdso-le.so # Adding -use-blx disables unneeded interworking without actually using blx. LDFLAGS = -nostdlib -shared -Wl,-use-blx -Wl,-z,max-page-size=4096 \ -Wl,-h,linux-vdso.so.1 -Wl,--build-id=sha1 \ -Wl,--hash-style=both -Wl,-T,$(SUBDIR)/vdso.ld -$(SUBDIR)/vdso-be.so: vdso.S vdso.ld vdso-asmoffset.h - $(CC) -o $@ $(LDFLAGS) -mbig-endian $< +$(SUBDIR)/vdso-be8.so: vdso.S vdso.ld vdso-asmoffset.h + $(CC) -o $@ $(LDFLAGS) -mbig-endian -mbe8 $< + +$(SUBDIR)/vdso-be32.so: vdso.S vdso.ld vdso-asmoffset.h + $(CC) -o $@ $(LDFLAGS) -mbig-endian -mbe32 $< $(SUBDIR)/vdso-le.so: vdso.S vdso.ld vdso-asmoffset.h $(CC) -o $@ $(LDFLAGS) -mlittle-endian $< diff --git a/linux-user/arm/meson.build b/linux-user/arm/meson.build index c4bb9af5b8..348ffb810d 100644 --- a/linux-user/arm/meson.build +++ b/linux-user/arm/meson.build @@ -10,10 +10,17 @@ syscall_nr_generators += { # is always true as far as source_set.apply() is concerned. Always build # both header files and include the right one via #if. -vdso_be_inc = gen_vdso.process('vdso-be.so', - extra_args: ['-s', 'sigreturn_codes']) +vdso_be8_inc = gen_vdso.process('vdso-be8.so', + extra_args: ['-s', 'sigreturn_codes', + '-p', 'vdso_be8']) + +vdso_be32_inc = gen_vdso.process('vdso-be32.so', + extra_args: ['-s', 'sigreturn_codes', + '-p', 'vdso_be32']) vdso_le_inc = gen_vdso.process('vdso-le.so', extra_args: ['-s', 'sigreturn_codes']) -linux_user_ss.add(when: 'TARGET_ARM', if_true: [vdso_be_inc, vdso_le_inc]) +linux_user_ss.add(when: 'TARGET_ARM', if_true: [ + vdso_be8_inc, vdso_be32_inc, vdso_le_inc +]) diff --git a/linux-user/arm/vdso-be32.so b/linux-user/arm/vdso-be32.so new file mode 100755 index 0000000000..b896d3d545 Binary files /dev/null and b/linux-user/arm/vdso-be32.so differ diff --git a/linux-user/arm/vdso-be.so b/linux-user/arm/vdso-be8.so similarity index 95% rename from linux-user/arm/vdso-be.so rename to linux-user/arm/vdso-be8.so index bed02804a4..784b7bdb2a 100755 Binary files a/linux-user/arm/vdso-be.so and b/linux-user/arm/vdso-be8.so differ diff --git a/linux-user/elfload.c b/linux-user/elfload.c index a79f915c37..17cd547c0c 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -652,6 +652,23 @@ static const char *get_elf_platform(void) #undef END } +#if TARGET_BIG_ENDIAN +#include "elf.h" +#include "vdso-be8.c.inc" +#include "vdso-be32.c.inc" + +static const VdsoImageInfo *vdso_image_info(uint32_t elf_flags) +{ + return (EF_ARM_EABI_VERSION(elf_flags) >= EF_ARM_EABI_VER4 + && (elf_flags & EF_ARM_BE8) + ? &vdso_be8_image_info + : &vdso_be32_image_info); +} +#define vdso_image_info vdso_image_info +#else +# define VDSO_HEADER "vdso-le.c.inc" +#endif + #else /* 64 bit ARM definitions */ @@ -951,14 +968,14 @@ const char *elf_hwcap2_str(uint32_t bit) #undef GET_FEATURE_ID -#endif /* not TARGET_AARCH64 */ - #if TARGET_BIG_ENDIAN # define VDSO_HEADER "vdso-be.c.inc" #else # define VDSO_HEADER "vdso-le.c.inc" #endif +#endif /* not TARGET_AARCH64 */ + #endif /* TARGET_ARM */ #ifdef TARGET_SPARC @@ -3586,12 +3603,14 @@ static void load_elf_interp(const char *filename, struct image_info *info, load_elf_image(filename, &src, info, &ehdr, NULL); } +#ifndef vdso_image_info #ifdef VDSO_HEADER #include VDSO_HEADER -#define vdso_image_info() &vdso_image_info +#define vdso_image_info(flags) &vdso_image_info #else -#define vdso_image_info() NULL -#endif +#define vdso_image_info(flags) NULL +#endif /* VDSO_HEADER */ +#endif /* vdso_image_info */ static void load_elf_vdso(struct image_info *info, const VdsoImageInfo *vdso) { @@ -3921,7 +3940,7 @@ int load_elf_binary(struct linux_binprm *bprm, struct image_info *info) * Load a vdso if available, which will amongst other things contain the * signal trampolines. Otherwise, allocate a separate page for them. */ - const VdsoImageInfo *vdso = vdso_image_info(); + const VdsoImageInfo *vdso = vdso_image_info(info->elf_flags); if (vdso) { load_elf_vdso(&vdso_info, vdso); info->vdso = vdso_info.load_bias; From patchwork Mon Nov 18 19:35:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 844117 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp803064wrx; Mon, 18 Nov 2024 11:38:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUKryBOImzwMr/JiDz2awTkO1WS07Ncl/4SiFk1KwWpXZh/F2qOjnxg50dNqz4B+/wn1z0X4Q==@linaro.org X-Google-Smtp-Source: AGHT+IE1z5565xMC+9JNEIIaA8Nxb2nie06Hg8uWMcCyZBVunReaXv79++QARMEwMZP3F5DYEzRl X-Received: by 2002:a05:620a:4015:b0:7a9:b4d2:9d69 with SMTP id af79cd13be357-7b3621af6d7mr1776152385a.0.1731958709122; Mon, 18 Nov 2024 11:38:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731958709; cv=none; d=google.com; s=arc-20240605; b=CDFHQ6NV0FJ70LX2R7IgAhgsY/eFjop8Xq1SiPMREtQkElF2e6wKM5v810UK34KIri LxW3So5TXz09FFdIy7Ov0DwKM26LGsm1brayxlJF80Rf0r0+7he7XAPcH82l8DYGOF9T hBkWmJdces2gu4kSlxTCmSLCweTFprBZFQ7OQq2W/zTeCktLIh+Cd0DP0zxzpNH75xxa u2db5e40fNJidVL89OrDjRfvxzXKzVrNnvk++x9BKbZKT6mbs6iiVZhWTbpwt5BTRnJL m1YoeeEVp6Z5/rpdv7qc5hpygD0RmswIHCwtnf90B970XRpZK6h5Xw3d3PJLZmCxqsWj /k+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=LMl3VgmaK3q3SYObD5m5qm3/+RRmrJcV4C3nTxs68sA=; fh=xJ1URYKcMN3TM0/XAv5v+aCN+5tIbzAdcfBx5UNgoLw=; b=gHBQKeT0NnVKHZJL4Rm4Xvo+BF373OLFrMizyrO6Yhc8uJyVnOjIDFBIJEv1uv289o Er6UcBJFEmfqQTDqJJOtlaVr7fSPTSB1H3E9wNDruNpX3cy6bbiWNOMuv27/UZRM+F0i bzS3BYpwWvFGhHABRwXsZHOBq7Q50ccRMFWv67dqnkkKYRVcHBl359DDXBm9xTOh8CNb YqMpCSgK4l/aMmshfbV/HB8xI9S8MrOcz2UPbKyof42t51Ve+mOnFvhgspIGG+f6OR97 G2BbHF3yRobS1D+tTH3T+24x1t3Wu6WrI8yyM2IJd/qWy/grp/4+cQIKMt1VrAdx2ilk goVw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b37a897f8dsi52645085a.405.2024.11.18.11.38.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 11:38:29 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD7XH-0006ey-1C; Mon, 18 Nov 2024 14:35:47 -0500 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 1tD7XB-0006dM-QC; Mon, 18 Nov 2024 14:35:41 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tD7X9-0002hg-V1; Mon, 18 Nov 2024 14:35:41 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id B1370A54E5; Mon, 18 Nov 2024 22:35:17 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 310691735A2; Mon, 18 Nov 2024 22:35:21 +0300 (MSK) Received: (nullmailer pid 2312691 invoked by uid 1000); Mon, 18 Nov 2024 19:35:20 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Peter Maydell , Richard Henderson , Michael Tokarev Subject: [Stable-8.2.8 56/61] tcg: Allow top bit of SIMD_DATA_BITS to be set in simd_desc() Date: Mon, 18 Nov 2024 22:35:11 +0300 Message-Id: <20241118193520.2312620-8-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell In simd_desc() we create a SIMD descriptor from various pieces including an arbitrary data value from the caller. We try to sanitize these to make sure everything will fit: the 'data' value needs to fit in the SIMD_DATA_BITS (== 22) sized field. However we do that sanitizing with: tcg_debug_assert(data == sextract32(data, 0, SIMD_DATA_BITS)); This works for the case where the data is supposed to be considered as a signed integer (which can then be returned via simd_data()). However, some callers want to treat the data value as unsigned. Specifically, for the Arm SVE operations, make_svemte_desc() assembles a data value as a collection of fields, and it needs to use all 22 bits. Currently if MTE is enabled then its MTEDESC SIZEM1 field may have the most significant bit set, and then it will trip this assertion. Loosen the assertion so that we only check that the data value will fit into the field in some way, either as a signed or as an unsigned value. This means we will fail to detect some kinds of bug in the callers, but we won't spuriously assert for intentional use of the data field as unsigned. Cc: qemu-stable@nongnu.org Fixes: db432672dc50e ("tcg: Add generic vector expanders") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2601 Signed-off-by: Peter Maydell Message-ID: <20241115172515.1229393-1-peter.maydell@linaro.org> Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson (cherry picked from commit 8377e3fb854d126ba10e61cb6b60885af8443ad4) Signed-off-by: Michael Tokarev diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 566fd6eef7..8117e4fb39 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -88,7 +88,20 @@ uint32_t simd_desc(uint32_t oprsz, uint32_t maxsz, int32_t data) uint32_t desc = 0; check_size_align(oprsz, maxsz, 0); - tcg_debug_assert(data == sextract32(data, 0, SIMD_DATA_BITS)); + + /* + * We want to check that 'data' will fit into SIMD_DATA_BITS. + * However, some callers want to treat the data as a signed + * value (which they can later get back with simd_data()) + * and some want to treat it as an unsigned value. + * So here we assert only that the data will fit into the + * field in at least one way. This means that some invalid + * values from the caller will not be detected, e.g. if the + * caller wants to handle the value as a signed integer but + * incorrectly passes us 1 << (SIMD_DATA_BITS - 1). + */ + tcg_debug_assert(data == sextract32(data, 0, SIMD_DATA_BITS) || + data == extract32(data, 0, SIMD_DATA_BITS)); oprsz = (oprsz / 8) - 1; maxsz = (maxsz / 8) - 1; From patchwork Mon Nov 18 19:35:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 844112 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp802909wrx; Mon, 18 Nov 2024 11:38:00 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUyMAwHxmvzqXR+nOhmSxn8pHLTs8Y3zbqQ8UNQsvRXB6IWymo6La2RUpXeMUq94AcncVOzsw==@linaro.org X-Google-Smtp-Source: AGHT+IHcU53q3Fe8KMYtaqHZxUMH9WIWjMSKvsZW0yCdhT24Pkm1lES8wyLFTQClPrRz8uwDSo6o X-Received: by 2002:a05:620a:2410:b0:7b1:547d:9ba8 with SMTP id af79cd13be357-7b3622e7975mr2231424085a.21.1731958680688; Mon, 18 Nov 2024 11:38:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731958680; cv=none; d=google.com; s=arc-20240605; b=a5i8K+I5xV5KTZ4pRrXKYv96WW9FBUZiZrzrvPZlFDGN4w6CowN5RHLNokeakskQI9 apLuUGWl+7hijlxW5AAbYf+HeLDjeuVVaJX6WryeY6RbSy2T1AQ4pz8Z3lfSB+gF/gj0 TjG9SJIUkh+lFPvjtfya5P/Z4GRLnpnlm47uW7aFThyvFL6bxQD+1GFpomk6wf20nrk9 9oiRUSihsB0ShqGc/ImdFQUcI4mjytPdXtaQLJ2qPompjCwp08drHTpuwn5aP59kkF7p EQW21FrfY0y9RHQM6IUA7lH3HAb7c6e5kpAAf2heNEsU0Zr+KgDkdtrQztrk6RpI6HGO NF8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=0k1fv1CCRxYpdRoxLTdajprJZKj15SpWvDdhqsnw6/o=; fh=bJM08QyuQI9qNgdwAnWtM8YuXTWExZXcb9tnmXCkn/A=; b=INYac52NEMX+xk/1y+5bT47lM/W7N5JRPqEacB8yS/aCU4qYxMK8TBH6GdOxvERDKt XObGoGbBQT4xRfU5CgaLOrB/oUTjAX/FkNMlWfbOlvO5kWpKz2xYO6MUMxjc8GWa5RWQ oNxyPYOjvGd1DNpVzbwvBBRbSx1Mq6JV+gBV992ybKYRW6sRrxcNlpmaCte5znBvLfNA spN5KLqtJOLRuj2uWxYZ2SEIWqYRcYfT7ZR+U+sS3cUTA0FWgE/Cs510Tp7N4dTBxuzL DWyUM9cnUxUHOQiV2klUES8PfHYx6u0kbbyosY5dNIS0t/JJX8aNf7PZ6BzNQFDsGSEi XkoQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7b37a84afabsi39378085a.177.2024.11.18.11.38.00 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 11:38:00 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD7XQ-0006fi-7L; Mon, 18 Nov 2024 14:35:56 -0500 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 1tD7XM-0006fA-3v; Mon, 18 Nov 2024 14:35:53 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tD7XC-0002i3-KE; Mon, 18 Nov 2024 14:35:44 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id BF0D4A54E6; Mon, 18 Nov 2024 22:35:17 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 3EBC91735A3; Mon, 18 Nov 2024 22:35:21 +0300 (MSK) Received: (nullmailer pid 2312695 invoked by uid 1000); Mon, 18 Nov 2024 19:35:20 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Pierrick Bouvier , Richard Henderson , Michael Tokarev Subject: [Stable-8.2.8 57/61] target/i386: fix hang when using slow path for ptw_setl Date: Mon, 18 Nov 2024 22:35:12 +0300 Message-Id: <20241118193520.2312620-9-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Pierrick Bouvier When instrumenting memory accesses for plugin, we force memory accesses to use the slow path for mmu [1]. This create a situation where we end up calling ptw_setl_slow. This was fixed recently in [2] but the issue still could appear out of plugins use case. Since this function gets called during a cpu_exec, start_exclusive then hangs. This exclusive section was introduced initially for security reasons [3]. I suspect this code path was never triggered, because ptw_setl_slow would always be called transitively from cpu_exec, resulting in a hang. [1] https://gitlab.com/qemu-project/qemu/-/commit/6d03226b42247b68ab2f0b3663e0f624335a4055 [2] https://gitlab.com/qemu-project/qemu/-/commit/115ade42d50144c15b74368d32dc734ea277d853 [2] https://gitlab.com/qemu-project/qemu/-/commit/9a96406787afcc9960fbe8791892c78311d6971f in 8.2.x series [3] https://gitlab.com/qemu-project/qemu/-/issues/279 Fixes: https://gitlab.com/qemu-project/qemu/-/issues/2566 Signed-off-by: Pierrick Bouvier Reviewed-by: Richard Henderson Message-ID: <20241025175857.2554252-2-pierrick.bouvier@linaro.org> Signed-off-by: Richard Henderson (cherry picked from commit 7ba055b49b74c4d2f4a338c5198485bdff373fb1) Signed-off-by: Michael Tokarev (Mjt: mention [2] in 8.2.x series) diff --git a/target/i386/tcg/sysemu/excp_helper.c b/target/i386/tcg/sysemu/excp_helper.c index bdf7b0df42..44b1b2ded6 100644 --- a/target/i386/tcg/sysemu/excp_helper.c +++ b/target/i386/tcg/sysemu/excp_helper.c @@ -106,6 +106,10 @@ static bool ptw_setl_slow(const PTETranslate *in, uint32_t old, uint32_t new) { uint32_t cmp; + CPUState *cpu = env_cpu(in->env); + /* We are in cpu_exec, and start_exclusive can't be called directly.*/ + g_assert(cpu->running); + cpu_exec_end(cpu); /* Does x86 really perform a rmw cycle on mmio for ptw? */ start_exclusive(); cmp = cpu_ldl_mmuidx_ra(in->env, in->gaddr, in->ptw_idx, 0); @@ -113,6 +117,7 @@ static bool ptw_setl_slow(const PTETranslate *in, uint32_t old, uint32_t new) cpu_stl_mmuidx_ra(in->env, in->gaddr, new, in->ptw_idx, 0); } end_exclusive(); + cpu_exec_start(cpu); return cmp == old; } From patchwork Mon Nov 18 19:35:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 844111 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp802620wrx; Mon, 18 Nov 2024 11:37:12 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVUj7Ku9ueqmu2dxcfai2mbNRzQWMxGO1nMDAjwBQnfS9EmCnJmpSUqZQH3S8Wa9/7QlNm19w==@linaro.org X-Google-Smtp-Source: AGHT+IE4H4ZtJOce6Eoozf5Gs7WM2X3pxYv2lIUOaWtnAj9u/dcuNljXNbUMI3kkGf79xum8/IY/ X-Received: by 2002:a05:6214:428d:b0:6d3:c3ee:10c4 with SMTP id 6a1803df08f44-6d3fb821febmr193375436d6.33.1731958632063; Mon, 18 Nov 2024 11:37:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1731958632; cv=none; d=google.com; s=arc-20240605; b=LaS9ccFtXP8mn1J24ksiKknF3SdzYmWiBkI8RgBk+jt4lgSNlWhLr+fL3AGrH5KdJb vF06LEId2EqKGyK1BweWaiw2/bUGUGSbJqSEbx2C8xfSrIQv0UuMEgINItMJ6EeQHWUx eP8foDNlZ39rA+Fmqa0HFzqfvijFw5TYUccyreFFM8azvcp55UXZl/O6OmLAybQXjd7n IIdRf13SwWkCMNZgsO4ufcJYPQFc4NTlQJgjTDpsDBOp5eOpLRuDZaa3wvRJGO09fbWw TVWbze0lluUo7RbUiSWX8xZiGS6g9zhT/Sigxkux5l6s0rY8epWoWOzRE8odETo2IBfl IdCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=n6/1D3Di6uHqhMO/KT+uMHhIFcckqzSUy6ISVzBnJus=; fh=E2WqPFE+FyovtIgeriVrkDknUlAAi4gj+HL6eUZjBtc=; b=MDRA+sBF4qUXG6sbgbIwgfil8m6IOV5EHUApocRJkhv7N7madRifgSK6q72d9E2k/C Ny7lPkdr3kudu8kRATNOjIrYZXF222NWvrEoR+EXayN/VCyJA8RPdvxKGEmqJwyAO0Ii tBnYhz1FVOuWuT4/g+oLhQziitA7z2p4UWpXjbxdKRe1Wpzt3xe7sCWhrnqidkgcEC+r GGRI/BG9c6o5W3tNlE0JjUQHbO55Mipi6nX0cG1gYejZmBr2mv/IAMZsjLG5gUzMx1sw cCmTx8PL5G9T5iIB0AKmBHFObm2CHbxTJUukaEW5wLnx92yH0//ks7shEX78ZMlhwISO UCLQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6d40db981cdsi76350416d6.119.2024.11.18.11.37.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Nov 2024 11:37:12 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tD7XX-0006hW-Tl; Mon, 18 Nov 2024 14:36:04 -0500 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 1tD7XM-0006f9-3a; Mon, 18 Nov 2024 14:35:53 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tD7XD-0002iB-30; Mon, 18 Nov 2024 14:35:44 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id CCB1EA54E7; Mon, 18 Nov 2024 22:35:17 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 4C6F41735A4; Mon, 18 Nov 2024 22:35:21 +0300 (MSK) Received: (nullmailer pid 2312698 invoked by uid 1000); Mon, 18 Nov 2024 19:35:20 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= , Michael Tokarev Subject: [Stable-8.2.8 58/61] contrib/plugins: add compat for g_memdup2 Date: Mon, 18 Nov 2024 22:35:13 +0300 Message-Id: <20241118193520.2312620-10-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.5 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Alex Bennée We were premature if bumping this because some of our builds are still on older glibs. Just copy the compat handler for now and we can remove it later. Fixes: ee293103b0 (plugins: update lockstep to use g_memdup2) Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2161 Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-Id: <20240729144414.830369-14-alex.bennee@linaro.org> (cherry picked from commit 44e794896759236885f6d30d1f6b9b8b76355d52) Signed-off-by: Michael Tokarev Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2681 in 8.2.x diff --git a/contrib/plugins/lockstep.c b/contrib/plugins/lockstep.c index 237543b43a..0c6f060183 100644 --- a/contrib/plugins/lockstep.c +++ b/contrib/plugins/lockstep.c @@ -100,6 +100,31 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) plugin_cleanup(id); } +/* + * g_memdup has been deprecated in Glib since 2.68 and + * will complain about it if you try to use it. However until + * glib_req_ver for QEMU is bumped we make a copy of the glib-compat + * handler. + */ +static inline gpointer g_memdup2_qemu(gconstpointer mem, gsize byte_size) +{ +#if GLIB_CHECK_VERSION(2, 68, 0) + return g_memdup2(mem, byte_size); +#else + gpointer new_mem; + + if (mem && byte_size != 0) { + new_mem = g_malloc(byte_size); + memcpy(new_mem, mem, byte_size); + } else { + new_mem = NULL; + } + + return new_mem; +#endif +} +#define g_memdup2(m, s) g_memdup2_qemu(m, s) + static void report_divergance(ExecState *us, ExecState *them) { DivergeState divrec = { log, 0 };