From patchwork Tue Mar 12 11:25:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 779697 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1965892wrt; Tue, 12 Mar 2024 04:26:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUBzvvmmHOtTSAYvzoOkIOgXR9nSgRwgkgk+DpJuSkqVzu1Toa8qf0w1zym+rkiKLcBs0MVHrkSGB9Tj7jEEXD6 X-Google-Smtp-Source: AGHT+IEUQbS0k3I/yGwnDBdZA2M6idDPJDOuWwlWzZMLZShIfRqQuf92cYb9c6BXOIkduFPysA/X X-Received: by 2002:a05:622a:14cd:b0:42e:fd4d:7f07 with SMTP id u13-20020a05622a14cd00b0042efd4d7f07mr12195905qtx.28.1710242766810; Tue, 12 Mar 2024 04:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710242766; cv=none; d=google.com; s=arc-20160816; b=JXzPhVXcqu8Imz4xCP9ndLWOoxVWvfetjSs5rdJwxLpVRt3YsXhEg6zXMci8NT1X5s 8Yh7X0BAxMpLEik+v8/oYq2esqRnZz8xCUsecLeCbBxLvD97/jPi1s72DUwU7B1P61wD jpsmhevKR/8n3f+npHxPT6eyESDa7rGCkyTP0SHkp6G8NZqlTpT9ciNW4dtQxAE51/sH 8/zpJrqN4sc7gAttZ2ZYuRlIV2WBthmKioZU5UohdDoie5lj8N+VAy32JYVuqIB5+Zg3 yCjHZFIli34Xwu8DWTgWQd4pd7LKje4tlPZqfLYEZxeUjgAck6Dw7zedND+LS2jD5CTa BBTQ== 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=lFd08eLrd4gGZuM0kNWdC4d2ia0nfqfy86pon6xWh1k=; fh=TrGV/XhoKARy9aKLjpwQFrkfS1d724MvzoMUUsxIsWc=; b=MEoKh4Ol0TdDvO1ZBVFKwLdQXKWVMSYxyaU3ZiRscpQlE/l/nxCJuoQNUeniriBDmh wTEUFlkaE/CkDO5N7oVKl5hX5HRGf9WHzHqtOu0HU9zkK8Ry6lmzuyE3LUBKe/BjxqHO aT7rQgP9QG+lKIE7ty9Q7eYLp5NfgiHwSmmjjMPHQ9SkNH2qXpclL5J8DmRHwqVdPI1L eII3smVsZOhlrO/Uq7UPN3kIoGjj1mnSYXmo82PQ8NRK9K4nrYHJEFfpFnEJe8pzawBM vTM0vCsPIR2LJPhbMpor6Z6NXc5odC6pq//NqA83CWULsn/RYUgILcDEC6OafT2O5rom ciVw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bcwW9czW; 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 c14-20020a05622a058e00b0042eee469474si7203012qtb.109.2024.03.12.04.26.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 04:26:06 -0700 (PDT) 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=bcwW9czW; 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 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) 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-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) 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) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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ée 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 output # 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 in 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=blob:none --filter=tree:0 --no-tags --prune --quiet interruptible: true diff --git a/.gitlab-ci.d/buildtest-template.yml b/.gitlab-ci.d/buildtest-template.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="$CCACHE_BASEDIR/ccache" - export CCACHE_MAXSIZE="500M" - export PATH="$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="$(sed 's/\([0-9.]*\)\.[0-9]*/v\1.0/' VERSION)" - 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 From patchwork Tue Mar 12 11:25:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 779701 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1966046wrt; Tue, 12 Mar 2024 04:26:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWxBPNOKClM117LoLN2uHdnfg15c6HGv0S2Su5cp3YuA2/dkKzx96BEaXdpcwKaZTEd52zac95ByAwti7reMH9C X-Google-Smtp-Source: AGHT+IEuRsRhZTPbj9lUKyw9KAKUCPYBUSprtRXAOlhfHF1uqjTDtqsi5sBtVFXKev4u9PVeDwF2 X-Received: by 2002:a25:b19c:0:b0:dcc:eb38:199c with SMTP id h28-20020a25b19c000000b00dcceb38199cmr6887678ybj.56.1710242789301; Tue, 12 Mar 2024 04:26:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710242789; cv=none; d=google.com; s=arc-20160816; b=C42+IMzy+ICic9Ejh79QnRcyv/z29ET1HQjUxq4K9Ua7QnCPKpFm4ofRD1qPvKjcXo QsSLn2V6zgGnibXAI8LZrn7FAY/Yi7uW130GdAF/YZ1TWTpN0lNxrfSZ9ikbJUSjWAlW Skc2ZOVf+yXCW7dC7H3O+WS+PBGxOe0/bLAku0FdgvWwJRqSNkEj8ESFmSELm5UI3Ubs LgLCRFtUqY8vWHG7qIZ8x9vGef3x+1dti/lHLGe8huH4LhdDtRFCMiFp6g3zEMj7+4kT BudPYMEtN/hdB8sWHANYtaPSr2LqJAZeAanl+pWeOlRpELRUmaphN3Gp5Yfgfarop2hD 4L6w== 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=likgvKugk4b8t9l89CQl3BfsUjLIPBB3WZoVAljees8=; fh=RpAOmVLaCZgIyQA8/VZLEAQulaOhzhFzpSYSXzVkKMs=; b=x0DJg/ktu/OEY7626NOPovyk6Uk6kMrfKtAy+sfThml+h172mkvoGc6F3JtwsG+Ekh GqVnl9oGGYzYeSOMzobkeTQ61IsKn+FLZ3EDknX/Qu99NTdEqPm23xuFK7JbroMZajvW w+PXb8QGdw62rKubfY33QacmBG7yBpGcznsQp7k5M6QLfYX+0GhoFAx6eX0fUnqU1kDC kWtLn2Fm6IgMQL7qFOmL6VKDjQ7/L2GTQCFt/gRgEQSbVDEv/eYQO2ntXQNkmF7G08xd XRlvrZ7u0ZRBtsmO2cQ97D2/+ym5PnI2FtL7ybbw+Ds0bk4iDY2VL1FpmJZUtFlYCYpc auGw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DW08WxMF; 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 t29-20020a05622a181d00b0042f309dc417si7546354qtc.629.2024.03.12.04.26.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 04:26:29 -0700 (PDT) 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=DW08WxMF; 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 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) 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-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) 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) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Richard Henderson , Gustavo Romero , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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ée 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="build QEMU from source in guest") parser.add_argument("--build-target", - help="QEMU build target", default="check") + help="QEMU build target", default="all check") parser.add_argument("--build-path", default=None, help="Path of build directory, "\ "for using build tree QEMU binary. ") From patchwork Tue Mar 12 11:25:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 779698 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1965965wrt; Tue, 12 Mar 2024 04:26:14 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVBr2uhERLuH7Wv6RoMsyr5Igpj018M6c1w0IJdmQL7CJPgUJCrIImt0xhjbSwzl9gkjSGoOjkfufxx17+/X5tp X-Google-Smtp-Source: AGHT+IEIHlzxmmrtW6r9fnpS7HTjaR/smbu4Zdm/ZRVb2xoSk0M3Nxs5Vl/B0xATZxlICxde7RTT X-Received: by 2002:a05:620a:4404:b0:788:220e:3989 with SMTP id v4-20020a05620a440400b00788220e3989mr13111533qkp.2.1710242774236; Tue, 12 Mar 2024 04:26:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710242774; cv=none; d=google.com; s=arc-20160816; b=m5ROsi5TventZ+ZblScacYuyzNaSooQeTKFtBOsWR5Mp/i+8NMu+lrc4UwghUebN09 pwk2AJYQfIzXPnXQN2aLYxJ4Gtq9x7K67dHs1d95jfMT6S621C0cVhJdHt9Etnfq3kp9 UDBMZOw/ZR9gCmArAHGMDoraKgSY953ug+cHIBUUaAvet0o8xGsVeCVUsGqimtbHcJLC 7+ED9rMeAKDk0ZT2X4YJlQuUshHYn/plI6zZ0Hb7dXhQQluMU70sbeZ5lmc1hnOb79+p 2CwDn5VQAbTEJZgq8MGdPOSHyY12BazCqSaY+qsnnKyB9EVji8+OQAiWaSzRDefQrvdC 0IdQ== 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=T/TnnwpHa6+cyA8uGT7QNYUXfL4ZfkLpAJU45+MsrCA=; fh=s9oN5K3fNlkKfSdYq8lE2fKkcy1DkuYP8+pBMjoX7x0=; b=P50E5ERmnDvpEVpdhKxz8O2vld22x3MQ+Qo8xi1UrEXsNLqazdK8LH8BvRKr9JC9Lp 6fb2mBNynrFFb7PS3Ts/yANEfYTmyocqlm7GLpJgSC+hEzxP9Z5RJ3t6zT2X9eGEvl2L VH/cEXPn4Y660fxlm/kBmF0MEdPTr0p1o77TVbR2jcIOSeV+sEdYKcGkZeai0sJud63B utoJaskjT9JyluGw+aupEmsavgqAXH54z2+5xzIfPJ2c+q45y6eoM1d0sdY5dvzQx7nK zC8UYLcQaiwc5ofuiMmye3Hcs1XurmANXVnCrg4ifiGNSiE7J0dMZ5TnV/zsxIzLeSPc ywDQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n4uJV1Yi; 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 yf21-20020a05620a3bd500b007885eb686bfsi6737838qkn.785.2024.03.12.04.26.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 04:26:14 -0700 (PDT) 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=n4uJV1Yi; 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 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) 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-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) 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) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Gustavo Romero , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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ée Reviewed-by: Richard Henderson Message-Id: <20240309030901.1726211-2-gustavo.romero@linaro.org> Signed-off-by: Alex Bennée 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 /** - * 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 *); /** * 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); } -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); } 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 = g_strdup_printf("syscall_entry:%x;", num); - gdb_handlesig_reason(cs, gdb_target_sigtrap(), reason); + gdb_handlesig(cs, gdb_target_sigtrap(), reason); } } @@ -772,7 +772,7 @@ void gdb_syscall_return(CPUState *cs, int num) { if (should_catch_syscall(num)) { g_autofree char *reason = g_strdup_printf("syscall_return:%x;", num); - gdb_handlesig_reason(cs, gdb_target_sigtrap(), reason); + gdb_handlesig(cs, gdb_target_sigtrap(), reason); } } 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); } #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_env, int sig, /* dequeue signal */ k->pending = 0; - sig = gdb_handlesig(cpu, sig); + sig = gdb_handlesig(cpu, sig, NULL); if (!sig) { sa = NULL; handler = TARGET_SIG_IGN; From patchwork Tue Mar 12 11:25:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 779702 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1966091wrt; Tue, 12 Mar 2024 04:26:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXjWWYhA4G0c8/dBK4nxF7jUjIKfz0msefnvGNyHI/oKufxHByTU1m1Cfg2F130nnR17DFYhZvt5KKa6SA8X8ja X-Google-Smtp-Source: AGHT+IGYFkWhZz5Bmw0AlujwFYpmohHFvB/BjYP4vY0sNDvtsLB43fpy2AwfpqA10JjENdvMe2UD X-Received: by 2002:a0c:e286:0:b0:690:bf98:cdc1 with SMTP id r6-20020a0ce286000000b00690bf98cdc1mr8916278qvl.15.1710242795748; Tue, 12 Mar 2024 04:26:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710242795; cv=none; d=google.com; s=arc-20160816; b=UAulpKydjB2UuHCvsXZytzOtKG92m/GOfxdjb3kQdm+yrbbpu7vq37USGWHnON8nxg NJHe22aRQwHKQkQgfjTwpNmSyk6BdhuSJIvqa9jVj5fJ8uI+I5XiQPX+D7/3tuQ6YGF9 rj5H9WFLFQGC5PR4Z5XD/GrIman07rb2KGdT5cFzbtNuUC8T6oibo9vBrASK/9JR0Jr2 OR+ys41dTZBw0yELUgSpwy5DWKDVjqbu4GjefA2NqnlVxIu5fgwAPXAFBTWwOdeW3Mht Rkj7kbumKmRXnUcKqxIPmeZA1xOE+YZlNXCpJuIt5qfXN6oVNAsYZD3yPzsYHCsLTlFR 0h1Q== 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=w+xs9VKQ31Vzn5Jc/bXAKp8ECjk5CZR3EsmvuC0rZMY=; fh=/fJbGKQYBtcvfOSHcc8wYN0eyXE7fDPBEB8MBBz9/BQ=; b=SKd5JZvTkfdC9SXl69t0YmTriJVsTEpyfyIErbgWrTyUcEErkb1vNDOjdR4/I2+jFQ BFEo2XgQMC3oFO75rJNumjmcqC+YPScYzA07n+9pzUt6GYzRdiTY3+hwq/+wHGoxSSk6 lDRXJqPop1wJKcPCMYEnAmQn4pAe6pjtNvGuYpyVBR9QCYu+64ipiHsOCh+j4NOQ2MFy 5WTpD6v3FO5qBjpCngo8Xw8Fk0oHTRZmeXWqlpnLLOLCfUpq+JcVGX132Z7w7OOXPW0r vMsNSlSXsvOeBp4WY1jCWpyYN67+EgbvDCQBxqej/8kxFP27XiQiBelOfevQSsK4JbUs o62Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JWOLMqFp; 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 t15-20020a05621421af00b00690b92e28ecsi7194815qvc.307.2024.03.12.04.26.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 04:26:35 -0700 (PDT) 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=JWOLMqFp; 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 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) 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-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) 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) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Gustavo Romero , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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ée 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); if (info) { - tswap_siginfo(&frame->info, info); + frame->info = *info; env->xregs[1] = frame_addr + offsetof(struct target_rt_sigframe, info); env->xregs[2] = 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 *ka, goto give_sigsegv; } - tswap_siginfo(&frame->info, info); + frame->info = *info; __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, info_addr = frame_addr + offsetof(struct rt_sigframe, info); uc_addr = frame_addr + offsetof(struct rt_sigframe, sig.uc); - tswap_siginfo(&frame->info, info); + frame->info = *info; setup_sigframe(&frame->sig.uc, set, env); 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 *ka, } setup_ucontext(&frame->uc, env, set); - tswap_siginfo(&frame->info, info); + frame->info = *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 *ka, goto give_sigsegv; } - tswap_siginfo(&frame->info, info); + frame->info = *info; frame->uc.tuc_flags = 0; frame->uc.tuc_link = 0; 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)); - for(i = 1; i < TARGET_NSIG_WORDS; i++) { + for (i = 1; i < TARGET_NSIG_WORDS; i++) { __put_user(set->sig[i], &frame->extramask[i - 1]); } @@ -490,7 +490,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, __put_user(addr, &frame->puc); #endif if (ka->sa_flags & TARGET_SA_SIGINFO) { - tswap_siginfo(&frame->info, info); + frame->info = *info; } /* Create the ucontext. */ @@ -504,7 +504,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, setup_sigcontext(&frame->uc.tuc_mcontext, &frame->fpstate, env, set->sig[0], frame_addr + offsetof(struct rt_sigframe, fpstate)); - for(i = 0; i < TARGET_NSIG_WORDS; i++) { + for (i = 0; i < TARGET_NSIG_WORDS; i++) { __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]); } diff --git a/linux-user/loongarch64/signal.c b/linux-user/loongarch64/signal.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 *ka, extctx.end.haddr = (void *)frame + (extctx.end.gaddr - frame_addr); } - tswap_siginfo(&frame->rs_info, info); + frame->rs_info = *info; __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 *ka, uc_addr = frame_addr + offsetof(struct target_rt_sigframe, uc); __put_user(uc_addr, &frame->puc); - tswap_siginfo(&frame->info, info); + frame->info = *info; /* Create the ucontext */ @@ -307,7 +307,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka, if (err) goto give_sigsegv; - for(i = 0; i < TARGET_NSIG_WORDS; i++) { + for (i = 0; i < TARGET_NSIG_WORDS; i++) { __put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]); } 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 *ka, return; } - tswap_siginfo(&frame->info, info); + frame->info = *info; __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 *ka, goto give_sigsegv; } - tswap_siginfo(&frame->rs_info, info); + frame->rs_info = *info; __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 *ka, setup_sigcontext(env, &frame->rs_uc.tuc_mcontext); - for(i = 0; i < TARGET_NSIG_WORDS; i++) { + for (i = 0; i < TARGET_NSIG_WORDS; i++) { __put_user(set->sig[i], &frame->rs_uc.tuc_sigmask.sig[i]); } 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 *ka, return; } - tswap_siginfo(&frame->info, info); + frame->info = *info; /* 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 *ka, } if (ka->sa_flags & SA_SIGINFO) { - tswap_siginfo(&frame->info, info); + frame->info = *info; } __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 *ka, if (!lock_user_struct(VERIFY_WRITE, rt_sf, rt_sf_addr, 1)) goto sigsegv; - tswap_siginfo(&rt_sf->info, info); + rt_sf->info = *info; __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 *ka, __put_user(h2g (&rt_sf->uc.tuc_mcontext), &rt_sf->uc.tuc_regs); #endif - for(i = 0; i < TARGET_NSIG_WORDS; i++) { + for (i = 0; i < TARGET_NSIG_WORDS; i++) { __put_user(set->sig[i], &rt_sf->uc.tuc_sigmask.sig[i]); } 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 *ka, } setup_ucontext(&frame->uc, env, set); - tswap_siginfo(&frame->info, info); + frame->info = *info; env->pc = ka->_sa_handler; env->gpr[xSP] = 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 *ka, } /* Create siginfo on the signal stack. */ - tswap_siginfo(&frame->info, info); + frame->info = *info; /* Create ucontext on the signal stack. */ uc_flags = 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 *ka, goto give_sigsegv; } - tswap_siginfo(&frame->info, info); + frame->info = *info; /* 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 = deposit32(si_code, 16, 16, si_type); } -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 = extract32(info->si_code, 16, 16); int si_code = sextract32(info->si_code, 0, 16); @@ -1180,6 +1180,12 @@ static void handle_pending_signal(CPUArchState *cpu_env, int sig, /* dequeue signal */ k->pending = 0; + /* + * Writes out siginfo values byteswapped, accordingly to the target. It also + * cleans the si_type from si_code making it correct for the target. + */ + tswap_siginfo(&k->info, &k->info); + sig = gdb_handlesig(cpu, sig, NULL); if (!sig) { sa = 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 *ka, __put_user(0, &sf->rwin_save); /* TODO: save_rwin_state */ - tswap_siginfo(&sf->info, info); + sf->info = *info; tswap_sigset(&sf->mask, set); target_save_altstack(&sf->stack, env); 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 *ka, } if (ka->sa_flags & SA_SIGINFO) { - tswap_siginfo(&frame->info, info); + frame->info = *info; } __put_user(0, &frame->uc.tuc_flags); From patchwork Tue Mar 12 11:25:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 779703 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1966110wrt; Tue, 12 Mar 2024 04:26:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWerxRgm8uqoV7GiX6aAQHzh1JzICWKXr0cw5hcTfQtPea9VsAhVcf+VOp2pI8XkI1LQGNRy3ZJs6gW/qT/jXoE X-Google-Smtp-Source: AGHT+IEoN9q+Kq2J2dSLsdCwQ57etdJ4RfnpCm7A/4q0P/xFJVVoP7kKqkCwRE+PGK4WcwUrApZ2 X-Received: by 2002:a05:620a:2401:b0:787:ed4e:da66 with SMTP id d1-20020a05620a240100b00787ed4eda66mr12457344qkn.47.1710242798555; Tue, 12 Mar 2024 04:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710242798; cv=none; d=google.com; s=arc-20160816; b=Oqe+UQ/c90vU+3FZRDwMVcEqVgiIkx+z54MVi+Day1/Lfu1fnTjjjK/FjNKzEJzaHI d2dyWR/Hec4UF0w0idcQw4KO8b7pHSlKusKd4JdjGy3MJ79fRIpM+iGLBm58qPRJpviQ 63bClVRVoHaIb6qfCxLhpRn0cZ4PhEOU41xOCGV+lkhDT0jRAMNjQBmtMLN6M6GEzj/+ 48oE1m65Isi+0bYIaduQ3V+nFKHw2nvpOClctL3jDDwpn+mk8T5jrUe/AlBUUmwUnp+C Fg70+WNkRt62JwYc8KCQfWcrY/Er/yhv73e9GSgV+Vmom+C0VVqsq8WPDr3boZ39hNm8 1zTw== 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=CGMxfNWMqHxIajAfVs5LmcHHz96MvpgBL7/t14DrgrU=; fh=r4E6V6TArQBWikrjl0XigOAZzDKiO2cs9SRnyYKqaR0=; b=ZfgkOW9ESTuISwLhZ+a2BhEX9nSSxiKKijeA3/w+IoU2AKFDReTRrllac1lxosfYgD uXvoEtsOCnFOFyjoMm/EBuIudUq2Y2XIPrKfqO4MLTD2q1OaojWi3GJ+E6sZF5FAYn0X d/dpAOIzF2EWGBfMh824exg1EVX86qFFsxxOiBklIGR62iAFHWrJs3mnnKr1VIQCF8wz RjUdrCjs0XdXRRKX3Oeefr89phPnX8kBzHGebKbp2Hh7oYDPLyY3KpmkxO/56y/RAqWC 80bLpa/V2g5rC9C0apQG/eVs5skssvTjrUOlpcNvugezDADuxuS8jQRRQCNW1+afrakc eq5g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nPjk5M14; 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 u14-20020a05620a454e00b0078861ec53e0si6798467qkp.272.2024.03.12.04.26.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 04:26:38 -0700 (PDT) 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=nPjk5M14; 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 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) 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-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) 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) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Gustavo Romero , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , Warner Losh , Kyle Evans , =?utf-8?q?Philippe_Mathieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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ée 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 +#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); /** * 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) 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" +/* 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, int sig, k->pending = 0; - sig = gdb_handlesig(cpu, sig); + sig = gdb_handlesig(cpu, sig, NULL, &k->info, sizeof(k->info)); if (!sig) { sa = NULL; handler = 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; static GDBUserState gdbserver_user_state; @@ -190,7 +192,8 @@ void gdb_qemu_exit(int code) exit(code); } -int gdb_handlesig(CPUState *cpu, int sig, const char *reason) +int gdb_handlesig(CPUState *cpu, int sig, const char *reason, void *siginfo, + int siginfo_len) { char buf[256]; int n; @@ -199,6 +202,18 @@ int gdb_handlesig(CPUState *cpu, int sig, const char *reason) return sig; } + 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 = 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); } 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 = g_strdup_printf("syscall_entry:%x;", num); - gdb_handlesig(cs, gdb_target_sigtrap(), reason); + gdb_handlesig(cs, gdb_target_sigtrap(), reason, NULL, 0); } } @@ -772,7 +787,7 @@ void gdb_syscall_return(CPUState *cs, int num) { if (should_catch_syscall(num)) { g_autofree char *reason = g_strdup_printf("syscall_return:%x;", num); - gdb_handlesig(cs, gdb_target_sigtrap(), reason); + gdb_handlesig(cs, gdb_target_sigtrap(), reason, NULL, 0); } } 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); } #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" +/* 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_signum, siginfo_t *info, @@ -1186,7 +1189,7 @@ static void handle_pending_signal(CPUArchState *cpu_env, int sig, */ tswap_siginfo(&k->info, &k->info); - sig = gdb_handlesig(cpu, sig, NULL); + sig = gdb_handlesig(cpu, sig, NULL, &k->info, sizeof(k->info)); if (!sig) { sa = NULL; handler = TARGET_SIG_IGN; From patchwork Tue Mar 12 11:25:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 779704 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1966289wrt; Tue, 12 Mar 2024 04:27:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWt8jn4ikv+NmvIZTq5rsifqBQfuWh1ND3hMyb+fvBL3cz1gqhGsJ/p/o2pXmjiReuOvY1iSkQDVGAS2H625Auj X-Google-Smtp-Source: AGHT+IFKytGyfHLsac38IDJlXjy3rwcYvDplg5DctORY+Va0YD/XfE6AcnLquWZQGaiuiS8aPngH X-Received: by 2002:a05:6808:2a77:b0:3c2:2f9a:5aab with SMTP id fu23-20020a0568082a7700b003c22f9a5aabmr7755619oib.56.1710242832158; Tue, 12 Mar 2024 04:27:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710242832; cv=none; d=google.com; s=arc-20160816; b=ylxGSISbvjRjq/JbQHdtSqWZJbVDfWmaeHqeXXCUVBi8wqVuiPqXmWiI8hhct6c5vQ QBR7bblcCCuZkoP7vF1EPB8iPQ4eGVkElTPFd2LUxWhv+0AKuZ7t5z30BA9KKAkZp0Xa 3loXgNRYPdmbsJd9Becj6Ue29MGI8d5Jh69ThB0stV6z+EZLUDoW5jwWKDD5Uju7Pas2 pqjfsvoAklXjPPq6MrbtMAfRZXndQKh+CmLkRwLwTnUzGBT67bipKT/SiCuQN8S6qr5g 783EcqiOfbPcExXN/WIaCNFvuyKvM+ntvpCZd/QHPnHZ5n8xRmX0TJ+JVE+OpHuhSqFa 39xg== 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=JghslLQsXVIk5PSECh3p0uuw1fQ6K0uFHf3q1DuTSXA=; fh=8Mm9BQmeLpRTl6qJya1IDznvLrd/qBiwVIi7B51sjeA=; b=Jm1I8K9Q4bKvZyYflDMLj4dcTW+Q8/HrJV6mlmRLM7KM3zYbUTEeoCHPm4/hM5YJAN gaRdJ8NCV8xR3ftCP+PkEDzQwwJHJ+aViEo85A6qfBE3BrCC+jQftKlP6ZasZhsNDYH+ SZA0qh1cyXLp74GVnhIe2LijzAHxT7ccfSIyPLoima/em0ijbx8jENlCokHn4Masiou2 P063wRMXwlJp0dc1hQHVugbTGLVQvFFPs3205RpHInL7SrwwNowpFUMqvaTYyZi0qiUt aHFhfAO1/z/u/5PYQDdbNypdeem+TzB8MZ3+K3nVo7x7srORfwPrdIaKUNtcwh+TQAWi lc+g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=or6ziAC3; 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 j18-20020ac85f92000000b0042f212bb553si7211143qta.273.2024.03.12.04.27.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 04:27:12 -0700 (PDT) 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=or6ziAC3; 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 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) 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-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) 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) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Gustavo Romero , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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ée 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, void *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[] = { .cmd_startswith = 1, .schema = "l,l0" }, + { + .handler = gdb_handle_query_xfer_siginfo, + .cmd = "Xfer:siginfo:read::", + .cmd_startswith = 1, + .schema = "l,l0" + }, #endif { .handler = 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, void *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 = get_param(params, 0)->val_ul; + len = 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 = (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); +} From patchwork Tue Mar 12 11:25:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 779699 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1965985wrt; Tue, 12 Mar 2024 04:26:16 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXUPR5xfRAaVfo6fVTnKWjSkelhO4exJXNAgCv3IUpTCYcfcOMISOdUpqje13So/jilKvKETXGGEM7KrXqBuZqx X-Google-Smtp-Source: AGHT+IG4B2e/vrGfCdQPMgi2FkCMBLQMDFs5zdbpd0GXMtwV9nJ/KRKm118XpnOjQ5+BTNL5aXtC X-Received: by 2002:a0c:fed0:0:b0:690:ba6e:f0b5 with SMTP id z16-20020a0cfed0000000b00690ba6ef0b5mr3461513qvs.28.1710242776012; Tue, 12 Mar 2024 04:26:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710242775; cv=none; d=google.com; s=arc-20160816; b=WhI6NTjn0LcAWJ/74csadVhoHNEIet+sifYpqGQsLcUpEhDa09LtmL4pG2g9vjk58f NU8h9//aJXteucuTHM45QVWymEfs0ll3qXQBQsrzPR5gUvtncVqBojCA5BOXtujtCEZC zWsZjHOcZVl42Ko9hpiBq7adL7aGV3fRexGqh6HjN8gKdMVZFCIWr+VL7iNEViSEZg55 kS82YJwuZpQxXI624ka2e1MuSgcsIPfxgRxpRCdOTwvvkwxDmxr3Lf7hh2ZGhbNYfnis tvhq50nTY1q2rUbnVYGh5J/rTmrKuDGeKk+8SqGcAsQrrF8b9g5XeJWN/flZQFLZpjzO 8Lzg== 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=RL1O4Lp3d7j6GCqnIwmXbv0EOOi1576XfsojTQsANsw=; fh=FKe4qLcXgxNVGePk8DrDECLeoHph9zmIpkRPPyTMwXQ=; b=t9hQBNxIVtDEbBUt4hfs8+NQ3W2C/tDfCHnqC0/aU08ZxK0TdkG/+VDN7MF6gGCw8k 7bbYChLjziYjn/YXon0iFZhWbwvp4Jf3vA64EzO7UyAPO2yWR9d9uF825ay9VI5R44T5 2b5LzLhVNY4xpLmOxZX95OcpO7CvOs+szQBV8O7YC2LrSgDZRgDGCqnr2eJj30cx4aeH 7I+U6LaYfi/IXw0J/2TfU1/Lnhp1PvEsgrniO4Dti0gZv+FRlHEPupZ/vVO47XVopg0k 3N1t8zvz0w+3NshQ91WPqhoaoTRmpsvDW3dDLADDbRIF72SQdG17dD99+kyqwbu3lg5Q xs1A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HKxvVWli; 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 14-20020a0562140d6e00b00690d5d0b708si3556678qvs.150.2024.03.12.04.26.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 04:26:15 -0700 (PDT) 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=HKxvVWli; 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 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) 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-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) 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) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Gustavo Romero , Richard Henderson , =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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ée 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 = (void *)0xdeadbeef; + + if (argc == 2 && strcmp(argv[1], "-s") == 0) { + /* Cause segfault. */ + printf("%d\n", *ptr); + } +} diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.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) +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 += 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 # 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 additional +# info about the signal through printing GDB's '$_siginfo' special variable, +# which sends a Xfer:siginfo:read query to the gdbstub. +# +# The binary causes a SIGSEGV at dereferencing a pointer with value 0xdeadbeef, +# so the test looks for and checks if this address is correctly reported by 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 = gdb.execute("print/x $_siginfo", False, True) + report(resp.find("si_addr = 0xdeadbeef"), "Found fault address.") + +main(run_test) From patchwork Tue Mar 12 11:25:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 779700 Delivered-To: patch@linaro.org Received: by 2002:a5d:604e:0:b0:33e:7753:30bd with SMTP id j14csp1965998wrt; Tue, 12 Mar 2024 04:26:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU1NfsZDEiv/1fY6L2ZfEUw0+5URGvhvPcegCmfNGdHN9WLCkslG7itOt5XXrlsR91BNGr16WY0oER9NRFPbenn X-Google-Smtp-Source: AGHT+IFH0D9pc5Mjhx10KeY4I9hS093m3pXDgKilzx/7CxTiEy5rBqFdPSeOkz4ZAaOWHRRd6iFb X-Received: by 2002:a05:620a:204e:b0:788:5e46:e00 with SMTP id d14-20020a05620a204e00b007885e460e00mr10398130qka.3.1710242777551; Tue, 12 Mar 2024 04:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1710242777; cv=none; d=google.com; s=arc-20160816; b=lLf1I51VbcqQkkqiFhLZpYX+iwdB0/AmXg1JxB1fc9tPO3Mu9nklasokdU7Q6EFuUh lUeu6IM1ACrbH04gKVYlue7LNNyUZa68hKpW28a+SGe+m2KTnITNJfY+DWesEvUmQMfD dqS68/4PqwE9gv2WbLfUiP5/JBdwG4p7JU/GI2AIIAwD4dsf5IrmD7IXq+hlMLZlT9CU EjD9N9Ta3nFJJqEFwG2x45JXUdtdAr40ImlTc4ftG1THj2jCQrlx1LhLBK8aRDZNovAj 4Tukemwv9Z6GO5aP/O/IoI3/LaRcOBQZ/9GdNrYRuDVbj6i5AhuO/Tz2eQEKFMWZGiT5 SD6w== 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=cLoGh9BJ5sW1PuxoNirl7iXBfbZ2yLuS6AwQQm/Ji9Q=; fh=U8v/Dtss/m4oPeJtZ17DHKEvZGyePY/+mu3CqtBX2ks=; b=sGPQG4g7tllUCzCUZ2tsWPClsC1Az9UsEEtzfbjk6QY6EuQtfxCryQfERZNCIipRow w+qPWPxug4JshHwTpTwJpqb0tYcBVJL4PqLROecdR+J8nI5Y0SIq76P5Shva05kiwwCN ryu+uhRzrUb2bNrlrDLcxpDNB0tSTOpUwtSJu4NdWkbQyjKQl8Sib1sd7Z6mhkVESBf1 VJN7mm49MS3GFrCoC/mhCC2qpOInzluzc8+1y1QVQbcI/ZiC3VINPYCpfPUkhppXzsEp ccWY+M3kLI0PsRMEPPd3kXdOcqx5QPGX0tu2qHqXsPnD5G81Oghhsqi/T/HL6VH5ZzNF tBug==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q5QWEBp3; 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 xy3-20020a05620a5dc300b0078847a8eeb0si7281567qkn.300.2024.03.12.04.26.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Mar 2024 04:26:17 -0700 (PDT) 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=Q5QWEBp3; 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 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) 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-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) 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) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Ilya Leoshkevich , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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ée 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 = GDB_FORK_ACTIVE; break; case GDB_FORK_ENABLE: - close(fd); gdbserver_user_state.fork_state = 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) != 1) { goto fail; } - close(fd); gdbserver_user_state.fork_state = GDB_FORK_ENABLED; break; case GDB_FORK_DISABLING: