From nobody Sat May 11 06:51:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710242767; cv=none; d=zohomail.com; s=zohoarc; b=iHgRkHr/JoI2WsbBgtuAdUkeHLrxjLwqa7NdQloXVCv0WARm8s6rBiXLShhAfrKctnrD2YkEqD2GHBFKBxsKkIw8owrGD6qOeExT8kA/58NNoM1oVeexF2L9LXYWWR57tKta33aRtqVIFGUmpwwPC1xxTiJF6fpK7VcnvYd/SNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710242767; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=lFd08eLrd4gGZuM0kNWdC4d2ia0nfqfy86pon6xWh1k=; b=exMQbUh1p/4/xEPUk2fCugdiLJP2nOmhhrSe6dS2tVnHnRQGwZkgCPP77nMc6rKIyGSQrzQwdHNJD58EC3fA0CRAzlXJwgvcBrKT2YGwYywxS6qqd6z5LIyA6EXI5FsW+LtIsYK/5yk7SlIFHk1xczQkxVbN2OFMK+kw1AeCPDs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710242767179163.11662096943394; Tue, 12 Mar 2024 04:26:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk0GP-0002u4-4V; Tue, 12 Mar 2024 07:25:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk0GO-0002tU-17 for qemu-devel@nongnu.org; Tue, 12 Mar 2024 07:25:44 -0400 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk0GF-0000gj-NC for qemu-devel@nongnu.org; Tue, 12 Mar 2024 07:25:42 -0400 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-513a81b717cso2465756e87.0 for ; Tue, 12 Mar 2024 04:25:35 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id j1-20020a05600c1c0100b00412ee7d65a6sm12202228wms.6.2024.03.12.04.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 04:25:33 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id AF3D45F8D4; Tue, 12 Mar 2024 11:25:32 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710242733; x=1710847533; 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=lFd08eLrd4gGZuM0kNWdC4d2ia0nfqfy86pon6xWh1k=; b=bcwW9czWa5T5iUu2nDdG7Zm3o0UfMGB0hTCdWvzl1R6UrHr4htjsgifOLKwTMHctIa ho83jp0k/qKP6CzrU3k5rLWaITJGu8iepNEJQzYgUWPV+jhNvR2plOOL7pmyPd4PB+PJ 6X84KFd0SdXDtFpsM9qmerh7Agw91RYhahH2tTLzECGmjaofnLBpPNn5np2+9fPWC2V9 NMA3Q7UgL2o3isJ8wgDISd6ZW3w0Y5oU6qAIzD3dc2hCJZs2bxnWMzh4AbBhwjjJubcm /CvQ1P0lt/rD1wGsD5xvrA1nO0uTrCMLGoN3szhiPPQH3hf3qX3A/njChYLBeYmIdwE8 rLNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710242733; x=1710847533; 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=lFd08eLrd4gGZuM0kNWdC4d2ia0nfqfy86pon6xWh1k=; b=tk6cpcTjtlhk0funQXJKvRxf+KI2hpI/+6w1Mlyj73gCmHEcQVaIsLDVEj9DJPAgzx /eJB3wZoMVnDfPwzBxk3H6PgulE33oMRYxmGv/Xla6ufbCqM0IVFu5IPWm6T6ICmPCzs ORUhkDAo2rhEAcPiaj4T3aClXCi/ZPP/B/seD/PYB0eYOQPUdcwI2j/j/JT/19C8tWIs VomF8SAEIvVNaRNPN86Lc6OMXu7hEtah/4tvcJewZ0Vl71csbZZR4EIpORSVKFufjd0P 7XYqJ4lAYhHqXYPQNYy0YbitnxWXvfFwAFZiLro2ED+mPyHBiKonpDJxExRzYEN2jgSK +UHQ== X-Gm-Message-State: AOJu0YyT/AoBixVUOdrnYmQfAh5pKdg6QzwV3QHNShCLJjwf283spi+1 hOPfa31N+S4PWCV2pgij9kl9a4rUD5xqb0lYwWDD6zJo8bSRvqim2Nr/Ln2U0u8= X-Google-Smtp-Source: AGHT+IFC6Fh3LNkcZ9kqV5GEWUtPFb95TYfhzKiyewiw/UssDJV+5/k+C6Fe4iuCammu+eoJs5T60Q== X-Received: by 2002:a05:6512:b94:b0:513:a833:cdaa with SMTP id b20-20020a0565120b9400b00513a833cdaamr4849827lfv.69.1710242733529; Tue, 12 Mar 2024 04:25:33 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , Wainer dos Santos Moschetta , Beraldo Leal , Yonggang Luo Subject: [PULL 1/8] gitlab: aggressively avoid extra GIT data Date: Tue, 12 Mar 2024 11:25:25 +0000 Message-Id: <20240312112532.1558319-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312112532.1558319-1-alex.bennee@linaro.org> References: <20240312112532.1558319-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=alex.bennee@linaro.org; helo=mail-lf1-x12b.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=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=no 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710242768589100003 This avoids fetching blobs and tree references for branches we are not going to worry about. Also skip tag references which are similarly not useful and keep the default --prune. This keeps the .git data to around 100M rather than the ~400M even a shallow clone takes. So we can check the savings we also run a quick du while setting up the build. We also have to have special settings of GIT_FETCH_EXTRA_FLAGS for the Windows build (git too old?) and the migration legacy test where we build an older QEMU alongside the main one. Signed-off-by: Alex Benn=C3=A9e diff --git a/.gitlab-ci.d/base.yml b/.gitlab-ci.d/base.yml index 2dd8a9b57c..bf3d8efab6 100644 --- a/.gitlab-ci.d/base.yml +++ b/.gitlab-ci.d/base.yml @@ -24,6 +24,10 @@ variables: # Each script line from will be in a collapsible section in the job ou= tput # and show the duration of each line. FF_SCRIPT_SECTIONS: 1 + # The project has a fairly fat GIT repo so we try and avoid bringing i= n things + # we don't need. The --filter options avoid blobs and tree references = we aren't going to use + # and we also avoid fetching tags. + GIT_FETCH_EXTRA_FLAGS: --filter=3Dblob:none --filter=3Dtree:0 --no-tag= s --prune --quiet =20 interruptible: true =20 diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-t= emplate.yml index 4fbfeb6667..22045add80 100644 --- a/.gitlab-ci.d/buildtest-template.yml +++ b/.gitlab-ci.d/buildtest-template.yml @@ -14,6 +14,7 @@ - export CCACHE_DIR=3D"$CCACHE_BASEDIR/ccache" - export CCACHE_MAXSIZE=3D"500M" - export PATH=3D"$CCACHE_WRAPPERSDIR:$PATH" + - du -sh .git - mkdir build - cd build - ccache --zero-stats diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml index c7d92fc301..cfdff175c3 100644 --- a/.gitlab-ci.d/buildtest.yml +++ b/.gitlab-ci.d/buildtest.yml @@ -187,6 +187,8 @@ build-previous-qemu: variables: IMAGE: opensuse-leap TARGETS: x86_64-softmmu aarch64-softmmu + # Override the default flags as we need more to grab the old version + GIT_FETCH_EXTRA_FLAGS: --prune --quiet before_script: - export QEMU_PREV_VERSION=3D"$(sed 's/\([0-9.]*\)\.[0-9]*/v\1.0/' VER= SION)" - git remote add upstream https://gitlab.com/qemu-project/qemu diff --git a/.gitlab-ci.d/windows.yml b/.gitlab-ci.d/windows.yml index f116b8012d..94834269ec 100644 --- a/.gitlab-ci.d/windows.yml +++ b/.gitlab-ci.d/windows.yml @@ -28,6 +28,8 @@ msys2-64bit: # qTests don't run successfully with "--without-default-devices", # so let's exclude the qtests from CI for now. TEST_ARGS: --no-suite qtest + # The Windows git is a bit older so override the default + GIT_FETCH_EXTRA_FLAGS: --no-tags --prune --quiet artifacts: name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" expire_in: 7 days --=20 2.39.2 From nobody Sat May 11 06:51:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710242789; cv=none; d=zohomail.com; s=zohoarc; b=WyeGw2deIU1ieqEseLS4usIE8WW0IskAHuhjyV+XxSSpa84YrmgpCTx+E7R518oYH4f/Gh3mfi3o+H5pQHwh99wYN9QtGYLvtQnJaUku+s21wq/xk1BbnohCGN2klDZ+Ch+mqJ7J47WFwnG288e3B46Jae/rDv/1ZtUTWIAo1AA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710242789; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=likgvKugk4b8t9l89CQl3BfsUjLIPBB3WZoVAljees8=; b=V7r/zm7s7koWA5j1aT5gmiYhno0Lk2+3rBA7d5MwsaGoZ64wuueqrn90CqA+0sHpe9dgPmQVu0TeFEG2rZFZmUn5qCncOlymz1/6Hwd+YJ+a0XK4K7mUXfR6BVbaUXNLFpAlFbyNbq/0dcQYg4ey+e34DxWJI/YX0zxcHmmRkpM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710242789624507.1631842385116; Tue, 12 Mar 2024 04:26:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk0GT-0002wW-6J; Tue, 12 Mar 2024 07:25:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk0GP-0002uF-AJ for qemu-devel@nongnu.org; Tue, 12 Mar 2024 07:25:45 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk0GK-0000jH-8J for qemu-devel@nongnu.org; Tue, 12 Mar 2024 07:25:43 -0400 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-33e672e10cfso2660343f8f.0 for ; Tue, 12 Mar 2024 04:25:37 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a22-20020a5d4576000000b0033e68338fbasm8766559wrc.81.2024.03.12.04.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 04:25:33 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id C108F5F8D5; Tue, 12 Mar 2024 11:25:32 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710242736; x=1710847536; 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=likgvKugk4b8t9l89CQl3BfsUjLIPBB3WZoVAljees8=; b=DW08WxMF+B9rMlbuk/1FXC8SRiNlybQcsMlufn10lYW1lD9iQUeCgSAKTLErF6+gWr VwZmpM3TOqE6EfOfEEUAU+JuMCsLmvjeTMJxrhPWKJEhpIeBi6+oH3L86jYI9A8+xGdL dXGlX6mMTNqJ9S0Ip5EBR2fLrBes68eaRZQO0i2yT1scSWS1O+NtgBfF4Lnuj4JbUWE+ Oh9IjIJeXy+7TE1R74yamIk+pKLtSFzy1XuWw5V1xOTM223O1tD7us7FRvkBRzuzfpmx Q9OuOmcOO+iRXPx2zQveLRtWvl9XKjcQmwLAjGlxEbMZwTRGl46PGlo+ZUNFOE5laerB 5MaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710242736; x=1710847536; 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=likgvKugk4b8t9l89CQl3BfsUjLIPBB3WZoVAljees8=; b=OzxXLdZ27PU6f9w8kSPQlsAGE7fklbOdH8jJQ221bfH1Lndj8na+r9KEeVi2U4LIpp UICdOHvCbyW9EVT0SRidT3IFrjeK0XjLt9gqjsgjmuVGtbdFx3sw//j6AAnleIIW2t0w CeBOkqyP6UAlmPVTJPK8hCRHTLatQx6++SmevXhlGHSFtVAm2MZP3zJ1cu0Y00sDw9Zr MZ21cSENU0A56ZSQ4wU4kiZvYPe4hWgFpYwIbZcz0nb833N0kML+y1gox2ugZwSLIIqx KO6r2WEcatwkJLnfy+6xsh1XL+duSK4n6SuTFqGajYVxtgYmA1KGztrtV81pndqQSqXd DZ2g== X-Gm-Message-State: AOJu0YyM8Fs7wCbmatjcKeA/YCgm14fb4rxGg5lW9qBx17UFYry1Y9OE gE23uMY/WLMDFJ/b9XJCTygz/S9j/hp5vU/rzRsaJWx98yf/WHolakWViesioW4= X-Google-Smtp-Source: AGHT+IHPit1NXoSm5SCOXYpz5veD40FZDYcwT3cLMIan4pT5sEjVA4tmuOIU+pnxMj43WBmsYaYSTw== X-Received: by 2002:adf:da4f:0:b0:33e:9113:a21d with SMTP id r15-20020adfda4f000000b0033e9113a21dmr4769899wrl.28.1710242736339; Tue, 12 Mar 2024 04:25:36 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Thomas Huth , Richard Henderson , Gustavo Romero , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal Subject: [PULL 2/8] tests/vm: ensure we build everything by default Date: Tue, 12 Mar 2024 11:25:26 +0000 Message-Id: <20240312112532.1558319-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312112532.1558319-1-alex.bennee@linaro.org> References: <20240312112532.1558319-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42e.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710242790653100001 The "check" target by itself is not enough to ensure we build the user mode binaries. While we can't test them with check-tcg we can at least include them in the build. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Thomas Huth Cc: Richard Henderson Cc: Gustavo Romero diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index f8fd751eb1..4a1af04b9a 100644 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -606,7 +606,7 @@ def get_default_jobs(): parser.add_argument("--build-qemu", help=3D"build QEMU from source in guest") parser.add_argument("--build-target", - help=3D"QEMU build target", default=3D"check") + help=3D"QEMU build target", default=3D"all check") parser.add_argument("--build-path", default=3DNone, help=3D"Path of build directory, "\ "for using build tree QEMU binary. ") --=20 2.39.2 From nobody Sat May 11 06:51:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710242774; cv=none; d=zohomail.com; s=zohoarc; b=d9JoknryeYHD6MFl+ICPn22q5dHZXi4ZXR8KvTBKKvCCy5UnH5WbNnz4KUqWZtMKrzs3VMrI2yLd/XseP4rzGrFH/jvtvob4v8fvFpJFlVMLWhrY5J5f6uisDb9FX9ihCjVKBczz6Lvkg1j5LOspOLKpRk0e50EKVxs+Ui1xlnI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710242774; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=T/TnnwpHa6+cyA8uGT7QNYUXfL4ZfkLpAJU45+MsrCA=; b=lYwGoNQVDLx7wJ7NVo+QJ4Xu4B50YE2xh6LmEpJwNMlTz2AcfHAF3jd1ZW70OmRs+cgzgM32msnT3DrlwF824420nTf6tZPJ5o+4GHX8h4B4KWy+4r272ef99nD1iERBfoCXEQTZrPwdKdFm2BdLFx3sK5Pqpb70ewnLXsmXhV4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710242774553383.39571855170436; Tue, 12 Mar 2024 04:26:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk0GK-0002pr-WF; Tue, 12 Mar 2024 07:25:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk0GI-0002ku-Q9 for qemu-devel@nongnu.org; Tue, 12 Mar 2024 07:25:38 -0400 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk0GF-0000gp-N7 for qemu-devel@nongnu.org; Tue, 12 Mar 2024 07:25:37 -0400 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-412e784060cso37658925e9.1 for ; Tue, 12 Mar 2024 04:25:35 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id s13-20020a5d6a8d000000b0033d202abf01sm8785691wru.28.2024.03.12.04.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 04:25:33 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id D715C5F8DA; Tue, 12 Mar 2024 11:25:32 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710242734; x=1710847534; 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=T/TnnwpHa6+cyA8uGT7QNYUXfL4ZfkLpAJU45+MsrCA=; b=n4uJV1YiLWsgQgp1dY+laz1pcbL9o9J0xdvCGCbS8/ihSrKCEuB23kMtt6H0ER5A2w Nl6Fg/auvQlQ8Pabn2nlNuThZ5q8fSD5zI1hDb0mahC44AZN2mEEtPkrTt0E8+rg3M2U WCLurpzHyWgcQ4jI5Of1wq/qYOIdxXf0iUN5ktllkT2vB0c8wwcAE0pXxdmfCN5otlWk ULGpziuda6xDQpuwk2sb3y+bUDy/b0sI68saWk2syL+bL6R+2L6vT/rT8zo5vGLDteTQ BFNBH70Vnkknk7VeCs5CzZNzLRUYBDLEF50szAKBqJGCgnOtF5MEl9YZSPJI6XAdW0FH Z2YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710242734; x=1710847534; 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=T/TnnwpHa6+cyA8uGT7QNYUXfL4ZfkLpAJU45+MsrCA=; b=XkNrRJQMnKJChzhLXaR7SbEw+ABMuXXKWoIyRlBESXNrgGgt8dqGPdAE5ucejjb0xg 4Nkj7p+OTDu5+CNHuaio2/Mpe9Walqz3H+V4RpyS51tdfwWjOmrANxPDecS6GEB/ak9L mFvC6qdB/jyYt2q1+bzHlkKjTYbQYvY83JNPoE+mcrqsltDbrMQCimqoohg1Y88AgMVP jZsvbrKUUyvbo8hms+CmLvcerxWJMc8gzqzoho7c45P8M8RoblghSSWxgg78OIfuSPEs SAdDf4huOkIX5a5/nwDZaru0uytrrDjsvtH0tqOb+GuMoi9BWOo3A9vYzNfa+kBJPuRX L5nQ== X-Gm-Message-State: AOJu0YwLv9LBHjS5x3Tz+wyn525VGnkZHdjJczcoULTGq73uQYPcHm+m 6sYuXH0IVcIXKHji0dmAU/8taqrX01yFPp2MdZu9Tey3x2kxZsK62o8qnKP3Oz2AG81KC9oHhgM p X-Google-Smtp-Source: AGHT+IEWcScdWkZZSFA3fhfyySTZM6qshOpTGB7e9ilrLU/nlvoATnJYwNdFnP+6FHZj8HpUDomcGQ== X-Received: by 2002:a05:600c:35c8:b0:413:1619:a78 with SMTP id r8-20020a05600c35c800b0041316190a78mr8585316wmq.4.1710242733914; Tue, 12 Mar 2024 04:25:33 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Gustavo Romero , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laurent Vivier Subject: [PULL 3/8] gdbstub: Rename back gdb_handlesig Date: Tue, 12 Mar 2024 11:25:27 +0000 Message-Id: <20240312112532.1558319-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312112532.1558319-1-alex.bennee@linaro.org> References: <20240312112532.1558319-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32f; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32f.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710242776657100004 From: Gustavo Romero Rename gdb_handlesig_reason back to gdb_handlesig. There is no need to add a wrapper for gdb_handlesig and rename it when a new parameter is added. Signed-off-by: Gustavo Romero Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson Message-Id: <20240309030901.1726211-2-gustavo.romero@linaro.org> Signed-off-by: Alex Benn=C3=A9e diff --git a/include/gdbstub/user.h b/include/gdbstub/user.h index 4c4e5c4c58..4fc88f8a25 100644 --- a/include/gdbstub/user.h +++ b/include/gdbstub/user.h @@ -10,7 +10,7 @@ #define GDBSTUB_USER_H =20 /** - * gdb_handlesig_reason() - yield control to gdb + * gdb_handlesig() - yield control to gdb * @cpu: CPU * @sig: if non-zero, the signal number which caused us to stop * @reason: stop reason for stop reply packet or NULL @@ -25,18 +25,7 @@ * or 0 if no signal should be delivered, ie the signal that caused * us to stop should be ignored. */ -int gdb_handlesig_reason(CPUState *, int, const char *); - -/** - * gdb_handlesig() - yield control to gdb - * @cpu CPU - * @sig: if non-zero, the signal number which caused us to stop - * @see gdb_handlesig_reason() - */ -static inline int gdb_handlesig(CPUState *cpu, int sig) -{ - return gdb_handlesig_reason(cpu, sig, NULL); -} +int gdb_handlesig(CPUState *, int, const char *); =20 /** * gdb_signalled() - inform remote gdb of sig exit diff --git a/gdbstub/user.c b/gdbstub/user.c index 7f9f19a124..520987fddc 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -190,7 +190,7 @@ void gdb_qemu_exit(int code) exit(code); } =20 -int gdb_handlesig_reason(CPUState *cpu, int sig, const char *reason) +int gdb_handlesig(CPUState *cpu, int sig, const char *reason) { char buf[256]; int n; @@ -746,7 +746,7 @@ void gdb_breakpoint_remove_all(CPUState *cs) void gdb_syscall_handling(const char *syscall_packet) { gdb_put_packet(syscall_packet); - gdb_handlesig(gdbserver_state.c_cpu, 0); + gdb_handlesig(gdbserver_state.c_cpu, 0, NULL); } =20 static bool should_catch_syscall(int num) @@ -764,7 +764,7 @@ void gdb_syscall_entry(CPUState *cs, int num) { if (should_catch_syscall(num)) { g_autofree char *reason =3D g_strdup_printf("syscall_entry:%x;", n= um); - gdb_handlesig_reason(cs, gdb_target_sigtrap(), reason); + gdb_handlesig(cs, gdb_target_sigtrap(), reason); } } =20 @@ -772,7 +772,7 @@ void gdb_syscall_return(CPUState *cs, int num) { if (should_catch_syscall(num)) { g_autofree char *reason =3D g_strdup_printf("syscall_return:%x;", = num); - gdb_handlesig_reason(cs, gdb_target_sigtrap(), reason); + gdb_handlesig(cs, gdb_target_sigtrap(), reason); } } =20 diff --git a/linux-user/main.c b/linux-user/main.c index 41caa77cb5..55aa11c9b4 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -1018,7 +1018,7 @@ int main(int argc, char **argv, char **envp) gdbstub); exit(EXIT_FAILURE); } - gdb_handlesig(cpu, 0); + gdb_handlesig(cpu, 0, NULL); } =20 #ifdef CONFIG_SEMIHOSTING diff --git a/linux-user/signal.c b/linux-user/signal.c index cc7dd78e41..bca44c295d 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -1180,7 +1180,7 @@ static void handle_pending_signal(CPUArchState *cpu_e= nv, int sig, /* dequeue signal */ k->pending =3D 0; =20 - sig =3D gdb_handlesig(cpu, sig); + sig =3D gdb_handlesig(cpu, sig, NULL); if (!sig) { sa =3D NULL; handler =3D TARGET_SIG_IGN; --=20 2.39.2 From nobody Sat May 11 06:51:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710242796; cv=none; d=zohomail.com; s=zohoarc; b=LZ5ctcM876vkX91qJUw/CP+A2kfuNrWLCet3Pa4YDtYfH3WpKog/3ErlCehron5XNQgo8YiJHFK3Sa7+OZTS92X76lWq27UnqTO1Y8xCK9REnBgTDLRu4CrPEMWlqsoaGnkYi/OdkmGbMnBpGapmCyDplZLdHlN81XYA4wyKono= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710242796; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=w+xs9VKQ31Vzn5Jc/bXAKp8ECjk5CZR3EsmvuC0rZMY=; b=gUILfCMlEJyLTt31FuncHVvyhTQNsfeyVngcgt5P8/YgbtKAY3FB04RT+uB/5XQrN1pudDXGeGDmvOvUYofrwDrdYcHOBOUt/Cok9joLu8wuay6rl6+fJcNzV8ojzBjK6cA0wlLWvNKhFUYstPkIVTIDk45lu8cgKUMXpYw8Dz8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710242796115451.8772277207347; Tue, 12 Mar 2024 04:26:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk0Gb-0003FI-KS; Tue, 12 Mar 2024 07:25:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk0GY-00035U-Q4 for qemu-devel@nongnu.org; Tue, 12 Mar 2024 07:25:55 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk0GH-0000h2-J9 for qemu-devel@nongnu.org; Tue, 12 Mar 2024 07:25:52 -0400 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4132a89a351so11664565e9.1 for ; Tue, 12 Mar 2024 04:25:35 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a17-20020adffad1000000b0033dc7e50488sm8770842wrs.96.2024.03.12.04.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 04:25:33 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 0BADA5F8DF; Tue, 12 Mar 2024 11:25:33 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710242734; x=1710847534; 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=w+xs9VKQ31Vzn5Jc/bXAKp8ECjk5CZR3EsmvuC0rZMY=; b=JWOLMqFpxVVtyU+dbsT7ir+4aZ+w7eoBX/G0Q/FDGottridcf8b8MTfOeg+2kq1Bgg gKegqsjvYeXuXz8b4EOLAJClsFW5d8mghAcjryEMNa27J1b4QqcZuyBLZA5rIFDVTOnw BcZxs0yql0wpwKkUz7E0WhEGa3sIwhNSyldn8sIcq1Vj5/uuUE4ToQ2fu9g+gpXUHUyD ULBnVicuNTm0+9bJadMjnFikhNiWOP9jrej+8lhSS27WSbFipOWG9+qCMLj038IN1NaA zaKzPUc1BIJ0ER00yh6xbt7SFtVvtMTsvUobHGLtRGnvCmEDhgMTl5BPxDBfSAJbfA8X JMWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710242734; x=1710847534; 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=w+xs9VKQ31Vzn5Jc/bXAKp8ECjk5CZR3EsmvuC0rZMY=; b=h+jC2hBp3eJoBtsM2t63501M2MSGL4ghDtiEt1UjhosZXmk6lOmFG6bNK9ON0V80WR LWmBCEX0PlChoHhfVEQibdgnTsyV/Cn7pgRWBCuZu+2d1Nu7yIKB85cuSYpw0hgwj7c4 ijKnEcxw2zvDFxbcH0RKZyiodyjNVSAN8fOyoMOb4fvUlL7VqEFgPxt7mBBSI48jxDRf +TGx+kh7ZU6fCndc0vuTVXFW2N+fHhLLn9ny2yJ2IaZ8o77JoXrqIAcSpvlO/gRA9NJz JZqsDmJStVvikd5s1nwYnRMupx5PP6CWhfpPabWWXvsigj0FVmOTdP3Y7G1rz8qq39Kh WVDg== X-Gm-Message-State: AOJu0Yz3cGJJXqBgnuAHKRkMbHj/HFVGzp1vZOr+Vh3mzPNYa2eq8xpi AiRY2R/gc/Fap0bEMIZIjpT3g5PAOA1wlPK4twyvBa4aDFgqMyXc1PYZ5TBx9EA= X-Google-Smtp-Source: AGHT+IEa/Zwi5st7epjbZUA9KrZlxInVwT5rKYiP/SdbD7fYjFvKJSr9gci4vT1IcOv8hxd4ZFX2fg== X-Received: by 2002:a5d:67d0:0:b0:33d:746b:f360 with SMTP id n16-20020a5d67d0000000b0033d746bf360mr1237583wrw.51.1710242734107; Tue, 12 Mar 2024 04:25:34 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Gustavo Romero , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Laurent Vivier , Brian Cain Subject: [PULL 4/8] linux-user: Move tswap_siginfo out of target code Date: Tue, 12 Mar 2024 11:25:28 +0000 Message-Id: <20240312112532.1558319-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312112532.1558319-1-alex.bennee@linaro.org> References: <20240312112532.1558319-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x332.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710242796751100001 From: Gustavo Romero Move tswap_siginfo from target code to handle_pending_signal. This will allow some cleanups and having the siginfo ready to be used in gdbstub. Signed-off-by: Gustavo Romero Suggested-by: Richard Henderson Reviewed-by: Richard Henderson Message-Id: <20240309030901.1726211-3-gustavo.romero@linaro.org> Signed-off-by: Alex Benn=C3=A9e diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index a7df12fc44..f4cbe6185e 100644 --- a/linux-user/signal-common.h +++ b/linux-user/signal-common.h @@ -43,8 +43,6 @@ void host_to_target_sigset_internal(target_sigset_t *d, const sigset_t *s); void target_to_host_sigset_internal(sigset_t *d, const target_sigset_t *s); -void tswap_siginfo(target_siginfo_t *tinfo, - const target_siginfo_t *info); void set_sigmask(const sigset_t *set); void force_sig(int sig); void force_sigsegv(int oldsig); diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index a1e22d526d..bc7a13800d 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -670,7 +670,7 @@ static void target_setup_frame(int usig, struct target_= sigaction *ka, aarch64_set_svcr(env, 0, R_SVCR_SM_MASK | R_SVCR_ZA_MASK); =20 if (info) { - tswap_siginfo(&frame->info, info); + frame->info =3D *info; env->xregs[1] =3D frame_addr + offsetof(struct target_rt_sigframe,= info); env->xregs[2] =3D frame_addr + offsetof(struct target_rt_sigframe,= uc); } diff --git a/linux-user/alpha/signal.c b/linux-user/alpha/signal.c index 4ec42994d4..896c2c148a 100644 --- a/linux-user/alpha/signal.c +++ b/linux-user/alpha/signal.c @@ -173,7 +173,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, goto give_sigsegv; } =20 - tswap_siginfo(&frame->info, info); + frame->info =3D *info; =20 __put_user(0, &frame->uc.tuc_flags); __put_user(0, &frame->uc.tuc_link); diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c index 59806335f5..8db1c4b233 100644 --- a/linux-user/arm/signal.c +++ b/linux-user/arm/signal.c @@ -357,7 +357,7 @@ void setup_rt_frame(int usig, struct target_sigaction *= ka, =20 info_addr =3D frame_addr + offsetof(struct rt_sigframe, info); uc_addr =3D frame_addr + offsetof(struct rt_sigframe, sig.uc); - tswap_siginfo(&frame->info, info); + frame->info =3D *info; =20 setup_sigframe(&frame->sig.uc, set, env); =20 diff --git a/linux-user/hexagon/signal.c b/linux-user/hexagon/signal.c index 60fa7e1bce..492b51f155 100644 --- a/linux-user/hexagon/signal.c +++ b/linux-user/hexagon/signal.c @@ -162,7 +162,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, } =20 setup_ucontext(&frame->uc, env, set); - tswap_siginfo(&frame->info, info); + frame->info =3D *info; /* * The on-stack signal trampoline is no longer executed; * however, the libgcc signal frame unwinding code checks diff --git a/linux-user/hppa/signal.c b/linux-user/hppa/signal.c index c84557e906..682ba25922 100644 --- a/linux-user/hppa/signal.c +++ b/linux-user/hppa/signal.c @@ -127,7 +127,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, goto give_sigsegv; } =20 - tswap_siginfo(&frame->info, info); + frame->info =3D *info; frame->uc.tuc_flags =3D 0; frame->uc.tuc_link =3D 0; =20 diff --git a/linux-user/i386/signal.c b/linux-user/i386/signal.c index bc5d45302e..cfe70fc5cf 100644 --- a/linux-user/i386/signal.c +++ b/linux-user/i386/signal.c @@ -430,7 +430,7 @@ void setup_frame(int sig, struct target_sigaction *ka, setup_sigcontext(&frame->sc, &frame->fpstate, env, set->sig[0], frame_addr + offsetof(struct sigframe, fpstate)); =20 - for(i =3D 1; i < TARGET_NSIG_WORDS; i++) { + for (i =3D 1; i < TARGET_NSIG_WORDS; i++) { __put_user(set->sig[i], &frame->extramask[i - 1]); } =20 @@ -490,7 +490,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, __put_user(addr, &frame->puc); #endif if (ka->sa_flags & TARGET_SA_SIGINFO) { - tswap_siginfo(&frame->info, info); + frame->info =3D *info; } =20 /* Create the ucontext. */ @@ -504,7 +504,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, setup_sigcontext(&frame->uc.tuc_mcontext, &frame->fpstate, env, set->sig[0], frame_addr + offsetof(struct rt_sigframe, fpstate= )); =20 - for(i =3D 0; i < TARGET_NSIG_WORDS; i++) { + for (i =3D 0; i < TARGET_NSIG_WORDS; i++) { __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]); } =20 diff --git a/linux-user/loongarch64/signal.c b/linux-user/loongarch64/signa= l.c index 39ea82c814..1a322f9697 100644 --- a/linux-user/loongarch64/signal.c +++ b/linux-user/loongarch64/signal.c @@ -376,7 +376,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, extctx.end.haddr =3D (void *)frame + (extctx.end.gaddr - frame_add= r); } =20 - tswap_siginfo(&frame->rs_info, info); + frame->rs_info =3D *info; =20 __put_user(0, &frame->rs_uc.tuc_flags); __put_user(0, &frame->rs_uc.tuc_link); diff --git a/linux-user/m68k/signal.c b/linux-user/m68k/signal.c index 5f35354487..77555781aa 100644 --- a/linux-user/m68k/signal.c +++ b/linux-user/m68k/signal.c @@ -295,7 +295,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, uc_addr =3D frame_addr + offsetof(struct target_rt_sigframe, uc); __put_user(uc_addr, &frame->puc); =20 - tswap_siginfo(&frame->info, info); + frame->info =3D *info; =20 /* Create the ucontext */ =20 @@ -307,7 +307,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, if (err) goto give_sigsegv; =20 - for(i =3D 0; i < TARGET_NSIG_WORDS; i++) { + for (i =3D 0; i < TARGET_NSIG_WORDS; i++) { __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]); } =20 diff --git a/linux-user/microblaze/signal.c b/linux-user/microblaze/signal.c index 5188d74025..f6d47d76ff 100644 --- a/linux-user/microblaze/signal.c +++ b/linux-user/microblaze/signal.c @@ -147,7 +147,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, return; } =20 - tswap_siginfo(&frame->info, info); + frame->info =3D *info; =20 __put_user(0, &frame->uc.tuc_flags); __put_user(0, &frame->uc.tuc_link); diff --git a/linux-user/mips/signal.c b/linux-user/mips/signal.c index 58a9d7a8a3..d69a5d73dd 100644 --- a/linux-user/mips/signal.c +++ b/linux-user/mips/signal.c @@ -303,7 +303,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, goto give_sigsegv; } =20 - tswap_siginfo(&frame->rs_info, info); + frame->rs_info =3D *info; =20 __put_user(0, &frame->rs_uc.tuc_flags); __put_user(0, &frame->rs_uc.tuc_link); @@ -311,7 +311,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, =20 setup_sigcontext(env, &frame->rs_uc.tuc_mcontext); =20 - for(i =3D 0; i < TARGET_NSIG_WORDS; i++) { + for (i =3D 0; i < TARGET_NSIG_WORDS; i++) { __put_user(set->sig[i], &frame->rs_uc.tuc_sigmask.sig[i]); } =20 diff --git a/linux-user/nios2/signal.c b/linux-user/nios2/signal.c index 32b3dc99c6..64c345f409 100644 --- a/linux-user/nios2/signal.c +++ b/linux-user/nios2/signal.c @@ -157,7 +157,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, return; } =20 - tswap_siginfo(&frame->info, info); + frame->info =3D *info; =20 /* Create the ucontext. */ __put_user(0, &frame->uc.tuc_flags); diff --git a/linux-user/openrisc/signal.c b/linux-user/openrisc/signal.c index be8b68784a..cb74a9fe5e 100644 --- a/linux-user/openrisc/signal.c +++ b/linux-user/openrisc/signal.c @@ -103,7 +103,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, } =20 if (ka->sa_flags & SA_SIGINFO) { - tswap_siginfo(&frame->info, info); + frame->info =3D *info; } =20 __put_user(0, &frame->uc.tuc_flags); diff --git a/linux-user/ppc/signal.c b/linux-user/ppc/signal.c index c232424c1e..652038a53c 100644 --- a/linux-user/ppc/signal.c +++ b/linux-user/ppc/signal.c @@ -493,7 +493,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, if (!lock_user_struct(VERIFY_WRITE, rt_sf, rt_sf_addr, 1)) goto sigsegv; =20 - tswap_siginfo(&rt_sf->info, info); + rt_sf->info =3D *info; =20 __put_user(0, &rt_sf->uc.tuc_flags); __put_user(0, &rt_sf->uc.tuc_link); @@ -502,7 +502,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, __put_user(h2g (&rt_sf->uc.tuc_mcontext), &rt_sf->uc.tuc_regs); #endif - for(i =3D 0; i < TARGET_NSIG_WORDS; i++) { + for (i =3D 0; i < TARGET_NSIG_WORDS; i++) { __put_user(set->sig[i], &rt_sf->uc.tuc_sigmask.sig[i]); } =20 diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c index 941eadce87..358fa1d82d 100644 --- a/linux-user/riscv/signal.c +++ b/linux-user/riscv/signal.c @@ -125,7 +125,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, } =20 setup_ucontext(&frame->uc, env, set); - tswap_siginfo(&frame->info, info); + frame->info =3D *info; =20 env->pc =3D ka->_sa_handler; env->gpr[xSP] =3D frame_addr; diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c index b40f738a70..df49c24708 100644 --- a/linux-user/s390x/signal.c +++ b/linux-user/s390x/signal.c @@ -267,7 +267,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, } =20 /* Create siginfo on the signal stack. */ - tswap_siginfo(&frame->info, info); + frame->info =3D *info; =20 /* Create ucontext on the signal stack. */ uc_flags =3D 0; diff --git a/linux-user/sh4/signal.c b/linux-user/sh4/signal.c index c16c2c2d57..9ecc026fae 100644 --- a/linux-user/sh4/signal.c +++ b/linux-user/sh4/signal.c @@ -233,7 +233,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, goto give_sigsegv; } =20 - tswap_siginfo(&frame->info, info); + frame->info =3D *info; =20 /* Create the ucontext. */ __put_user(0, &frame->uc.tuc_flags); diff --git a/linux-user/signal.c b/linux-user/signal.c index bca44c295d..c769675e68 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -409,8 +409,8 @@ static inline void host_to_target_siginfo_noswap(target= _siginfo_t *tinfo, tinfo->si_code =3D deposit32(si_code, 16, 16, si_type); } =20 -void tswap_siginfo(target_siginfo_t *tinfo, - const target_siginfo_t *info) +static void tswap_siginfo(target_siginfo_t *tinfo, + const target_siginfo_t *info) { int si_type =3D extract32(info->si_code, 16, 16); int si_code =3D sextract32(info->si_code, 0, 16); @@ -1180,6 +1180,12 @@ static void handle_pending_signal(CPUArchState *cpu_= env, int sig, /* dequeue signal */ k->pending =3D 0; =20 + /* + * Writes out siginfo values byteswapped, accordingly to the target. I= t also + * cleans the si_type from si_code making it correct for the target. + */ + tswap_siginfo(&k->info, &k->info); + sig =3D gdb_handlesig(cpu, sig, NULL); if (!sig) { sa =3D NULL; diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c index c2dc1000e2..f164b74032 100644 --- a/linux-user/sparc/signal.c +++ b/linux-user/sparc/signal.c @@ -333,7 +333,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, =20 __put_user(0, &sf->rwin_save); /* TODO: save_rwin_state */ =20 - tswap_siginfo(&sf->info, info); + sf->info =3D *info; tswap_sigset(&sf->mask, set); target_save_altstack(&sf->stack, env); =20 diff --git a/linux-user/xtensa/signal.c b/linux-user/xtensa/signal.c index 003208a916..6514b8dd57 100644 --- a/linux-user/xtensa/signal.c +++ b/linux-user/xtensa/signal.c @@ -184,7 +184,7 @@ void setup_rt_frame(int sig, struct target_sigaction *k= a, } =20 if (ka->sa_flags & SA_SIGINFO) { - tswap_siginfo(&frame->info, info); + frame->info =3D *info; } =20 __put_user(0, &frame->uc.tuc_flags); --=20 2.39.2 From nobody Sat May 11 06:51:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710242798; cv=none; d=zohomail.com; s=zohoarc; b=T4bpRQ59tYRN/AjM5Y625MuZJIiqAEAp2RvkxK+OfJT+x2QX52OhWQEdJbtl2KzMmWqiM0waVmm9/8IqX429jQ+JE4IXx5WPaw+NCd/Kh1tnB88gLeprXJUOS/XH/i9/WJ8/AvLlPFLlfVjyMZAit6qixOpajZlr9N6LWypjdnI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710242798; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CGMxfNWMqHxIajAfVs5LmcHHz96MvpgBL7/t14DrgrU=; b=mk6h3hsP2ujyt8Vl1uwhA8IIioWKZccG+sMJQMhuYZyEurKeMaWurFbKyUD5nShLGsmTF1K4MGJmldsopK6FuCArDDwL7wvG3VpmlJ4IsqEEpyxoGSZM0B9+OM9fELcyowBAL7fexKdNMc1dfBiTBgnFegztSfHB0CXxH0TYg0k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710242798876544.351219220542; Tue, 12 Mar 2024 04:26:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk0GW-0002yO-LB; Tue, 12 Mar 2024 07:25:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk0GR-0002vZ-F6 for qemu-devel@nongnu.org; Tue, 12 Mar 2024 07:25:48 -0400 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk0GJ-0000ja-Iy for qemu-devel@nongnu.org; Tue, 12 Mar 2024 07:25:44 -0400 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-33e70d71756so2846395f8f.1 for ; Tue, 12 Mar 2024 04:25:38 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id h3-20020adf9cc3000000b0033e73c58678sm8839238wre.15.2024.03.12.04.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 04:25:36 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 26B405F8E0; Tue, 12 Mar 2024 11:25:33 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710242737; x=1710847537; 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=CGMxfNWMqHxIajAfVs5LmcHHz96MvpgBL7/t14DrgrU=; b=nPjk5M14eWsVpzTAIWJseaIlvuGSrlh2LZUphkiZp9sgJhT71I1roCQFxuF3FTRiZ3 khrY8PEZlA2htMXQNn4RPCrUbxEXWCR6HFNay/87LX8iz9+PibOjs4LqRnYfLWboeo87 RhmnAyLd5hWHi1VqdfD3s7KqKpiBsxJn9OLMg57/ggDmEddMR9xJ88TlIGky9g3nSogO WNid3gi075TB3hWa8FO4CAsa7S1eflO0b9FaMQ7qqtefAUsMEiKeKnT1IZK2xH56Zu6+ cQbhgK9b88RD6PARaxJvXmMHNJ9lv2IXb/sCR/58bst7sxEw0AkN6/KCW+FE2Fdmlamr z0bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710242737; x=1710847537; 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=CGMxfNWMqHxIajAfVs5LmcHHz96MvpgBL7/t14DrgrU=; b=d7vI+83+shHyf/2bIiS/6u/V195AuLs6xfBDPPMgTXhwG8/1TkTUjMRL4hfoi19jyR 2bLGBp5/llyLxoYYryXUGTn21ri+68mskL/2umBXxabtityHiKZSmNGyxvJHSeimhbyh 2my+3vDVpF3ig1Vv32ZiJVCMvUjIAHXbW4OCxCrpA6+EK5ZktZPa7SBj5k5TqK/+4z7Z eVVmAUswv3Tc1pXJf+AETX3MIz0az2C59kb/iVU1ebO/QDq3Mdrne6xVbSt1lprN+bgo fuPXFnxzgJQ8omKpofwhIajdmt2/K6tgVFnKl8uT26hLWZ+Kx1DHvIPIR7pDokY7TmUa ztcQ== X-Gm-Message-State: AOJu0Yx62xYNOmXZGk0k2ktweT+/Rp+JppFoYVXgt+l9tRrHwP8TIllV 6bRGEBN9UhgCf8DRZJExHGpGM9stIPOlHA2xrPYQrh7hoqfvqfR9DlZ0d2HnHxo= X-Google-Smtp-Source: AGHT+IENTWigqwkP9Nfg7tJT8tfwwKXPRiyTsqMh/juct9RoNXoWCFvNIuyxuwLFcd4lo0v0rISn7Q== X-Received: by 2002:adf:cb8f:0:b0:33e:a626:4046 with SMTP id q15-20020adfcb8f000000b0033ea6264046mr1310811wrh.16.1710242736651; Tue, 12 Mar 2024 04:25:36 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Gustavo Romero , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Warner Losh , Kyle Evans , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laurent Vivier Subject: [PULL 5/8] gdbstub: Save target's siginfo Date: Tue, 12 Mar 2024 11:25:29 +0000 Message-Id: <20240312112532.1558319-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312112532.1558319-1-alex.bennee@linaro.org> References: <20240312112532.1558319-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x436.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710242800840100003 From: Gustavo Romero Save target's siginfo into gdbserver_state so it can be used later, for example, in any stub that requires the target's si_signo and si_code. This change affects only linux-user mode. Signed-off-by: Gustavo Romero Suggested-by: Richard Henderson Message-Id: <20240309030901.1726211-4-gustavo.romero@linaro.org> Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson diff --git a/include/gdbstub/user.h b/include/gdbstub/user.h index 4fc88f8a25..3b8358e3da 100644 --- a/include/gdbstub/user.h +++ b/include/gdbstub/user.h @@ -9,11 +9,15 @@ #ifndef GDBSTUB_USER_H #define GDBSTUB_USER_H =20 +#define MAX_SIGINFO_LENGTH 128 + /** * gdb_handlesig() - yield control to gdb * @cpu: CPU * @sig: if non-zero, the signal number which caused us to stop * @reason: stop reason for stop reply packet or NULL + * @siginfo: target-specific siginfo struct + * @siginfo_len: target-specific siginfo struct length * * This function yields control to gdb, when a user-mode-only target * needs to stop execution. If @sig is non-zero, then we will send a @@ -25,7 +29,7 @@ * or 0 if no signal should be delivered, ie the signal that caused * us to stop should be ignored. */ -int gdb_handlesig(CPUState *, int, const char *); +int gdb_handlesig(CPUState *, int, const char *, void *, int); =20 /** * gdb_signalled() - inform remote gdb of sig exit diff --git a/bsd-user/main.c b/bsd-user/main.c index 3dc285e5b7..01b313756e 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -606,7 +606,7 @@ int main(int argc, char **argv) =20 if (gdbstub) { gdbserver_start(gdbstub); - gdb_handlesig(cpu, 0); + gdb_handlesig(cpu, 0, NULL, NULL, 0); } cpu_loop(env); /* never exits */ diff --git a/bsd-user/signal.c b/bsd-user/signal.c index e9f80a06d3..2936eeb7a8 100644 --- a/bsd-user/signal.c +++ b/bsd-user/signal.c @@ -27,6 +27,9 @@ #include "hw/core/tcg-cpu-ops.h" #include "host-signal.h" =20 +/* target_siginfo_t must fit in gdbstub's siginfo save area. */ +QEMU_BUILD_BUG_ON(sizeof(target_siginfo_t) > MAX_SIGINFO_LENGTH); + static struct target_sigaction sigact_table[TARGET_NSIG]; static void host_signal_handler(int host_sig, siginfo_t *info, void *puc); static void target_to_host_sigset_internal(sigset_t *d, @@ -890,7 +893,7 @@ static void handle_pending_signal(CPUArchState *env, in= t sig, =20 k->pending =3D 0; =20 - sig =3D gdb_handlesig(cpu, sig); + sig =3D gdb_handlesig(cpu, sig, NULL, &k->info, sizeof(k->info)); if (!sig) { sa =3D NULL; handler =3D TARGET_SIG_IGN; diff --git a/gdbstub/user.c b/gdbstub/user.c index 520987fddc..cf693bfbc4 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -95,6 +95,8 @@ typedef struct { enum GDBForkState fork_state; int fork_sockets[2]; pid_t fork_peer_pid, fork_peer_tid; + uint8_t siginfo[MAX_SIGINFO_LENGTH]; + unsigned long siginfo_len; } GDBUserState; =20 static GDBUserState gdbserver_user_state; @@ -190,7 +192,8 @@ void gdb_qemu_exit(int code) exit(code); } =20 -int gdb_handlesig(CPUState *cpu, int sig, const char *reason) +int gdb_handlesig(CPUState *cpu, int sig, const char *reason, void *siginf= o, + int siginfo_len) { char buf[256]; int n; @@ -199,6 +202,18 @@ int gdb_handlesig(CPUState *cpu, int sig, const char *= reason) return sig; } =20 + if (siginfo) { + /* + * Save target-specific siginfo. + * + * siginfo size, i.e. siginfo_len, is asserted at compile-time to = fit in + * gdbserver_user_state.siginfo, usually in the source file calling + * gdb_handlesig. See, for instance, {linux,bsd}-user/signal.c. + */ + memcpy(gdbserver_user_state.siginfo, siginfo, siginfo_len); + gdbserver_user_state.siginfo_len =3D siginfo_len; + } + /* disable single step if it was enabled */ cpu_single_step(cpu, 0); tb_flush(cpu); @@ -746,7 +761,7 @@ void gdb_breakpoint_remove_all(CPUState *cs) void gdb_syscall_handling(const char *syscall_packet) { gdb_put_packet(syscall_packet); - gdb_handlesig(gdbserver_state.c_cpu, 0, NULL); + gdb_handlesig(gdbserver_state.c_cpu, 0, NULL, NULL, 0); } =20 static bool should_catch_syscall(int num) @@ -764,7 +779,7 @@ void gdb_syscall_entry(CPUState *cs, int num) { if (should_catch_syscall(num)) { g_autofree char *reason =3D g_strdup_printf("syscall_entry:%x;", n= um); - gdb_handlesig(cs, gdb_target_sigtrap(), reason); + gdb_handlesig(cs, gdb_target_sigtrap(), reason, NULL, 0); } } =20 @@ -772,7 +787,7 @@ void gdb_syscall_return(CPUState *cs, int num) { if (should_catch_syscall(num)) { g_autofree char *reason =3D g_strdup_printf("syscall_return:%x;", = num); - gdb_handlesig(cs, gdb_target_sigtrap(), reason); + gdb_handlesig(cs, gdb_target_sigtrap(), reason, NULL, 0); } } =20 diff --git a/linux-user/main.c b/linux-user/main.c index 55aa11c9b4..9277df2e9d 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -1018,7 +1018,7 @@ int main(int argc, char **argv, char **envp) gdbstub); exit(EXIT_FAILURE); } - gdb_handlesig(cpu, 0, NULL); + gdb_handlesig(cpu, 0, NULL, NULL, 0); } =20 #ifdef CONFIG_SEMIHOSTING diff --git a/linux-user/signal.c b/linux-user/signal.c index c769675e68..8355105dd7 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -34,6 +34,9 @@ #include "user/safe-syscall.h" #include "tcg/tcg.h" =20 +/* target_siginfo_t must fit in gdbstub's siginfo save area. */ +QEMU_BUILD_BUG_ON(sizeof(target_siginfo_t) > MAX_SIGINFO_LENGTH); + static struct target_sigaction sigact_table[TARGET_NSIG]; =20 static void host_signal_handler(int host_signum, siginfo_t *info, @@ -1186,7 +1189,7 @@ static void handle_pending_signal(CPUArchState *cpu_e= nv, int sig, */ tswap_siginfo(&k->info, &k->info); =20 - sig =3D gdb_handlesig(cpu, sig, NULL); + sig =3D gdb_handlesig(cpu, sig, NULL, &k->info, sizeof(k->info)); if (!sig) { sa =3D NULL; handler =3D TARGET_SIG_IGN; --=20 2.39.2 From nobody Sat May 11 06:51:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710242832; cv=none; d=zohomail.com; s=zohoarc; b=b8QJAqPic9vOukW0TxPSnf+4kehweAMI9sj/A+KNsfYFMXi5iEZzpMZR0oBEc6ybQbSE0ZDrdW54FoPt4IAm/9KAyX32O66GeK7uswcDTYJXcRHsUzINWOQTw6yqQNJlJmtRN0X84wDa2DhRs6IcrxcMU5lXvREo24DPNHQXvwc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710242832; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JghslLQsXVIk5PSECh3p0uuw1fQ6K0uFHf3q1DuTSXA=; b=O7Dfj7ZZJsgFUxOUlTjbtkILdTGs2rizge4oNf3CBJR1J0d2hRkRtAjzXaiH9qUEhRy2LxDlu6PRt6Vq/xW8y0ATruLYJoPQ8AFA0vD2sJkQe5Pvt2IWD/ErM+32O2a2KtPbZVW37N/tSUIG6tqOC6mPhSt5aAcXj2IZC4c0SAk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710242832154491.2248459408851; Tue, 12 Mar 2024 04:27:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk0GX-0002yU-3C; Tue, 12 Mar 2024 07:25:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk0GS-0002vy-Pt for qemu-devel@nongnu.org; Tue, 12 Mar 2024 07:25:48 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk0GL-0000lC-Qo for qemu-devel@nongnu.org; Tue, 12 Mar 2024 07:25:45 -0400 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-41329a665d8so15408825e9.2 for ; Tue, 12 Mar 2024 04:25:39 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id h12-20020a05600c350c00b0041312d21a35sm16982948wmq.7.2024.03.12.04.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 04:25:36 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 3F7C65F8E1; Tue, 12 Mar 2024 11:25:33 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710242738; x=1710847538; 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=JghslLQsXVIk5PSECh3p0uuw1fQ6K0uFHf3q1DuTSXA=; b=or6ziAC3VtY9LPM0xv/0n/RHsLCBK9ix7GVtYswtwLwYxje4QZeJ6w0VZ/Ui0XWBfJ r2huwQ8klCcAtwsuMv2utpWnOsb16EBIQ4ewvcNhJ1gOCkaYrskJg1blwE+SCN04HS64 wuE8OiT5uWuvRUIRzkIlGH3vbIPHtGNREqWxE8JQSnoFWgomjEjDywNzNXWE5g5qslmh Nxt9OS6y17AQRgc8dJt2sVUsR4wKCf9JFZ+IKJfcPWdFFMrGmioIrvX8qtS0an/r3bbu I+bvrsuoK9SFqws7Mj7rXmteiEgPdSPXgyfVoFBcgQHzhb5qlXIJ0IuWRasYhHisvrSE L3lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710242738; x=1710847538; 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=JghslLQsXVIk5PSECh3p0uuw1fQ6K0uFHf3q1DuTSXA=; b=wDjKcAIjb6r9KDqBpOifT1DjFDmSIzs9MYkyoq3ixrTImXG2+5dXzOD+fi5SJZCqAY d503inOCSq9S1yNvAhIFPFahuM9neQfO06xGpftei9CfhOVsnQf4n3AkCut7VQ48q+g4 PC0rilCs80tNHzQfV7StFrDiE63BQSUAlMdML+F2mCEdc3icEGqKBYX9Oid5OgcUljvY j/fGxjdsjmL6i0usQUjPS8QDprHLoml/nNv1YvdXKxh09WsqZANPaHPB7K0YjxOhcU3v OMoAadmHKXnhgd/H+uUh/H4JbYup3pyPGAJQeKsknmNK4K3fCg2ggZCTdNysa3k31iaf oT5w== X-Gm-Message-State: AOJu0YzMd+LCsqNAN3DwdvyqYpQK6ZUNq2IiUmdIYXc5LGMYe9/wzWE2 m3KwhqbKNFIwRn4VL+0qDn5qo+Okk5wmPjWhrnriFPVvuRdRrYmXOU3sly2xOcE= X-Google-Smtp-Source: AGHT+IHUO8aCL1zgoaFD111TltxI0L6mWf0P3hu/YoxwiS6z+MbuhMkDMJUt+Kan4sWx4EHVftKoNw== X-Received: by 2002:a05:600c:1f81:b0:413:1dcd:b39 with SMTP id je1-20020a05600c1f8100b004131dcd0b39mr6894975wmb.38.1710242738307; Tue, 12 Mar 2024 04:25:38 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Gustavo Romero , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 6/8] gdbstub: Add Xfer:siginfo:read stub Date: Tue, 12 Mar 2024 11:25:30 +0000 Message-Id: <20240312112532.1558319-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312112532.1558319-1-alex.bennee@linaro.org> References: <20240312112532.1558319-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710242832872100001 From: Gustavo Romero Add stub to handle Xfer:siginfo:read packet query that requests the machine's siginfo data. This is used when GDB user executes 'print $_siginfo' and when the machine stops due to a signal, for instance, on SIGSEGV. The information in siginfo allows GDB to determiner further details on the signal, like the fault address/insn when the SIGSEGV is caught. Signed-off-by: Gustavo Romero Message-Id: <20240309030901.1726211-5-gustavo.romero@linaro.org> Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson diff --git a/gdbstub/internals.h b/gdbstub/internals.h index b472459838..e83b179920 100644 --- a/gdbstub/internals.h +++ b/gdbstub/internals.h @@ -190,6 +190,7 @@ typedef union GdbCmdVariant { void gdb_handle_query_rcmd(GArray *params, void *user_ctx); /* softmmu */ void gdb_handle_query_offsets(GArray *params, void *user_ctx); /* user */ void gdb_handle_query_xfer_auxv(GArray *params, void *user_ctx); /*user */ +void gdb_handle_query_xfer_siginfo(GArray *params, void *user_ctx); /*user= */ void gdb_handle_v_file_open(GArray *params, void *user_ctx); /* user */ void gdb_handle_v_file_close(GArray *params, void *user_ctx); /* user */ void gdb_handle_v_file_pread(GArray *params, void *user_ctx); /* user */ diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index 17efcae0d0..9c23d44baf 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -1664,6 +1664,8 @@ static void handle_query_supported(GArray *params, vo= id *user_ctx) g_string_append(gdbserver_state.str_buf, ";qXfer:auxv:read+"); } g_string_append(gdbserver_state.str_buf, ";QCatchSyscalls+"); + + g_string_append(gdbserver_state.str_buf, ";qXfer:siginfo:read+"); #endif g_string_append(gdbserver_state.str_buf, ";qXfer:exec-file:read+"); #endif @@ -1818,6 +1820,12 @@ static const GdbCmdParseEntry gdb_gen_query_table[] = =3D { .cmd_startswith =3D 1, .schema =3D "l,l0" }, + { + .handler =3D gdb_handle_query_xfer_siginfo, + .cmd =3D "Xfer:siginfo:read::", + .cmd_startswith =3D 1, + .schema =3D "l,l0" + }, #endif { .handler =3D gdb_handle_query_xfer_exec_file, diff --git a/gdbstub/user.c b/gdbstub/user.c index cf693bfbc4..2005f3312b 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -852,3 +852,26 @@ void gdb_handle_set_catch_syscalls(GArray *params, voi= d *user_ctx) err: gdb_put_packet("E00"); } + +void gdb_handle_query_xfer_siginfo(GArray *params, void *user_ctx) +{ + unsigned long offset, len; + uint8_t *siginfo_offset; + + offset =3D get_param(params, 0)->val_ul; + len =3D get_param(params, 1)->val_ul; + + if (offset + len > gdbserver_user_state.siginfo_len) { + /* Invalid offset and/or requested length. */ + gdb_put_packet("E01"); + return; + } + + siginfo_offset =3D (uint8_t *)gdbserver_user_state.siginfo + offset; + + /* Reply */ + g_string_assign(gdbserver_state.str_buf, "l"); + gdb_memtox(gdbserver_state.str_buf, (const char *)siginfo_offset, len); + gdb_put_packet_binary(gdbserver_state.str_buf->str, + gdbserver_state.str_buf->len, true); +} --=20 2.39.2 From nobody Sat May 11 06:51:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710242776; cv=none; d=zohomail.com; s=zohoarc; b=LbFhbyOsFiX8Enn8n8oxSqyIgxmscC2P2nICNE4SEkKun5rWZe/vRThBMZdsTCCwdUnsYvLs7+U2LvqtS3oZ2vv3LiSpex4DQJY06RiRu9XJyv0BpEE/lINCZGK3CKyhHRtx37Fexy2/5U/x4cwQl12aAlZHUUwPEYKm1AlpRVM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710242776; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RL1O4Lp3d7j6GCqnIwmXbv0EOOi1576XfsojTQsANsw=; b=TMEtUtxEYAhHaaGajtg/U1NkpF47SaT9tHMH6iL/8vOOGJ7qCo+/YuHV91zf5pedeUbl19ZkPQMSUwmJf1YPuD32BvxGqQOefBp+aKmieKaybGrBo7xI4r3ALV/KdSntT+rFjoblXPD59GFOXr7idaUlhPgWAL5+XV5/BKnzlTs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710242776351665.4582593069832; Tue, 12 Mar 2024 04:26:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk0GU-0002x8-UI; Tue, 12 Mar 2024 07:25:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk0GQ-0002vD-Hv for qemu-devel@nongnu.org; Tue, 12 Mar 2024 07:25:47 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk0GI-0000jX-IE for qemu-devel@nongnu.org; Tue, 12 Mar 2024 07:25:44 -0400 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-33e92b3b5c9so2538711f8f.2 for ; Tue, 12 Mar 2024 04:25:37 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id c17-20020a5d5291000000b0033d2ae84fafsm8773498wrv.52.2024.03.12.04.25.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 04:25:36 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 54C845F8E3; Tue, 12 Mar 2024 11:25:33 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710242737; x=1710847537; 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=RL1O4Lp3d7j6GCqnIwmXbv0EOOi1576XfsojTQsANsw=; b=HKxvVWlioJ9pPdmhf/k+1CdsFVqqAOIJBFp7CtYVJPSW4H0U2WxNUlHaKkHf0VOE8Y QuF7MuX81VWym4dB5+TC61DQBArGtNE23oReByB/qHu7urQXQnS92gLV1fM2xKo3dQaX 0042pLMh494tkDI2wIIVvn5I2W4uZoYeZeF5XbjUdHk5r0KKJLXxfGdtl5I7LZJlTvm9 7PRSwGiwYlcRKYqH4RsCCzpT0VucS1xqgnS1MTy1vhoWsjFoyEVIFpePGcTgyM36W/Ec Jl9ZzsFa8xhFHfOD4GB1wmNIPrfpU3mC0ouRCQ6gpx03ZEcICtj7dSQ0x3HeK32Brcl3 PIhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710242737; x=1710847537; 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=RL1O4Lp3d7j6GCqnIwmXbv0EOOi1576XfsojTQsANsw=; b=I+zmX8eCgVvFuqiUR4s7C5IOlySPf1PMf/zh4bU4mM7BNxSXX4dNmuErWeGXeD/Duy 8AF8OMTmmgcWNRn5gPXLeFlQi5Qj4AacslBCfXwIWFdSSr2Oqweo5jIVhh0baOxklWmG Wtmujd7kWkUpuIxDu+pPQOT0xybHo5Hsv4T+fFV7AW3oapZu453a1rNQci9EBMvzSpWB xoFmzimLqNc5R/V3CNSQrEbAkb7C6jyQgJiFEkBpKILSIUGgKj+c7cIzaxQOkYz5MzWm 3FxzXQl7lEz4g5/NpW5YZHlNlQUXx2wCGfvpPli1cGg4OEjrc3MHjGkgOIu6v2GlQk4u YpYw== X-Gm-Message-State: AOJu0YwFzhJiRj8936SvlYW5//LTzaJNXv9cZfM/1yms9TpOkmQAXpXW Fs/MBtiezGgDaBFdgu42OeNcnHqHxWS4k7++Z47KeA5P2OMBQq9vFBZcLa/sSOw= X-Google-Smtp-Source: AGHT+IE8xXIFL8vEh61SET/opvgR0DrA+hFVa8LcUkZAzhnRuYfDO1kRRSlACIAxRiRkSkSPiObXfQ== X-Received: by 2002:a5d:464b:0:b0:33e:9f81:4a3f with SMTP id j11-20020a5d464b000000b0033e9f814a3fmr2348707wrs.0.1710242736817; Tue, 12 Mar 2024 04:25:36 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Gustavo Romero , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 7/8] tests/tcg: Add multiarch test for Xfer:siginfo:read stub Date: Tue, 12 Mar 2024 11:25:31 +0000 Message-Id: <20240312112532.1558319-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312112532.1558319-1-alex.bennee@linaro.org> References: <20240312112532.1558319-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42f.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710242776639100003 From: Gustavo Romero Add multiarch test for testing if Xfer:siginfo:read query is properly handled by gdbstub. Signed-off-by: Gustavo Romero Reviewed-by: Richard Henderson Message-Id: <20240309030901.1726211-6-gustavo.romero@linaro.org> Signed-off-by: Alex Benn=C3=A9e diff --git a/tests/tcg/multiarch/segfault.c b/tests/tcg/multiarch/segfault.c new file mode 100644 index 0000000000..e6c8ff31ca --- /dev/null +++ b/tests/tcg/multiarch/segfault.c @@ -0,0 +1,14 @@ +#include +#include + +/* Cause a segfault for testing purposes. */ + +int main(int argc, char *argv[]) +{ + int *ptr =3D (void *)0xdeadbeef; + + if (argc =3D=3D 2 && strcmp(argv[1], "-s") =3D=3D 0) { + /* Cause segfault. */ + printf("%d\n", *ptr); + } +} diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Make= file.target index 979a0dd1bc..5e3391ec9d 100644 --- a/tests/tcg/multiarch/Makefile.target +++ b/tests/tcg/multiarch/Makefile.target @@ -71,6 +71,13 @@ run-gdbstub-qxfer-auxv-read: sha1 --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \ basic gdbstub qXfer:auxv:read support) =20 +run-gdbstub-qxfer-siginfo-read: segfault + $(call run-test, $@, $(GDB_SCRIPT) \ + --gdb $(GDB) \ + --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ + --bin "$< -s" --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-siginfo-read.py= , \ + basic gdbstub qXfer:siginfo:read support) + run-gdbstub-proc-mappings: sha1 $(call run-test, $@, $(GDB_SCRIPT) \ --gdb $(GDB) \ @@ -128,7 +135,8 @@ EXTRA_RUNS +=3D run-gdbstub-sha1 run-gdbstub-qxfer-auxv= -read \ run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint \ run-gdbstub-registers run-gdbstub-prot-none \ run-gdbstub-catch-syscalls run-gdbstub-follow-fork-mode-child \ - run-gdbstub-follow-fork-mode-parent + run-gdbstub-follow-fork-mode-parent \ + run-gdbstub-qxfer-siginfo-read =20 # ARM Compatible Semi Hosting Tests # diff --git a/tests/tcg/multiarch/gdbstub/test-qxfer-siginfo-read.py b/tests= /tcg/multiarch/gdbstub/test-qxfer-siginfo-read.py new file mode 100644 index 0000000000..862596b07a --- /dev/null +++ b/tests/tcg/multiarch/gdbstub/test-qxfer-siginfo-read.py @@ -0,0 +1,26 @@ +from __future__ import print_function +# +# Test gdbstub Xfer:siginfo:read stub. +# +# The test runs a binary that causes a SIGSEGV and then looks for addition= al +# info about the signal through printing GDB's '$_siginfo' special variabl= e, +# which sends a Xfer:siginfo:read query to the gdbstub. +# +# The binary causes a SIGSEGV at dereferencing a pointer with value 0xdead= beef, +# so the test looks for and checks if this address is correctly reported b= y the +# gdbstub. +# +# This is launched via tests/guest-debug/run-test.py +# + +import gdb +from test_gdbstub import main, report + +def run_test(): + "Run through the test" + + gdb.execute("continue", False, True) + resp =3D gdb.execute("print/x $_siginfo", False, True) + report(resp.find("si_addr =3D 0xdeadbeef"), "Found fault address.") + +main(run_test) --=20 2.39.2 From nobody Sat May 11 06:51:22 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1710242777; cv=none; d=zohomail.com; s=zohoarc; b=Rg8xWlFvCbt1PCq5hOj4CmQZvsCWl/v+UDvgfWiBbiCw9pmHiYMlhW3w7YU2SDTQqvIb57pV78w5DyDJbwW7EoNPMTg7O30tfahlf/SKJEJxNTtGcRogf8G/zzs4slWUJBrF0lmemGZLYLn+Tjfnb7tEncnRQkV1wLJCHIh2wjs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1710242777; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cLoGh9BJ5sW1PuxoNirl7iXBfbZ2yLuS6AwQQm/Ji9Q=; b=SRWu77y4qM33KEpDyTOjgZrIs8NNkV//p53sit0ymZBSSkPn9RrxEsgC6XzkSMowrVmuHNOFvr8BM/+oMaACSr0ROsRZjIKFML7fVxuh726x0gVtjlQ22sy+N1DlWfkDPL5jjwZ/aki5V9pYxvYtdplJxqWe1aRfOqt+Eg6TRl4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1710242777822937.956698318043; Tue, 12 Mar 2024 04:26:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rk0Ga-0003AV-P6; Tue, 12 Mar 2024 07:25:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rk0GS-0002vn-24 for qemu-devel@nongnu.org; Tue, 12 Mar 2024 07:25:48 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rk0GL-0000l1-8k for qemu-devel@nongnu.org; Tue, 12 Mar 2024 07:25:45 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-413318a3a29so5636875e9.2 for ; Tue, 12 Mar 2024 04:25:39 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id h14-20020a056000000e00b0033e7603987dsm8839153wrx.12.2024.03.12.04.25.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 04:25:36 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 69D6E5F8E5; Tue, 12 Mar 2024 11:25:33 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710242738; x=1710847538; 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=cLoGh9BJ5sW1PuxoNirl7iXBfbZ2yLuS6AwQQm/Ji9Q=; b=Q5QWEBp35t/QYKpigLPo6ygSM3kELfkJOerON98VNMp2JpTbYy97ahaHbLu7QQcOTG tMNHnbtcvuoqD+bKf3++T7cG1ClHwFUoemCXLvomayCmJg2nvRS/rUV7hqV9huJk9WCJ aJ+IVX5arGtn+4b3NaT66GxxAniHVYlxWT6SY8QByjERVVpc0QPu4t7VSB4rW5+P4Zn/ 2XiZRmDIy8HOOQSPjnn5lV17tIL7ppDUyD2a9pChP9VUtsQdlKYqe6pHhllK3t3OIMNa 4uWBhNVuTi24sUr/dj24GHjR6CCwkvFfhrNbUr+WXUQboumCSMAEtRQEccmD+XqhGXOD sgqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710242738; x=1710847538; 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=cLoGh9BJ5sW1PuxoNirl7iXBfbZ2yLuS6AwQQm/Ji9Q=; b=QbZMN1ug1hkG8roqh4AeYGwkHWhjLsGnDqh/QHb0YbDeDnXaegHVOg6U0m6TfY4kng khsNM9wwmeOppbfd/LEOW9RvhTSKx6Mg3KrJ1L9ydWc5Zn9+gu/s08eUsnKUQ2YyO8xU 1kyZ4sQ/uNVrXoGynjEGfKeM40NjZBF0pi9H7Mssl3XgYx/Qb79eQHhcRYom0zyjeSxU vFDQZJ7bJ4QGUlnkFJ+CjBWhUX7tBqVNwsUzQ7x5g9EgIrY4PhEq+k1zMkis5Et2NsTZ I2GtA5xLzc4DBfmmQIwhceBIKkv5eEevG4cXLWGrOqwL0VwCEnZyvMkodKCo20r4kzvj SpjQ== X-Gm-Message-State: AOJu0YyaDd9Hy6+4MXEBVuZ9PUAm1Xu6Zfh9GpPDKO4A1qTvGfR+EnZ7 xtRNkE6rqtnfnIVHCb7p4WSBRuqWEsyKDX09bI7v1qkmmc3zErFwGu5VwoFs0zeSfFmIniDcAnd N X-Google-Smtp-Source: AGHT+IHY0HV1ZsSPQmEV5JTOfE++edIy9sOGWE6d7NP6Hg9qXQa5yy9OAp9VqjH4Uq41xfZvLlN+4A== X-Received: by 2002:a5d:6611:0:b0:33d:679d:a033 with SMTP id n17-20020a5d6611000000b0033d679da033mr6132756wru.36.1710242738088; Tue, 12 Mar 2024 04:25:38 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 8/8] gdbstub: Fix double close() of the follow-fork-mode socket Date: Tue, 12 Mar 2024 11:25:32 +0000 Message-Id: <20240312112532.1558319-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240312112532.1558319-1-alex.bennee@linaro.org> References: <20240312112532.1558319-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1710242778602100009 From: Ilya Leoshkevich When the terminal GDB_FORK_ENABLED state is reached, the coordination socket is not needed anymore and is therefore closed. However, if there is a communication error between QEMU gdbstub and GDB, the generic error handling code attempts to close it again. Fix by closing it later - before returning - instead. Fixes: Coverity CID 1539966 Fixes: d547e711a8a5 ("gdbstub: Implement follow-fork-mode child") Signed-off-by: Ilya Leoshkevich Signed-off-by: Alex Benn=C3=A9e Message-Id: <20240312001813.13720-1-iii@linux.ibm.com> diff --git a/gdbstub/user.c b/gdbstub/user.c index 2005f3312b..edeb72efeb 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -517,6 +517,7 @@ void gdbserver_fork_end(CPUState *cpu, pid_t pid) switch (gdbserver_user_state.fork_state) { case GDB_FORK_ENABLED: if (gdbserver_user_state.running_state) { + close(fd); return; } QEMU_FALLTHROUGH; @@ -542,7 +543,6 @@ void gdbserver_fork_end(CPUState *cpu, pid_t pid) gdbserver_user_state.fork_state =3D GDB_FORK_ACTIVE; break; case GDB_FORK_ENABLE: - close(fd); gdbserver_user_state.fork_state =3D GDB_FORK_ENABLED; break; case GDB_FORK_DISABLE: @@ -557,7 +557,6 @@ void gdbserver_fork_end(CPUState *cpu, pid_t pid) if (write(fd, &b, 1) !=3D 1) { goto fail; } - close(fd); gdbserver_user_state.fork_state =3D GDB_FORK_ENABLED; break; case GDB_FORK_DISABLING: --=20 2.39.2