From patchwork Tue Jan 23 10:24:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 765190 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1528713wrx; Tue, 23 Jan 2024 02:25:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEX8KrWlYNeTafqgl03TsprkiQiaWCFqeGZxNYGONXXHQUfsA3GkbP4Se8/0CyARj2GCV9m X-Received: by 2002:a81:6c05:0:b0:5ff:a8da:5a5a with SMTP id h5-20020a816c05000000b005ffa8da5a5amr4312196ywc.5.1706005535534; Tue, 23 Jan 2024 02:25:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706005535; cv=none; d=google.com; s=arc-20160816; b=AmDluX4Qz/MNJnf6u9BmzZGy580VbvaE5kXWHSawLa9UZEphvBqBoc4I0DFVqthA/B kINr88cCLgIX1hJEPmnUdYSFid2qpP0I9oFTzD9XIet1iDJgfzHFvFeVzUJnVa93nkl1 Y296XjiRlqd8MnzynweBprYst39Gp0aCSw4sft2D+6oWleckQ14n0OcQ3kIVcdDBtMx9 9aIAi0TtSm3YhRMcmvp7x35NGbPg+tY5Jt4/4/GJPxMIsRPCeekazrSqw3bDcWb37stI OT/VZYm4I7vGG/9bkx/31+q9kFiXdlX7dNvBf2lfexYDRWdyunlNgC9Xxq068D7Z5vmk Nk2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:dkim-signature; bh=8KxhZwbZAcm1asBjHob1LgeGTJkXdHPPGTQpwmtvThw=; fh=Po6svqgyYqJzxZwR3KQKdPHXCr391FTx5wiDQXhlWnU=; b=h210hqusTijZ3Sa+RmcJVhyFg5FCHNevLfDnrUeUTWQZbTtaVD3N18tYVId04f58Gi j57bJH1ZD5I3soZHZyAVKd0/6IhhpYSZ/Jq27YMpHY4tJgxbEYyoU36xkCdbTuOJW2Jw SE3sEeJMLygYEoLYfDuawepLw9Y1F34Ih5eVMrG/N8F4g6/D3UfjX7+qgkdqdpYjWZmk 1g5jm0dvOiG1hcLn+VxRux0DQhcB8XZh3Ny+Dbkl1jmxdSLS9nd7yEu579mFyIQ4Fhgz GVhQAS0NnAfBgvPZIO51EXPxCjLyBiNLlF17z+AjgqL8cLG0efoALON8urqk0b9h0GZM 3GnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VDKntUHD; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n1-20020ae9c301000000b007817072c0fesi7415311qkg.493.2024.01.23.02.25.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2024 02:25:35 -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; dkim=pass header.i=@linaro.org header.s=google header.b=VDKntUHD; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSDxC-0000N9-A3; Tue, 23 Jan 2024 05:24:26 -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 1rSDxA-0000MX-3M for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:24 -0500 Received: from mail-pf1-x435.google.com ([2607:f8b0:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSDx8-0004cA-BV for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:23 -0500 Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-6dd7c5437b0so274851b3a.3 for ; Tue, 23 Jan 2024 02:24:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706005460; x=1706610260; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8KxhZwbZAcm1asBjHob1LgeGTJkXdHPPGTQpwmtvThw=; b=VDKntUHDe81VJEdB00Nl1mv1yloJGfFuvqU1j00MIgIaeXvAlZ04mK6jNUdjaDBEj4 l+8d9p/0h6tJLdTYoNacGce4qwcFvTU7aiIAtSrQeKZF1gOZG3ZIc9mK7DloxXDocQVL /uOhBU62I2cqb8SP4LHV7K/Nw48A0INZ+kig1T6GoroYKkDCUn52pm724RcHdPFRaR34 gtROoXWviTfpasy7fYgo2wqAHrMS9v0fqy9F1qKlLGgGrwBg0gtiVViIkiH17a4VP88r CfTYj1lnIdrk5C94eALwLTQzSgDfT51Zre1oG4wSbvasU8UPX4FHTtxMO2f/5PnjOxUN RcPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706005460; x=1706610260; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8KxhZwbZAcm1asBjHob1LgeGTJkXdHPPGTQpwmtvThw=; b=VZb6iJnnnIakva1VS5ipfWvtT12wr74BRANZB4wX18Pz2Dy5g4qOJbzIn0RPm+XD9Y EeW8BlrXuIwgvAeuus8VbkDRuDtxHW01Q1r8ZQZeDcFcUZ/xoBTY7hlu6wkf5Tmjtj+I iFC4kfZoaaQhYW3YM1hc0FEPyksLXIOAwrrZtxuAkVM23CWeG/xykNA/mRpGXANfYGGr adIg8MZgJxVGwEHa7ljBD88R/aBgngIEg7HKckTQ9vhsp+jbVBl0PkBScj3ny+PVduIf hpgD7m8+CKNCFF1M7tHwXMB6P2SK/H5HODB9OphB0eNTdSMDn8HU15fjYBBTv5b8st01 a+pA== X-Gm-Message-State: AOJu0YxraZFqkFicAqtJt+n/WMT+tuqqnrSCzASCvVIZhimvH5/ubyig odQkcC6HrLPtNQDga6zV592yH+d88TBep+WA36lQBP+O/9zkavc/lNdPwLbAiqaww8wUxsfrh39 Fo/k= X-Received: by 2002:a05:6a20:da83:b0:19a:29a4:4994 with SMTP id iy3-20020a056a20da8300b0019a29a44994mr6959060pzb.84.1706005460639; Tue, 23 Jan 2024 02:24:20 -0800 (PST) Received: from stoup.lan (2001-44b8-2176-c800-b8a0-0408-58be-7d2e.static.ipv6.internode.on.net. [2001:44b8:2176:c800:b8a0:408:58be:7d2e]) by smtp.gmail.com with ESMTPSA id d8-20020a62f808000000b006d9ce7d3258sm11072408pfh.204.2024.01.23.02.24.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 02:24:20 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Samuel Tardieu , Peter Maydell Subject: [PULL v2 1/8] tcg: Remove unreachable code Date: Tue, 23 Jan 2024 20:24:05 +1000 Message-Id: <20240123102412.4569-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123102412.4569-1-richard.henderson@linaro.org> References: <20240123102412.4569-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x435.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Samuel Tardieu The `fail_rx`/`fail` block is only entered while `buf_rx` is equal to its initial value `MAP_FAILED`. The `munmap(buf_rx, size);` was never executed. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2030 Signed-off-by: Samuel Tardieu Reviewed-by: Peter Maydell Message-Id: <20231219182212.455952-2-sam@rfc1149.net> Signed-off-by: Richard Henderson --- tcg/region.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tcg/region.c b/tcg/region.c index 86692455c0..467e51cf6f 100644 --- a/tcg/region.c +++ b/tcg/region.c @@ -597,9 +597,7 @@ static int alloc_code_gen_buffer_splitwx_memfd(size_t size, Error **errp) fail_rx: error_setg_errno(errp, errno, "failed to map shared memory for execute"); fail: - if (buf_rx != MAP_FAILED) { - munmap(buf_rx, size); - } + /* buf_rx is always equal to MAP_FAILED here and does not require cleanup */ if (buf_rw) { munmap(buf_rw, size); } From patchwork Tue Jan 23 10:24:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 765189 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1528705wrx; Tue, 23 Jan 2024 02:25:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IFr1KStk4gLpEsIxjMNhnpcTO5b67+nV463wAlM8X4JN5pwaLn8l7UgK/4ksEbdauLp+r6r X-Received: by 2002:ac8:5b8c:0:b0:42a:1eef:a8c2 with SMTP id a12-20020ac85b8c000000b0042a1eefa8c2mr628559qta.65.1706005534024; Tue, 23 Jan 2024 02:25:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706005534; cv=none; d=google.com; s=arc-20160816; b=fKPgyP7Vk1PBUkIiE67dm/VLkamK/B7PCrO50WDTbXIvq2HWF3c1XKdZPC7pa7Znla OIcjDPrLyvbTpj6vtfOkM/PTHBFC7EIk/xHkF6xSteDVwIp7AQmT6097q+256HzLkqIO /0vWbfpql5zaUvoFTtnb7DlR4d2ME5HRhqN3tS0GgmyXCgWUBy3skuftr1Vo+7Sa/wWo o1ieKfhZIKpc1rb5VQiBuAxxVgAENzqAm27cLSHq5sGzp3hFjy6Uvc/2XKFqGgZwAJj2 4R2n4vgnLfKSzk46t/u2ek6sZQWsjuheZPwNeP7NV3z+YX9NgpIly9K/HvLjNuSkxzf9 SykQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:dkim-signature; bh=0EKsORzhcd/voY/5GCXD+0ZH5a0YI/B7BiYyHrdge+w=; fh=Po6svqgyYqJzxZwR3KQKdPHXCr391FTx5wiDQXhlWnU=; b=GtwIqfVdfGIgPDv/JXGEmLg0bxr97oK91DvkT08S60hDMnmybT2+lR0HEtpw4i/MzF 0U77Idz7OygtYYoJEJRYRVnkXIyXCwzurhUjAS+mfnWtkhaVYCSJT9OQs6vK/Go15wRg XwadX9fZZU1hM000vcSDGC8aLTiKQsNIMkyqI4DEyBm/Cj8C5/2yrNaR2C6EWx5gCUCx sZ0L0fnNwxh2la0BbEIRT161jrwztLxdGXFBK3oUdl+vaESd1h0Pn1qalUJI7q6JBF7Z A7L9YsOWfiF2Gbua2z8ofOPFMnrOAmX2ZSDmqO0CvkFvfvvIq8lcpZzo8zZW/41srkXV gRcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yxQu3ZyM; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v5-20020ac85785000000b0042a0331e7dcsi7652045qta.634.2024.01.23.02.25.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2024 02:25:34 -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; dkim=pass header.i=@linaro.org header.s=google header.b=yxQu3ZyM; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSDxC-0000NH-Ro; Tue, 23 Jan 2024 05:24:26 -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 1rSDxC-0000N7-4m for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:26 -0500 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSDxA-0004cc-KL for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:25 -0500 Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-6db0fdd2b8fso1963398b3a.2 for ; Tue, 23 Jan 2024 02:24:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706005463; x=1706610263; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0EKsORzhcd/voY/5GCXD+0ZH5a0YI/B7BiYyHrdge+w=; b=yxQu3ZyMZCaD2wAE7x4g9Egl2XymqzQr4qaoPXv/KHXEsja4m1QApaZ7pTEcdOFUPV wYl2naZkkOsgMB2nYiEJsNYr2OCZYGU4k7VqPeU00Y/RbTfwSns6R8ADYqA7w2BbsAXa Y/jYOnF30P0+R+I1Uk5x2G2Nr1KsaS600DJPgXLVLkURViBPZ4T+bTsVRpDWDsAHmoWF tPXPjjVCJ4dWXn1x3RcAVjq3burNX9NR6yGgvbxpC0kGRE4JmKrJCQAjmOoKtalboj3T hPDvWEjWbFAPRseX43KlL5ENeM/dyaVkTQgDM2K1nZhTnrxfCsZKAw4jPJlimsIlWjuy l1Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706005463; x=1706610263; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0EKsORzhcd/voY/5GCXD+0ZH5a0YI/B7BiYyHrdge+w=; b=f3kNjJLRv0SCHR5PZvfT9cK6x3MRHMNWf20ZCBOGYpganuzRN5nPC6JemI0HPYyPHO RJuLQam/ZkiA69JyBGS8gCRQIGuaY7hSKRTGyceNAWB6BB2akVKEaiyMYHY25G32+Tgb va9PA63UEMlA/FPWQ8B7qz/XlXhM6xtRK09PWY73Sy6/HzMdMYK/uggg/XrP9enTjnml v3KBkFlNIzwBpejwE9iALhhjoP9r4FPDTE+ms7ckooOb0OJJg921StnuC/eg1+0mprTv ALgqfS4LI9P7PGaE9IDVgKbFIM4+/PhbZyMB+/c+UzLlQyWvonzKvtXuM1D8gvpzBo+o wN2A== X-Gm-Message-State: AOJu0Yz28xISiPtgIfuyNrVagV19oNI2wjI+amUE9qcvzxG/I0ZU15FV x6L3Mo11QW9vo4Sc4qL43FTOxWFDUHRAG/eXFPaErfpw7KXbOEBVHMZZ0h3+9u59nt7VtOiOEVf 7N6k= X-Received: by 2002:a05:6a00:9281:b0:6dd:7ae5:9dd9 with SMTP id jw1-20020a056a00928100b006dd7ae59dd9mr487508pfb.3.1706005463234; Tue, 23 Jan 2024 02:24:23 -0800 (PST) Received: from stoup.lan (2001-44b8-2176-c800-b8a0-0408-58be-7d2e.static.ipv6.internode.on.net. [2001:44b8:2176:c800:b8a0:408:58be:7d2e]) by smtp.gmail.com with ESMTPSA id d8-20020a62f808000000b006d9ce7d3258sm11072408pfh.204.2024.01.23.02.24.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 02:24:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Samuel Tardieu , Peter Maydell Subject: [PULL v2 2/8] tcg: Make the cleanup-on-error path unique Date: Tue, 23 Jan 2024 20:24:06 +1000 Message-Id: <20240123102412.4569-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123102412.4569-1-richard.henderson@linaro.org> References: <20240123102412.4569-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Samuel Tardieu By calling `error_setg_errno()` before jumping to the cleanup-on-error path at the `fail` label, the cleanup path is clearer. Signed-off-by: Samuel Tardieu Reviewed-by: Peter Maydell Message-Id: <20231219182212.455952-3-sam@rfc1149.net> Signed-off-by: Richard Henderson --- tcg/region.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tcg/region.c b/tcg/region.c index 467e51cf6f..478ec051c4 100644 --- a/tcg/region.c +++ b/tcg/region.c @@ -584,7 +584,9 @@ static int alloc_code_gen_buffer_splitwx_memfd(size_t size, Error **errp) buf_rx = mmap(NULL, size, host_prot_read_exec(), MAP_SHARED, fd, 0); if (buf_rx == MAP_FAILED) { - goto fail_rx; + error_setg_errno(errp, errno, + "failed to map shared memory for execute"); + goto fail; } close(fd); @@ -594,8 +596,6 @@ static int alloc_code_gen_buffer_splitwx_memfd(size_t size, Error **errp) return PROT_READ | PROT_WRITE; - fail_rx: - error_setg_errno(errp, errno, "failed to map shared memory for execute"); fail: /* buf_rx is always equal to MAP_FAILED here and does not require cleanup */ if (buf_rw) { From patchwork Tue Jan 23 10:24:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 765188 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1528565wrx; Tue, 23 Jan 2024 02:24:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IEDesFR8/C1vSXeVrJgS4pqBvaVgmSPvIxVg7hrq6TEPY46l4CBg/U3Fku9JsgVDXqC0Qq+ X-Received: by 2002:a81:6c8a:0:b0:5ff:cb49:5f47 with SMTP id h132-20020a816c8a000000b005ffcb495f47mr3601016ywc.28.1706005497500; Tue, 23 Jan 2024 02:24:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706005497; cv=none; d=google.com; s=arc-20160816; b=oAMXdMPjs0hKt7bL/le5laqHpnUP/kn1HiwhIgFVajntTurp2QQ7hyidgId03MmpTw BRrK3jlz0fM+SDsG5OTNH8uU8Rp5gwdbOZxy8Uk6XMWiIl3MCm7RENkiITTlWfdCSRrG xMuoc27Vw9SyPwWl27yhokehf/H++m21U9BLbFAVT2wmE4uPNk93QBLF0SYi+Umb8JH9 XsIXIyHUO1656PfvOsKWVZoxm71iG5FIhbUvgw5W4pVlaSR12ZsCf91sm4sWmhMr3KDw YaDcmZYiAMliPv1WfdHywsPVu+AYpSAcpnZ3UQ9yoXTRjs5hvsvOTmYrY+ejL6nMRW2Y 5Pyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:dkim-signature; bh=CJwQ5ZzhzO00+g0UGwDiX0qf7mCAm8ExrbTS/sZFCpk=; fh=hnz9pG8FMO+tm2obdPt4dhu6yqTXgplMe/ouKJtcwQs=; b=X5uaIzGiUEs0JmTj361ndVBcdyyI9zLLOZAeFw5V8JCCnWAm9d1D2nUTPu4iJCcfgM yk3V1jT7RQN2PFGN8zz5fcnNXHgIv8CKtbo7sspsueJwkrF8cWr7K5IjGtBs8Rj/Kom/ 06X1PdMQK2w88uU0ge9INRzVmYJ6Z86oCgsWBZaBKtfZzrd4mg0OwopcgfVKr/QDRrOu egw3WhYLbxZyv+JjZfNcprhMLkfehQh5ePZKPQPHLXL2/Mh9Z3Rjuah7P+NaRRyFlNPl XFpp5l/5kQBcoyTvDiNoggrDClTz5Gx73w59ZJgZfKmnHP8JNslBIWmtRZBPivxrt45d iCjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wiw55JUk; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y15-20020a05622a004f00b0042a30cac628si7116965qtw.380.2024.01.23.02.24.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2024 02:24:57 -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; dkim=pass header.i=@linaro.org header.s=google header.b=wiw55JUk; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSDxH-0000OO-JH; Tue, 23 Jan 2024 05:24:31 -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 1rSDxF-0000Ni-Jn for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:29 -0500 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSDxD-0004ct-GP for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:29 -0500 Received: by mail-ot1-x331.google.com with SMTP id 46e09a7af769-6ddf1e88e51so3178686a34.0 for ; Tue, 23 Jan 2024 02:24:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706005466; x=1706610266; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CJwQ5ZzhzO00+g0UGwDiX0qf7mCAm8ExrbTS/sZFCpk=; b=wiw55JUkKxb5xsomSITLXgCKPi9KYKb6IFzsuwR0Tql8TdZSBa1BZxvpKdlcu1/2i/ RdTNxlnPh0WrSlm9Ma0czuaKYneKt8fBPgXY8VGSzSjJ48tEEQamGXs76n3SfrVMa8k5 LvhYRgQ+uITp0leEThapAYfLFBpfUoIPL+EAk4Az9Q3qFGLtiIeZ3Y0WbtsXCmNrngdv KGbcFv42/kRFKIVNQm92VdX60Lif522oVxoesYPH2fk8tuXs1JkGZYf1UYHCEqteAbBk sZzSttbqq5Eiiay11pQYnDWtrSlRPRZdkFYEvlV1Qu/ijZ2urwqUG3vgta//Hu3X4piJ VU1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706005466; x=1706610266; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CJwQ5ZzhzO00+g0UGwDiX0qf7mCAm8ExrbTS/sZFCpk=; b=ie2bAp2b233rw++bMA98DNTtHsu4+2iNyi1s85OpIuUN/u8JUx2YQNiV4Yy+QbFxnd nL56BmRdO1xntfHUyVrkJj/nKNAa4Ial4JIA+cLiS5mhZF+4Pck+M1i2g3yTzKxR3MUd DrmpoaUZ3HzaR8c5F3JzgIbdB9d56QmuBv0QG2Bjq6Btxds3NBo8iIMMjh8ZP2astRz7 Du2eIqbcUdQGr/hKcsj/StNwGh61dOVLsrwOH7Ex5RBwyWexYHPXQ7dtwkcl9LRIaAmO XukNhyYbve/uIJoa7PtNPA7+zIATENMqI0yyjWBDpObuto9SBM9zEGGJjjEJJzB9nefB zQ0g== X-Gm-Message-State: AOJu0Yyj+OkhLaGAQlDdXNKT90iz7A66Vhgls8ZPVBfsJMxWvBSTzJgo x3PUXo6Ybi37Jz4bdcqTKN6zzH+JjHwVqeUxvMPlDmER7UKFz9YI3z2uGEHeZVIBbI41BU0Cbia Pogo= X-Received: by 2002:a05:6359:6241:b0:175:c293:68d0 with SMTP id sd1-20020a056359624100b00175c29368d0mr2665045rwb.60.1706005466146; Tue, 23 Jan 2024 02:24:26 -0800 (PST) Received: from stoup.lan (2001-44b8-2176-c800-b8a0-0408-58be-7d2e.static.ipv6.internode.on.net. [2001:44b8:2176:c800:b8a0:408:58be:7d2e]) by smtp.gmail.com with ESMTPSA id d8-20020a62f808000000b006d9ce7d3258sm11072408pfh.204.2024.01.23.02.24.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 02:24:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Robbin Ehn , Palmer Dabbelt Subject: [PULL v2 3/8] linux-user: Fixed cpu restore with pc 0 on SIGBUS Date: Tue, 23 Jan 2024 20:24:07 +1000 Message-Id: <20240123102412.4569-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123102412.4569-1-richard.henderson@linaro.org> References: <20240123102412.4569-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x331.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Robbin Ehn Commit f4e1168198 (linux-user: Split out host_sig{segv,bus}_handler) introduced a bug, when returning from host_sigbus_handler the PC is never set. Thus cpu_loop_exit_restore is called with a zero PC and we immediate get a SIGSEGV. Signed-off-by: Robbin Ehn Fixes: f4e1168198 ("linux-user: Split out host_sig{segv,bus}_handler") Reviewed-by: Palmer Dabbelt Message-Id: <33f27425878fb529b9e39ef22c303f6e0d90525f.camel@rivosinc.com> Signed-off-by: Richard Henderson --- linux-user/signal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index b35d1e512f..c9527adfa3 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -925,7 +925,7 @@ static void host_sigsegv_handler(CPUState *cpu, siginfo_t *info, cpu_loop_exit_sigsegv(cpu, guest_addr, access_type, maperr, pc); } -static void host_sigbus_handler(CPUState *cpu, siginfo_t *info, +static uintptr_t host_sigbus_handler(CPUState *cpu, siginfo_t *info, host_sigcontext *uc) { uintptr_t pc = host_signal_pc(uc); @@ -947,6 +947,7 @@ static void host_sigbus_handler(CPUState *cpu, siginfo_t *info, sigprocmask(SIG_SETMASK, host_signal_mask(uc), NULL); cpu_loop_exit_sigbus(cpu, guest_addr, access_type, pc); } + return pc; } static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) @@ -974,7 +975,7 @@ static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) host_sigsegv_handler(cpu, info, uc); return; case SIGBUS: - host_sigbus_handler(cpu, info, uc); + pc = host_sigbus_handler(cpu, info, uc); sync_sig = true; break; case SIGILL: From patchwork Tue Jan 23 10:24:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 765194 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1528769wrx; Tue, 23 Jan 2024 02:25:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IGc0FUAM/eZ0kAF3xSXT5K/KrwfaF0YB+6VdSU8P1VXwmDaMTdYYzaZH5vtMcsEJmEXbRIl X-Received: by 2002:ad4:5f4a:0:b0:680:fee5:9b47 with SMTP id p10-20020ad45f4a000000b00680fee59b47mr580440qvg.76.1706005550265; Tue, 23 Jan 2024 02:25:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706005550; cv=none; d=google.com; s=arc-20160816; b=KFapwxxfodihuXseCtzyf/KIzb/xbGBVb6fjSWeMGLuIv6syzhS5uiSTMYmKGjHzYr /Zh997fvzR7XLLfsDQChr+1SS44Drimr8SSgQiLE3WcpMW5HBZvtqTaD3RnF2oZB6hmv 8O5vut/Op+1oV4kJXM63PJH0gE6oxiKMlaHhObXp/dNYXhUABAvpY+rjGNGr3sCT81fN G26AAsZ0LSjL7992uQcN9hg/cc/MBMbGySC5P5a8AAelTHK8L2G7Zz4RpkYD0eBGYRUP 0XMkXlT68jbUC8YvqnPSlSVhxwmb1ydFnyqB3NVQJImd+IqonISbjeHk+2V2y0dokE5k AE3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:dkim-signature; bh=lU9aH7ZY0n7uAdgAxQsFLjxICAM1xx6kGJSgqsKuTsU=; fh=HbLj/5yooXb+Hoe1WPA3vZVKPDdpNdYNbhwpVZI8wJI=; b=Z/ViThJ2saA1Dv/kfgzeKfKkbCBnYNHJPIGTzgBaYfIwuNwZIlVioCmmMtW6oc0roE jU4h6y9jURtn8rARxVYNg6F0miOi199dcfb7GmOngsaHgQye3zCZ8wxCclMdCuZa+NPz 64jWvEwfZntZLwyFnjKAHnQoMRxLrmGb22SPH5QG2XtLgSflTqwHmFbRU//oQXffFZid PZnQAgNxgdIuH5PY65RVrjh1mnmBqvCcV+1BUaXtSbagm29K9J8v2KqWckCrPjbQCsMq qUYaw6FodWzJcSPC+EaOAFhez9f10qjB88ya6mm/xpXuBBYWsRX9Ta0cJIFInn4ulhAc w+3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ClHIIabe; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k15-20020a0cf28f000000b0067f662df032si7710682qvl.271.2024.01.23.02.25.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2024 02:25:50 -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; dkim=pass header.i=@linaro.org header.s=google header.b=ClHIIabe; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSDxJ-0000Os-Il; Tue, 23 Jan 2024 05:24:33 -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 1rSDxI-0000OW-GA for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:32 -0500 Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSDxG-0004dE-S8 for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:32 -0500 Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3bd9030d68fso2540432b6e.3 for ; Tue, 23 Jan 2024 02:24:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706005469; x=1706610269; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lU9aH7ZY0n7uAdgAxQsFLjxICAM1xx6kGJSgqsKuTsU=; b=ClHIIabe9jdBX5l1dancxndVv4tsnIyEYyZYA3k1CGaAIgAW2qn9MogGwmF0fKFXql xVcYPJkG4KdKKexqBRla63+E596FH9yDN0tc64ZBql0YDTbbUk5mTAcoPfwVryk8yWxa xVPfU7at+7+Va2gniicAaALyvKYMp97UORiCaNA+Zt8HKXhNDvoKrI2d4zovDrcs13tZ ticVaZp8e4BacTBqHqGgaOyDXOpBvPO2zrRR7sY2FvGnIT4fgq5OWTqlXDa2s15jNYAv tLiwVY97CioNCZqoxS5tdjeNDI37xi0wBclA5NHBVa8l8oecsMod1Xxb9Fjm/pCxL8sE 46BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706005469; x=1706610269; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lU9aH7ZY0n7uAdgAxQsFLjxICAM1xx6kGJSgqsKuTsU=; b=Yt9re4UhD1vwpSNhbdHYwDxeJft5o/0SYFviJhbrLiTsQroqQa03EpEd2IOF0BEjPE 2EaXwKL6CA5DPBvEQVuG59JCkCpyzH6i52wWhXljmbsrkb0x765T24OocRdvWOi4ETiR 836XxBBy6/H2YMs8JyNqheu/1dh3zQ8QvG1FXt6HKpNaUPohys+6Cnx5Ehh4iE6Buedj HJerSMdnCHz9CugjCbKAURt2HWTN2lY6W2rW/qdGxy00UmJQusELMxBixomMIczYl1jb sGdEkJHVeItHN8/vhfRDSifEwMR1EafCJK+1Crf3+Tv53ctzjs/GxZpE6UxnSv1PHti4 RmhA== X-Gm-Message-State: AOJu0YyDH8abRGImdI6x67hAuv+lFTsEL1ZkiV4I48BYMm7nFCT9U/Jx M0G43EWSVtCgeKxEvZxta0OTGpUazyIhVmgKXWvJEgRI88/jyiYWLk/wQMgSXCwUAqQiPkhqvhk v8Uo= X-Received: by 2002:a05:6808:1b26:b0:3bd:c997:4c55 with SMTP id bx38-20020a0568081b2600b003bdc9974c55mr198701oib.11.1706005469621; Tue, 23 Jan 2024 02:24:29 -0800 (PST) Received: from stoup.lan (2001-44b8-2176-c800-b8a0-0408-58be-7d2e.static.ipv6.internode.on.net. [2001:44b8:2176:c800:b8a0:408:58be:7d2e]) by smtp.gmail.com with ESMTPSA id d8-20020a62f808000000b006d9ce7d3258sm11072408pfh.204.2024.01.23.02.24.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 02:24:29 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Michael Tokarev , Thomas Huth Subject: [PULL v2 4/8] tcg/s390x: Fix encoding of VRIc, VRSa, VRSc insns Date: Tue, 23 Jan 2024 20:24:08 +1000 Message-Id: <20240123102412.4569-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123102412.4569-1-richard.henderson@linaro.org> References: <20240123102412.4569-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::230; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x230.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org While the format names the second vector register 'v3', it is still in the second position (bits 12-15) and the argument to RXB must match. Example error: - e7 00 00 10 2a 33 verllf %v16,%v0,16 + e7 00 00 10 2c 33 verllf %v16,%v16,16 Cc: qemu-stable@nongnu.org Reported-by: Michael Tokarev Fixes: 22cb37b4172 ("tcg/s390x: Implement vector shift operations") Fixes: 79cada8693d ("tcg/s390x: Implement tcg_out_dup*_vec") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2054 Reviewed-by: Thomas Huth Tested-by: Michael Tokarev Message-Id: <20240117213646.159697-2-richard.henderson@linaro.org> Signed-off-by: Richard Henderson --- tcg/s390x/tcg-target.c.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tcg/s390x/tcg-target.c.inc b/tcg/s390x/tcg-target.c.inc index fbee43d3b0..7f6b84aa2c 100644 --- a/tcg/s390x/tcg-target.c.inc +++ b/tcg/s390x/tcg-target.c.inc @@ -683,7 +683,7 @@ static void tcg_out_insn_VRIc(TCGContext *s, S390Opcode op, tcg_debug_assert(is_vector_reg(v3)); tcg_out16(s, (op & 0xff00) | ((v1 & 0xf) << 4) | (v3 & 0xf)); tcg_out16(s, i2); - tcg_out16(s, (op & 0x00ff) | RXB(v1, 0, v3, 0) | (m4 << 12)); + tcg_out16(s, (op & 0x00ff) | RXB(v1, v3, 0, 0) | (m4 << 12)); } static void tcg_out_insn_VRRa(TCGContext *s, S390Opcode op, @@ -738,7 +738,7 @@ static void tcg_out_insn_VRSa(TCGContext *s, S390Opcode op, TCGReg v1, tcg_debug_assert(is_vector_reg(v3)); tcg_out16(s, (op & 0xff00) | ((v1 & 0xf) << 4) | (v3 & 0xf)); tcg_out16(s, b2 << 12 | d2); - tcg_out16(s, (op & 0x00ff) | RXB(v1, 0, v3, 0) | (m4 << 12)); + tcg_out16(s, (op & 0x00ff) | RXB(v1, v3, 0, 0) | (m4 << 12)); } static void tcg_out_insn_VRSb(TCGContext *s, S390Opcode op, TCGReg v1, @@ -762,7 +762,7 @@ static void tcg_out_insn_VRSc(TCGContext *s, S390Opcode op, TCGReg r1, tcg_debug_assert(is_vector_reg(v3)); tcg_out16(s, (op & 0xff00) | (r1 << 4) | (v3 & 0xf)); tcg_out16(s, b2 << 12 | d2); - tcg_out16(s, (op & 0x00ff) | RXB(0, 0, v3, 0) | (m4 << 12)); + tcg_out16(s, (op & 0x00ff) | RXB(0, v3, 0, 0) | (m4 << 12)); } static void tcg_out_insn_VRX(TCGContext *s, S390Opcode op, TCGReg v1, From patchwork Tue Jan 23 10:24:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 765192 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1528732wrx; Tue, 23 Jan 2024 02:25:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IFM4P32+XST0czwNDqdfnWxlsmUKV4IxiHdSPZ5dKaC1rp9zzt4uCTGgPWu8GFZxy1yNcBt X-Received: by 2002:ac8:5905:0:b0:42a:4662:48c8 with SMTP id 5-20020ac85905000000b0042a466248c8mr644503qty.63.1706005542533; Tue, 23 Jan 2024 02:25:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706005542; cv=none; d=google.com; s=arc-20160816; b=XtFjoHDcBpUwsORw7xukKvDEhFCFrLInDKU68qxEGcMgyWtQRlFJRbnb5xANqlT4j8 7PtutopGIMHR8/xLc7X9hRDPmmhQTSQOp5oR6aEi32JSgHF+TLOVcF+kNNEVJQ/VwF90 qMwU5Ua4T8Lece36R8JZMGo5UdLYhtpiNPg5vYnQU6FN1q7GD9fM+Z/f2W5TlFhdFy34 0f12pUKwjUB0BVLaZiK7oNeyCCS9AajYNv2FgiczLtPkhHKeubIQ8bK4Tsl5CJe8svqN gs+gWhzofP8Fb5sYAD+KkbnC+T536EA/T4BAvDQFiuBMlR6hfmUIfkJ0mbBrAsT+0C/T YNBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:dkim-signature; bh=gjWMZ9p5XTSuEC96EcRqyo4JXfEkDtPUT23udsatzbQ=; fh=rytU8pZd1+GXRXoRngAdIdeuHnaTwC55s4VPhE2/+4E=; b=UM48aVt+jVnWyXZGuqm44T7nYkBS6Xx1jDjFYkl5K/ER3n4z+h/cyqA2F5IWremp4X XskmNkp9VMtp4xCnKlG4Sp5knPQ3kWwUSKguh8czCL3K7gO8NwY9UP2PdZVOKuEI/os4 4ofRQEehKQ4xKXHq0j+e/QMALGgdq9jfV5qQ5C/A6NlLKheP71lOCI2y2x2X9/g87HPA onFMTTLtUFXIB1xnBy7QUMsbmoSylo++6UVekhOkPhzlt1A/KsulEn/Xfh0nt/KIlUlb CnHLSbQ7mQ2N/SOubEDcFRFaReOIa6q47N4nAGRYc9GEG05hlKMUI97dFFygU/TDFJ1O jSuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OCSbg8qf; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o15-20020a05622a008f00b0042a4856f84bsi2414840qtw.556.2024.01.23.02.25.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2024 02:25:42 -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; dkim=pass header.i=@linaro.org header.s=google header.b=OCSbg8qf; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSDxN-0000Pg-3p; Tue, 23 Jan 2024 05:24:37 -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 1rSDxL-0000PL-S9 for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:35 -0500 Received: from mail-oo1-xc33.google.com ([2607:f8b0:4864:20::c33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSDxK-0004dZ-2h for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:35 -0500 Received: by mail-oo1-xc33.google.com with SMTP id 006d021491bc7-59883168a83so1438581eaf.2 for ; Tue, 23 Jan 2024 02:24:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706005472; x=1706610272; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gjWMZ9p5XTSuEC96EcRqyo4JXfEkDtPUT23udsatzbQ=; b=OCSbg8qf0HGuk00iTLaG6ofsvLUBr65RPSsmjcS8TAoUnxq/ftLRtfCsvKpfb91Ghd AtPjY3rro6VRviQq63uF8L/RebclLjuJPHIVXjiCYsvYEpMfuIt75XM4Hj2jkSQH/IWX Rzz1se5wZHoljFDipbEkaoprOD9L6NOS2k+rR9h6JbvdGuVHTa58adUWyy1Su1FLoAh6 c14DYdEe0iMyK07+udvrlSG6cegvYDxnNiBNqxrnWgc7AMvReDVqmEkSNSEIGA/qiLhn Ej23IFzI6NGGVoTAybkoa5bYNPrwowMxnbt03shuRUtXfXqzl68IZPtx0wKOmoZRegSB 7DBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706005472; x=1706610272; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gjWMZ9p5XTSuEC96EcRqyo4JXfEkDtPUT23udsatzbQ=; b=MB6kFjVKAWOev/WmE8/RFsOzqkKy5LVU66XJb+IFSW64tpqHbA198IzwwNuqSFOz3g 1T0MfFlua/b6hvfp6JsLqYtkFxQ2rp7JeUyDswrme236AWaJqapuFBKp7MiMu2KScpHi R0SJOL5s7Lvy7GC5tB1+/ZlWEngNm2eAH51ydu4xqTt/4Fg98r9XVoEsH3y9KCXE3EYj ZQ2MT7BAzs3kiUDFHhlpHPJlPUNglSyQqCTQ0HhDzbIGj2NiEYwS9fsMA7P9QT8vTfKM NfQu7K/rLMKYufC+HPKFI72zdVoW4qpJ4Cu7609v1rLUXN7QMAYhHwXbMdmRN9yhFp9G gDdA== X-Gm-Message-State: AOJu0YyC6EvLOLGGpGzGugKUJtuhZUwNYu9MCxWJilG4UufBe9oEtj/o eF0rdKQ4dM4gaveiUdYcWLQibpk73opM0RmsAL5UuUPU4vShNKK5Zxd3chkNDwihOBZa5Airmz1 qSC0= X-Received: by 2002:a05:6358:524b:b0:176:40e2:8909 with SMTP id c11-20020a056358524b00b0017640e28909mr1705602rwa.27.1706005472634; Tue, 23 Jan 2024 02:24:32 -0800 (PST) Received: from stoup.lan (2001-44b8-2176-c800-b8a0-0408-58be-7d2e.static.ipv6.internode.on.net. [2001:44b8:2176:c800:b8a0:408:58be:7d2e]) by smtp.gmail.com with ESMTPSA id d8-20020a62f808000000b006d9ce7d3258sm11072408pfh.204.2024.01.23.02.24.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 02:24:32 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Vineet Gupta , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Alistair Francis Subject: [PULL v2 5/8] linux-user/riscv: Adjust vdso signal frame cfa offsets Date: Tue, 23 Jan 2024 20:24:09 +1000 Message-Id: <20240123102412.4569-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123102412.4569-1-richard.henderson@linaro.org> References: <20240123102412.4569-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c33; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc33.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org A typo in sizeof_reg put the registers at the wrong offset. Simplify the expressions to use positive addresses from the start of uc_mcontext instead of negative addresses from the end of uc_mcontext. Reported-by: Vineet Gupta Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis Signed-off-by: Richard Henderson --- linux-user/riscv/vdso-32.so | Bin 2900 -> 2980 bytes linux-user/riscv/vdso-64.so | Bin 3856 -> 3944 bytes linux-user/riscv/vdso.S | 8 ++++---- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/linux-user/riscv/vdso-32.so b/linux-user/riscv/vdso-32.so index 1ad1e5cbbbb8b1fe36b0fe4bcb6c06fab8219ecd..c2ce2a4757900a16b891bb98f7a027ac30c47a5f 100755 GIT binary patch delta 643 zcmYjPOH5Ni6ur|gwzc+9XhF0TMNp`GR6Zh~mKGzXLQ}j z)#}rFqIBkAs)(L%{#f{&3ii(}e_yh8Pgey7+LRKpj+~BYkcbM&LN$yL<+mtroa4HJ zZMB#&#N4vYgN#$Ed?)jGwn>u^j$uL6%5;@6#JIs26v~>`CEXn6`%uX09<>tLIBejZ zFY)AcUK{^`w8`*U60=@WX3@OR=)D9Xp?Lu9eduPPPr;Cc@g53huwxpgyD;B@WePiQ z!+Hz5CSkh?Bv5z*_UkB`K=C*n*Cd=*Q4&Y#73{u@vN7x##oicPmry ze%vHqR9p0zd0b`2Q|4;3R+vXr`7g}X=20v*GSM6w@2yKvwky9(Ht|*2WbKiW=;xN^G26tL(qVS~ E1D4W)y8r+H delta 565 zcmZ1?eno780^^#AispCEGBkVi#XS5FJ{d(y6ALK`0fjZ#F<&4uOCj9 zVB90Pf`x%0f`NfSh=GSe3rO=!e#$6sXaLm50TmSm(hNX850vi%q*ajQ?SOoV&8AHG zjA8N59(ymx)f3 z946aMv6*T$&0@OQ43n8gvkYeI&C!{wHBV!{+5(q_PELy)7TYbcS!%V+V!7E0la)rR z3|8x{(OIjtPGh~=29=FUn-n(7ZIRh3wM}BX*bb4MLc0WZ^X=i;%e9YVKO5Mwb2h(Z zS%t*xcjTq|2?Y1y{IoJiPMVG&Z%B2pwIB5I9(EFvNz z?)pL^MhuHse{pSyL_`lkFFpi~An2jTdJL*3ANrQJmv!LB`8el0AAG-~d%k&ezwB?w z2F6$=o7t~c%+g;}vY+2KKi``ijg36bKRDF->-VRR@qD&8Un;XH#&qseT&%$Rm2UT< z5wR{OC8yv~N7E5BABJ-bD-Xhz0JX&79!2Xuw2ffZFjf!2GYIbPUycy@b0)t*m;96aGkL08X> zzGUeUrG%_8_LX0>9{X?YDUqp`qVpeCm%D6~@^8O6!(HS))fFn#xbF-%SEEbG?2`}67j2EFQ> zo3}9LFfy7BQ|eju4WV! zVPs&i0SYMq=>Q<@1Ed)yJF+U*UjQfLI5JPe5rP#V`Xz00DDVP%r~yjRT`J z57PlQR)-eG#s?tWjs-3YofbJbEw)=?v(##t#d5P1CM%6r8LZY@qqA0P zoyK~#4JsRzHYseD+aj}7YMaD%u^l2ig?0(-=G()wmunx#evpSj4qh<1k!|y419kyW za5-|gGn!0n6rMbX!-TP6@k;>oa*G zP}TuWFGF&2M1Z-gk@Mz*obD`4Zx|+X@#%5GYydif&z`YjawDHTFrX$M;kzXAEcnEna diff --git a/linux-user/riscv/vdso.S b/linux-user/riscv/vdso.S index a86d8fc488..c37275233a 100644 --- a/linux-user/riscv/vdso.S +++ b/linux-user/riscv/vdso.S @@ -101,12 +101,12 @@ endf __vdso_flush_icache .cfi_startproc simple .cfi_signal_frame -#define sizeof_reg (__riscv_xlen / 4) +#define sizeof_reg (__riscv_xlen / 8) #define sizeof_freg 8 -#define B_GR (offsetof_uc_mcontext - sizeof_rt_sigframe) -#define B_FR (offsetof_uc_mcontext - sizeof_rt_sigframe + offsetof_freg0) +#define B_GR 0 +#define B_FR offsetof_freg0 - .cfi_def_cfa 2, sizeof_rt_sigframe + .cfi_def_cfa 2, offsetof_uc_mcontext /* Return address */ .cfi_return_column 64 From patchwork Tue Jan 23 10:24:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 765193 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1528765wrx; Tue, 23 Jan 2024 02:25:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfmXLYD8BMz+gI6jFTnUtXdswgaooguXzsXzBrKBsYpvM6nTjkx4HGYzUSrliRVMQYXdCe X-Received: by 2002:a05:6214:c45:b0:685:3dcd:239b with SMTP id r5-20020a0562140c4500b006853dcd239bmr758461qvj.106.1706005548906; Tue, 23 Jan 2024 02:25:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706005548; cv=none; d=google.com; s=arc-20160816; b=LihwT/JkzU7PON2oXoFpK06QIyU4RMUcNJEkPY+qwafRER3R52a0nRd8fWmEqEPSw2 hq5d//ynKghaa/g2aZJ68HMmSC4KsOh4pXAtF4RYCfYGJFOAm4MvQKByV/PE4aom5zQE i0kskv52bPf8pkDrtnb15UMe9do6o4MJWqlCiCmFkUa1vx2aSqT7O/MbOsC5x30EdH3F Mmbyy1RUb2snQ2fJwVCo79FWixp7eCmAHJ0/mDL2qrWjhvMEzNBKuWNpEdKd7LbKweoW Eu6YH7C6jUbv7y7vosg/+d0QsHQoD9czugDT9ptoSSfIVlWnj4e17FRJKRegEGUejlNi MIBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:dkim-signature; bh=E554SzyD9ekZLsqgb3tmLUdyIwMdiLrTVwZboQHPuUo=; fh=pIQ/pnZIlSJRqn3IY6OfXgsfIYxl32er/DT+ShnNqYA=; b=UJg3snUoQOAzkGhkyTto+qrPZfjVvEqH5Xx7ndcVRFkxgZB2CzCIUL3u1F9JyGttKR hjc8GG/DWDa2xaUaD8OjVYRTTfLg3JU7tFGYYs0dLoDmqtBKRNTV3QPVcR5bOETtvCOD DajFNUqOEMpeyPfWhmbATRkYepfyDYD9nDMS94sLhK/WW10bxJAX/tjLjV6PkmA38HKA VKFjW89vVagy4kyHaPGVmoMZ8/lrj21GYU2n8DgSuhcFeUoDee5iYY3LYMFjugg9psKI LjHMNqfoCE6/HBs22kIAZmiURq5YkYItjU3oyQBA42LtJxEW6v+CG958dfk0U3JoPFkk L+xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hh8uOy4Q; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w18-20020a0cdf92000000b0068196578606si7760209qvl.499.2024.01.23.02.25.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2024 02:25:48 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Hh8uOy4Q; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSDxS-0000Qg-Fx; Tue, 23 Jan 2024 05:24: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 1rSDxP-0000Q0-SZ for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:39 -0500 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSDxO-0004dl-9y for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:39 -0500 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6dd6c9cb6a8so301902b3a.1 for ; Tue, 23 Jan 2024 02:24:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706005477; x=1706610277; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=E554SzyD9ekZLsqgb3tmLUdyIwMdiLrTVwZboQHPuUo=; b=Hh8uOy4QemhqM5K1zNY/TD39SOFkI/8kHXaUtvk2Qmz8vDe0sl1JCSxd2SXxNOX7kC iXJDz60jf5jzhSpGbeAHl+rPOZulhGZ6EUwVjs8jafpu0qNbsY+lSwVN+A1Yy7NRlc0r 2F3CiIFwZLBG4hzecQNPf7nVPY2QGaEL86+fswGQ/SjVMc93KGI2WX731ixC3EjL54Wd qcT+jZh74ciwbgXoC3kHghx/8vhbo89jj5PbYu74t91E1q4iI6xL8p9T15QqB8g4CpbV JKKILUwUKD9xiq8uPpHzPQjLUFSyt/1u8ZyqHo3z3WMGpZCDC3/uvDYzJ36NbGsRDhLa 4suw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706005477; x=1706610277; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E554SzyD9ekZLsqgb3tmLUdyIwMdiLrTVwZboQHPuUo=; b=nMwdMHmsLxznHJeEfaEAHghwUhRenfoPTcA/QXXK5jXItHCWlqcqp0QNAxhTdnKJBt 7SYeGiSrbbrOOa2SyBi6yd19beEwnEXRYoLztdbvCtzJOIyd6L7IYmE1b1EGCFw1HuHK MSxMBFgv7EGrGHQ+S+LqNVPUMr3x9VvIwbCYUEto+vjvi3TRXOJlQSFrftKy+kdFSaX9 StbY2W4Ui3AhaujeoQoKTerDSlaoygizcVki2A8NUPX720XWK49gaU3cv8dDXCr3MFpX sQuR3JYYn0CLMjFvnoABGHBuXXIQhNggbbbO9eU0kM+kWBI4XYDi/7Psj6xzt0H8RMj0 vlrQ== X-Gm-Message-State: AOJu0Ywim1YINCfD5JAryhOTSJ52KbobF1wYigrt3PabTpU234SS3qCE mXbrRi+mRJxCel1nNEkUVz96S81yz3h0BKM6GHRzzbBUfZhYmjdwP1E1dmpojD+yFBr9Zr3DvKx ilms= X-Received: by 2002:aa7:9301:0:b0:6d9:8ccb:be1b with SMTP id cz1-20020aa79301000000b006d98ccbbe1bmr3684018pfb.29.1706005475273; Tue, 23 Jan 2024 02:24:35 -0800 (PST) Received: from stoup.lan (2001-44b8-2176-c800-b8a0-0408-58be-7d2e.static.ipv6.internode.on.net. [2001:44b8:2176:c800:b8a0:408:58be:7d2e]) by smtp.gmail.com with ESMTPSA id d8-20020a62f808000000b006d9ce7d3258sm11072408pfh.204.2024.01.23.02.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 02:24:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= Subject: [PULL v2 6/8] linux-user/elfload: test return value of getrlimit Date: Tue, 23 Jan 2024 20:24:10 +1000 Message-Id: <20240123102412.4569-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123102412.4569-1-richard.henderson@linaro.org> References: <20240123102412.4569-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Thomas Weißschuh Should getrlimit() fail the value of dumpsize.rlimit_cur may not be initialized. Avoid reading garbage data by checking the return value of getrlimit. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Thomas Weißschuh Message-Id: <20240120-qemu-user-dumpable-v3-1-6aa410c933f1@t-8ch.de> Signed-off-by: Richard Henderson --- linux-user/elfload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index cf9e74468b..c596871938 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -4667,9 +4667,9 @@ static int elf_core_dump(int signr, const CPUArchState *env) init_note_info(&info); errno = 0; - getrlimit(RLIMIT_CORE, &dumpsize); - if (dumpsize.rlim_cur == 0) + if (getrlimit(RLIMIT_CORE, &dumpsize) == 0 && dumpsize.rlim_cur == 0) { return 0; + } corefile = core_dump_filename(ts); From patchwork Tue Jan 23 10:24:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 765191 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1528724wrx; Tue, 23 Jan 2024 02:25:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IEq5J5pqgadVsCTfwhHFc6n8olfGvspaWirvSa0oyg5SI0F2fm487RiVWvBLjlJrbh7iMMe X-Received: by 2002:a05:6214:e86:b0:682:54de:bf99 with SMTP id hf6-20020a0562140e8600b0068254debf99mr850897qvb.26.1706005538182; Tue, 23 Jan 2024 02:25:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706005538; cv=none; d=google.com; s=arc-20160816; b=jntajadNIYSJJepIMe7QT/Mowu7sfFZnyQ0jWREf3s2Zc38HWVgL7F/VIjHV8r2dq+ 1Ym9n9cErYn27yBhkoRDQ6wdOWyDSUJ9m+qXl6h3IW+dOVkV8VwroIUWqnahscSGQtTz yGW+Y0PD61BkjbN1FoDcxzVO9iw/pJ2gwAK3vLtQc6wDbvIN1AXPoAo9PZgu48V0ExkU bQRQyVQpdCu4JCyPW9J0L5HuQUd9Mdw7Vokpxcfl+3G4/T3H1vJ3qOT2wsY2qOsiRUSu jLvJogHovd4zp8WOa6p4mzp4of+7Vsr6V34DXd9FbI8AoVZHR+/PmPNVgaxbGjyRSR6i I1yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:dkim-signature; bh=McCaPLIJxvTbADv66BEO7sWToPqj2hCMM+otAiFa5d4=; fh=pIQ/pnZIlSJRqn3IY6OfXgsfIYxl32er/DT+ShnNqYA=; b=enUSboaeR1rw7wF2ZeqUy36ZEWetVM/V/zi4jz4AAmi4uZ3QkgCO5x/tIdHd3Es8iq f4lFlC4+JhGYwjOK1poXqAMCwghdWjgM/O9Dh7N38j3LIrbhEHvvCD/zd7IUdLRXiyQv gZzj3o4WHqOQFK7UNQRvIA22YZljZuJdDrVFlsRAdT4fYOO++6gwB46kt3Th59NemAvH WGM2gR3T5WsaKd5r7B0WI35Aq1I9ZWYpgpDDODPlqhQaOR4bwSo+RO4derxTvXOc3flx Vf7PI9Dw6TDGQK/Hv2sS1af38lFTIX38Zj+tq/461XLI7p96+gpQQ7tVKUKFXqhQTbWu 1Udg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AQKv+fNA; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q19-20020a0cf5d3000000b006816c8e3a8esi7637311qvm.193.2024.01.23.02.25.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2024 02:25:38 -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; dkim=pass header.i=@linaro.org header.s=google header.b=AQKv+fNA; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSDxR-0000QJ-FS; Tue, 23 Jan 2024 05:24:41 -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 1rSDxQ-0000Q8-Ih for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:40 -0500 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSDxP-0004dp-0z for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:40 -0500 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6d9344f30caso2556378b3a.1 for ; Tue, 23 Jan 2024 02:24:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706005478; x=1706610278; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=McCaPLIJxvTbADv66BEO7sWToPqj2hCMM+otAiFa5d4=; b=AQKv+fNArFTzeLgw7mDKhKdqnNm9cP0JQu4QCwk5UTbURygHnNhjDCEKUClHRjic9B rdTsPRLTyf2Rx3Pu6xMMT3Gz9DEBWB1EHxZsaXjeMTXypHOtG70W5uk/MnfqFJiRkGwy V4J24KJZOA11sNop/Bx8vM9Lopk9rtv49rNb+57s91phKK9T+jDde4tzEfkspLT1UXT1 hLHwoFLj3OcnYVkxHaI9DawFDLq8uEo/qhiHuy5yRpWPUgTIHnZdJ762Z9bSXs3tEAzO FOdocvJH8TSoLHEjzckUVQMFinvF/T15ptLA9CsjwiOuRdIu1YMJ9fXu0ITzsZ1tUe4J z+Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706005478; x=1706610278; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=McCaPLIJxvTbADv66BEO7sWToPqj2hCMM+otAiFa5d4=; b=qBsBmmlT8fvMqm35Tn0taEhZN/m+jdBUFVRuGl33AlOr1wwB/HVwrB523DHZXLHuB4 k+s2o/Jv7i7NZUM0TWUiYGUG4fqEO6EMfrIzzhrm7KrQceLFs091nJ0ToXWQZMHc7LFb zvMfX3ZMbiqF4heelhPiJR5rof/Wd8dmYF/T4v2xIrOqM9iCMkyqr4RQfNulsyUHXnS1 JtP2HGEauuKxlmfL9VpMgFW0WmKo3V1cDHVzlfiDbm64Oad3Eg//f7ciqxBO/UgY7+lC 6nW6oaVFgAFuqutaak4taRa/9SKu+zQ7fjSK06/Qo1D4JvYxrvn1to6z7x1kybqmtLZs e8oA== X-Gm-Message-State: AOJu0YxNF/d3/K99CU/gx1Zste6L/VD6yqPZBG0YO+7+8ZvfuS+/f6w0 C4poTP3mzyhLNVWkRgbwSbohRsGxg4k5ABbGGJDWLJuMHfIqvvVEsEUoqNfuijidHkAQAktn4rH 8NJY= X-Received: by 2002:a05:6a20:4329:b0:199:89a0:9f2b with SMTP id h41-20020a056a20432900b0019989a09f2bmr6537956pzk.26.1706005477681; Tue, 23 Jan 2024 02:24:37 -0800 (PST) Received: from stoup.lan (2001-44b8-2176-c800-b8a0-0408-58be-7d2e.static.ipv6.internode.on.net. [2001:44b8:2176:c800:b8a0:408:58be:7d2e]) by smtp.gmail.com with ESMTPSA id d8-20020a62f808000000b006d9ce7d3258sm11072408pfh.204.2024.01.23.02.24.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 02:24:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , =?utf-8?q?Philippe_?= =?utf-8?q?Mathieu-Daud=C3=A9?= Subject: [PULL v2 7/8] linux-user/elfload: check PR_GET_DUMPABLE before creating coredump Date: Tue, 23 Jan 2024 20:24:11 +1000 Message-Id: <20240123102412.4569-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123102412.4569-1-richard.henderson@linaro.org> References: <20240123102412.4569-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Thomas Weißschuh A process can opt-out of coredump creation by calling prctl(PR_SET_DUMPABLE, 0). linux-user passes this call from the guest through to the operating system. >From there it can be read back again to avoid creating coredumps from qemu-user itself if the guest chose so. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Thomas Weißschuh Message-Id: <20240120-qemu-user-dumpable-v3-2-6aa410c933f1@t-8ch.de> Signed-off-by: Richard Henderson --- linux-user/elfload.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index c596871938..daf7ef8435 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2,6 +2,7 @@ #include "qemu/osdep.h" #include +#include #include #include @@ -4667,6 +4668,11 @@ static int elf_core_dump(int signr, const CPUArchState *env) init_note_info(&info); errno = 0; + + if (prctl(PR_GET_DUMPABLE) == 0) { + return 0; + } + if (getrlimit(RLIMIT_CORE, &dumpsize) == 0 && dumpsize.rlim_cur == 0) { return 0; } From patchwork Tue Jan 23 10:24:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 765195 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:10c4:b0:337:62d3:c6d5 with SMTP id b4csp1528814wrx; Tue, 23 Jan 2024 02:25:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQM0nlHcUwH9fVXuECar9muKCc7ZWS8nnPVMD3ZCZn3gOKHyFK77BiglC/9/FYei4pbVrH X-Received: by 2002:a05:622a:1793:b0:42a:4a09:7d06 with SMTP id s19-20020a05622a179300b0042a4a097d06mr557179qtk.49.1706005556753; Tue, 23 Jan 2024 02:25:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706005556; cv=none; d=google.com; s=arc-20160816; b=Y98jBDeYG6Hf3j894ku0XnObGMPFscC8Wl51i9RlB7fXljBsbuP/+8pCR0TK7t9ike C2I2jVABQcV/ot3TAdrOlf0FBDELeBxq9mtdViA9ySeQbCcM9ZmSHfBKFXtYOJDTH81f qkzQIpKewkXnRsx8gNryuj9tsoH6+Fx5YAPjOTlyzGA7Iu1K1iMCb7NtF+0QMJ8w+zKG BOR9SfU7g3Ippz5vuZogtzRQy0KK2wpFLmBh0EqbbBLkCz3CDE0Cy1cNfvC8O58iXM03 KVpHmH4uYgwVKiVfZGKwvn7Zzs6fP6w56a5v3YuhTJjMA2ra2fziUFmwbfOLre6vaW9N 6+WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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:dkim-signature; bh=oG4pU7qednB+jbhj9CwzPfU2NfzR3Eb/S1PuscRboM8=; fh=x5cujyMlswmEiiRyw3vKxb5h2JmORJET6hWLdk8ya5M=; b=ptHEezgftj/gmnEp6DlQzeED1yojXtmLgxNwjDTXZGkwqhIlDZeiW1RNXst/ycNA7m 7QNyGFYBCzgILfA2DdkdRoQJ3dfeWNmgUc/YcEJlE6odPVn1AlCJXn2ynQWMBwqTbZD5 Yxz7PEUCM5oHzDoZzOaUbpYSNspEot67FYQn693AEMWCBlJr6SJWRSx7IJ/A6rGfXPKI gKUTI/+m1BhfsNSsuIu3bFBdUOmSvaDNAZY3oIgf1isASyYpxNOL36PoqiU3WB2asyfI VmUmbekc2lDkksJqMYV4Ly5lcUVvXazNuqdSXoQ2WuTFyG029gcCQdiNV4bC7wlDyKaN SB8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sw6mEeSY; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id k5-20020ac85fc5000000b00429d470ea36si7600008qta.592.2024.01.23.02.25.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Jan 2024 02:25:56 -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; dkim=pass header.i=@linaro.org header.s=google header.b=sw6mEeSY; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSDxT-0000RB-Tj; Tue, 23 Jan 2024 05:24:43 -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 1rSDxS-0000Qh-Hu for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:42 -0500 Received: from mail-oo1-xc2d.google.com ([2607:f8b0:4864:20::c2d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSDxQ-0004e0-VV for qemu-devel@nongnu.org; Tue, 23 Jan 2024 05:24:42 -0500 Received: by mail-oo1-xc2d.google.com with SMTP id 006d021491bc7-599a95e3fceso114238eaf.1 for ; Tue, 23 Jan 2024 02:24:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706005480; x=1706610280; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oG4pU7qednB+jbhj9CwzPfU2NfzR3Eb/S1PuscRboM8=; b=sw6mEeSYC48IuXb4k4Iz2grHSEw+Qg0n+eNpF1ZaQ6FBVRuC4XiuPhWjHjILiYyvOd k8L8Fxauht/wJb088Y2YRyn55u/qd/ESFRzwb60Pxzo0fxrtxud8p/NySgdiJSIjoZQG bsp9A40LWdemoeagXg2zKqMvEugkOCDxRg9aKDNqoaZPEcHb8MJAH65Mx6CYT5p/+hlG sMZWu+ch0UU5wQXZsH/Ccwe5gVSytqUm18XN/x9Onx9XP9DyH5+n4OHDdiWiVGp85lc3 Bf94IcdKFxHBn3d2hbEH80ryd1rf/kJi6A5x6ks8/cJmm2Jlb/FRJMe/rifotlvO/ojR AGwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706005480; x=1706610280; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oG4pU7qednB+jbhj9CwzPfU2NfzR3Eb/S1PuscRboM8=; b=BzewXAK2j2PjnMyzH32/rzvnVIkKM/EkBGpkhPQqjMPCSRfxVH3KFK0Gee0gvbbYID x4bY3S3IlXWsz1Ul3LcXpl4jIc6MosqmRfb0c5bAUB3pVyKSUelSsSMGO7xtTv8OTG2L t7MxNaWdj40ahMn2bLBdUjSVBnXFF5OJRhHfdykx7AgXe/7wWfa4XJE88Sq6DXzXnota Shg7OpFrxazfLESm7705lQME9ODm4e/v/CF/fX3OihHjiDhNzHJniF+JfBCje3ZVA8vV eYBdSXCzkDbF3ZsBqfFdCwjKP12/ddM7aYt2yVc3gM/CS89i1Gl8+3wxg+jOyzOvXPXA IVzw== X-Gm-Message-State: AOJu0YwgPppI3EzDVJklOX7QV8DDXua3pL+U3D2nPIp99boTgUcsGBmT HiiKIln9ZVHvHkOJ+H+yJmhnawijK4QqYlvEOLaANnpqkRFFOYWgf5IYX/mnNStA9ii+M3AkrwI idUw= X-Received: by 2002:a05:6358:d044:b0:175:b71f:6178 with SMTP id jb4-20020a056358d04400b00175b71f6178mr4543150rwb.32.1706005479827; Tue, 23 Jan 2024 02:24:39 -0800 (PST) Received: from stoup.lan (2001-44b8-2176-c800-b8a0-0408-58be-7d2e.static.ipv6.internode.on.net. [2001:44b8:2176:c800:b8a0:408:58be:7d2e]) by smtp.gmail.com with ESMTPSA id d8-20020a62f808000000b006d9ce7d3258sm11072408pfh.204.2024.01.23.02.24.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 02:24:39 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Joseph Burt Subject: [PULL v2 8/8] tcg/arm: Fix SIGILL in tcg_out_qemu_st_direct Date: Tue, 23 Jan 2024 20:24:12 +1000 Message-Id: <20240123102412.4569-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240123102412.4569-1-richard.henderson@linaro.org> References: <20240123102412.4569-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::c2d; envelope-from=richard.henderson@linaro.org; helo=mail-oo1-xc2d.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Joseph Burt When tcg_out_qemu_st_{index,direct} were merged, the direct case for MO_64 was omitted, causing qemu_st_i64 to be encoded as 0xffffffff due to underflow when adding h.base and h.index. Fixes: 1df6d611bdc2 ("tcg/arm: Introduce HostAddress") Signed-off-by: Joseph Burt Message-Id: <20240121211439.100829-1-caseorum@gmail.com> Reviewed-by: Richard Henderson Signed-off-by: Richard Henderson --- tcg/arm/tcg-target.c.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index fc78566494..a9aa8aa91c 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -1662,6 +1662,9 @@ static void tcg_out_qemu_st_direct(TCGContext *s, MemOp opc, TCGReg datalo, } else { tcg_out_strd_r(s, h.cond, datalo, h.base, h.index); } + } else if (h.index < 0) { + tcg_out_st32_12(s, h.cond, datalo, h.base, 0); + tcg_out_st32_12(s, h.cond, datahi, h.base, 4); } else if (h.index_scratch) { tcg_out_st32_rwb(s, h.cond, datalo, h.index, h.base); tcg_out_st32_12(s, h.cond, datahi, h.index, 4);