From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id K0KXJtSIkWiNIwQAWB0awg (envelope-from ) for ; Tue, 05 Aug 2025 00:30:12 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=x0svFoKJ; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 874A41E102; Tue, 5 Aug 2025 00:30:12 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 1BA8A1E089 for ; Tue, 5 Aug 2025 00:30:11 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9030E3858C31 for ; Tue, 5 Aug 2025 04:30:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9030E3858C31 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=x0svFoKJ Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id C7C983858D29 for ; Tue, 5 Aug 2025 04:29:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C7C983858D29 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C7C983858D29 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::42c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1754368179; cv=none; b=O/EBeCNlBI67w4XRTNk6z1RlFfZiGnFvq91HyMJgiypwZ3ta21T/miJSO6IlxEoManF15ZflYge1CHCW8tUPmuR03AQDWJ5AAg5ZBgg2WlRVAJ+rcOtuVm67w9LLFPd/KRK7MWgPPm5c8CwzNr1Qm/lslZWtrYtiJAv/7exF274= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1754368179; c=relaxed/simple; bh=3icWamL+tbvJitDXsFKYqQPpcWelrV2Y/UlCstBHbgk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=SQkR9KnVXlPdx2cv22Y8GCJDgmL1hK3AMEHzLB7FKdWi4ksfDWBJxxhCtF6w2FiBN6yHcv5oiQwRz9Hz09yX4cMvwhyfeXlHGccOlOjUCQTZlBv51XqMm66HvqeEhX+U/1k5jfRnH5p0FIN1zT5qxzQ/nHcDVfrIGCX7LSyKtTY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C7C983858D29 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-76bde897110so2986495b3a.3 for ; Mon, 04 Aug 2025 21:29:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754368178; x=1754972978; darn=sourceware.org; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=yAwkz04b529p7G2adiLQPTwtmEEiqfn45fzDCbfAZeI=; b=x0svFoKJ814N/7wEC4tkLrzOsHhiKJX9c/5EO/I1uYjxC1I9DvurXk9PM7YkU9u22D 25FM5dPGLX9oP4B3dInLPdm9MZ2s1pKJoSf+lHJabmPQ5MhlO96TXxWtK4qEd5p5lVNC cGuPeFELEwrsTAjM3VpDIEwYD4Gvf29frD/aecLoDHVWaGfehgjuaWL8r5RtN8/Dc2RH THY0X79d5iQAOxVnaIILQl44smfvjo0aB1tHxFZwga2FHJENSdJftFwJ3340DgkgVUpl V3+eMFNDnuw46UxoDzwEaWnKaTUoHn2AOl/0AorMSAb18d7dKf+caoahoVSpR4gLpDKM fVog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754368178; x=1754972978; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=yAwkz04b529p7G2adiLQPTwtmEEiqfn45fzDCbfAZeI=; b=LxSmr9rrdodY1YeOikbAj1kHfy4YRtZbgNvXme2qlBppHTGJXIm/DUCh5ZDYcSrxlR HuDExK+R8ccLQTMZnKHDgYYRzix/BR+VNApjpWyP7MpRRpkCr/GumLpP3kvOjCIyHrvC dG8gvCYm3aG2Ox9lKtLB3817iSb4dH4aiyP3f2e2H+6jcAT93X0a/SU2e3srxA9WbgP6 JHAvzOlAIxY3FnjhC2sSqLtN09zO4EtTMkXT1WRAV7OxDxp+rh/+Yy71B6bWKVvk8LEQ BrNWzZNPTOn2Z/XepJVFP5eNC9BeKyeVz9+Ipr3j0+q7ao+21q5gCl7uigUQrQC3S+vd 4ZYg== X-Forwarded-Encrypted: i=1; AJvYcCWASN7v88vET4OtNyT7MrXIfQtFiiuHQThkGx2TNn41/8wwXbdGqxIen0q4Kaeb5SNNDkfVzldQSXvLpw==@sourceware.org X-Gm-Message-State: AOJu0YyI6HkS3ohn/hL9mPhYZhcy+Tux36HBYVT+dGJ0JCuw8IQkFMsu fWHGFFtrJVxxc/9aFSGR75P5dxqVaJ9a/gPojvTPPieDWVJP13diT9UkAWuJfn5DMa0= X-Gm-Gg: ASbGncvLUnicj8ZZrPfY0OkjHbXcCxM4C1k7SGT6dfbDMNnEnJU0H5H6d3ax+pr2WPJ Od/k22se4KPNnmWVBbM9353i+7nPQWEIyrVYkxxQeYTfGqmV7Dcc3RmwxIojq6r1DNkvADah3Ak AtGnmioOvWxanYkzTmPuCef7s0FLUHRrBu725RaHxS/WbKqY+wd6ZvU3luZbyc2YowcV1wiauxP CU+0aLSpM2TybRErzB6RQONBsvFX5PZiIvmcvY6HfHXjtIumkecUMBW40uvWSZ3HLowqbof/W+L KdgYmgXm+uMVoniO0czDN3rUMPQoSTOAlo7jWEv7JnR1UgoVBs/ExyjDzKxZ0eemeJlV34id1b2 wxxou2zOohiF/tbGIV569djrN95ieUZCT X-Google-Smtp-Source: AGHT+IGf9xUHeYgyQZQjcf8AIq9JG6S+6QVFeAZcBICqmwvJ58q4Jm/eJeurrweip8FIWEuWPwdQZA== X-Received: by 2002:a05:6a00:1884:b0:748:e9e4:d970 with SMTP id d2e1a72fcca58-76bec2fb668mr14331521b3a.1.1754368177713; Mon, 04 Aug 2025 21:29:37 -0700 (PDT) Received: from localhost ([2804:14d:7e39:88d6:359f:72eb:b222:add0]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-76bccead450sm11818866b3a.54.2025.08.04.21.29.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 21:29:37 -0700 (PDT) From: Thiago Jung Bauermann To: "Schimpe, Christina" Cc: Andrew Burgess , "gdb-patches@sourceware.org" , "luis.machado@arm.com" Subject: Re: [PATCH v5 07/12] gdb: amd64 linux coredump support with shadow stack. In-Reply-To: (Christina Schimpe's message of "Mon, 4 Aug 2025 15:28:33 +0000") References: <20250628082810.332526-1-christina.schimpe@intel.com> <20250628082810.332526-8-christina.schimpe@intel.com> <87o6t3cawd.fsf@redhat.com> <87tt2u788x.fsf@linaro.org> User-Agent: mu4e 1.12.11; emacs 30.1 Date: Tue, 05 Aug 2025 01:29:34 -0300 Message-ID: <87cy9ajsr5.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Hello, "Schimpe, Christina" writes: >> > >> + >> > >> + # At this point we have a couple of core files, the gcore one >> > >> + generated by >> > >> + # GDB and the one generated by the operating system. Make >> > >> + sure GDB can >> > >> + # read both correctly. >> > >> + >> > >> + if {$gcore_generated} { >> > >> + clean_restart $binfile >> > >> + >> > >> + with_test_prefix "gcore corefile" { >> > >> + check_core_file $gcore_filename $ssp_in_gcore >> > >> + } >> > >> + } else { >> > >> + fail "gcore corefile not generated" >> > > >> > > It's better, where possible, to avoid having pass/fail results that >> > > only show up down some code paths. >> > > >> > > In this case it's easy to avoid having a stray 'fail' by >> > > restructuring the code too: >> > > >> > > gdb_assert { $gcore_generated } "gcore corefile created" >> > > if { $gcore_generated } { >> > > ... etc ... >> > > } >> > > >> > > Now you'll always have either a pass or fail based on the gcore >> > > being generated. >> > >> > Good idea. I did that for aarch64-gcs-core.exp. > > If no OS corefile is found we will see a FAIL here. > The usual coredump testing doesn't fail in case the coredump file is not found. > So all gdb.base/corefile*.exp tests have sth. like: > > set corefile [core_find $binfile {}] > if {$corefile == ""} { > return > } > > This can happen in case corefiles are managed, for instance, by apport on ubuntu. > Do we want a different behaviour ? Interesting point. Perhaps a FAIL Isn't the best result to report in this case, but IMHO it would be worth reporting an UNTESTED or perhaps UNSUPPORTED result rather than silently returning. I don't have a strong opinion on this matter though. >> > > There is also the helper proc `gcore_cmd_available`. I'd guess for >> > > any >> > > x86 target that supports SSP, gcore will be available, but in theory >> > > you could consider using this to avoid a fail when gcore is not >> > > available maybe? >> > >> > In the GCS core testcase, I moved the gcore tests after the OS >> > corefile ones, with an >> > >> > if ![gcore_cmd_available] { >> > return >> > } >> > >> > in the middle, and after that I had to redo some GDB setup: >> > >> > clean_restart $binfile >> > >> > if ![runto $linespec] { >> > return >> > } > > Do you also do the "continue until crash part" again? No, at least in my version of the test the "continue until crash" part is only needed once, for the gcore test. The OS corefile test doesn't need it. > It would make sense to move it into a proc then: > ~~~ > # Continue until the expected crash at the return instruction. > > proc continue_until_crash {} { > global hex decimal > > # The line with the hex number is optional because it's printed by the > # test program, and doesn't appear in the expect buffer when testing a > # remote target. > gdb_test "continue" \ > [...] > ~~~ > > And my gcore testing now looks as follows: > > ~~~ > if ![gcore_cmd_available] { > return Come to think of it, I think an untested/unsupported would be good here as well, if I'm going to be consistent in my opinion. > } > > clean_restart $binfile > > if ![runto $linespec] { > return > } > > with_test_prefix "gcore corefile" { > continue_until_crash > > set ssp_in_gcore [get_valueof "/x" "\$pl3_ssp" "*unknown*"] > > # Generate the gcore core file. > set gcore_filename [standard_output_file "${testfile}.gcore"] > set gcore_generated [gdb_gcore_cmd "$gcore_filename" "generate gcore file"] > > gdb_assert { $gcore_generated } "gcore corefile created" > if { $gcore_generated } { > clean_restart $binfile > check_core_file $gcore_filename $ssp_in_gcore > } > } > ~~~ For reference, my test is here: https://gitlab.com/bauermann/binutils-gdb/-/blob/guarded-control-stack-patches/gdb/testsuite/gdb.arch/aarch64-gcs-core.exp -- Thiago