From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id AFDB13858D35 for ; Sat, 15 Jul 2023 13:38:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AFDB13858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689428337; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2szbEKTR/GiHms64F7km/UnEAgrOkULCfw6eS+amepk=; b=QAYDvUCRheo77XYrZEueGXQk71wuVzhG0rnptIU5gEOzBXxqE1amYTQvJNAw8LaWB34lPh 18lz5O2j0Ce7Sbv23W4zcmwq7PmxFS0qw9ga4/TVIi+VbDqGPZGtOhbN4DVmSEXBhb1oYx n9btehvXEveOan/9gstfhezpMbUN/Ek= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-203-5F2jf2nyMsO5kI8B_1EreQ-1; Sat, 15 Jul 2023 09:38:54 -0400 X-MC-Unique: 5F2jf2nyMsO5kI8B_1EreQ-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-30793c16c78so1828871f8f.3 for ; Sat, 15 Jul 2023 06:38:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689428333; x=1692020333; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2szbEKTR/GiHms64F7km/UnEAgrOkULCfw6eS+amepk=; b=k05ctqJcMcHwDk6u7H7XQPqPtAptEF1bdlVEBT3k3skh4xYEM0UdiSq5Z/hLz25eAV 9jLeP9p68Ah7EoNKB0Op7nb9KItu5lGgnekH5Tfu0crodpY4qF9vC+tBTH0VE4TOLMKE uMrS+LH4yOrd5Z8srfi1JEyy80SuBOFCGljvEZ1/UYJ/varSCZMLaWyIXBCMmfrkfYAm 0KpX8qzEOdvzvwRTWs7QqeR1J7tD42R/PA8VBNASEm7FhUqVoZK+EP0TUueIh7lJxrFp 4fOeSGGbE98AKqoXF1L1iEFG4WiLvaZTbjlQTKAuvjs8dxQgn+H5rXlYlUKHqAKvT9FK bQEA== X-Gm-Message-State: ABy/qLafbs4iuVUbHA3Yd1P9naf+Sf17OYLzH3kDzXY6jvVfXF3g0O81 mQUhSrZpgRLcAlc+9LoexVk1xRkpI6+9cHythus+SoNektFdyiul3v+xK0EN1R8+LG2lIbTcVxG u7OPA/b3ysorqO+JmtU58yyIvH3zQ1A== X-Received: by 2002:a5d:654e:0:b0:314:2d71:1f7a with SMTP id z14-20020a5d654e000000b003142d711f7amr7316798wrv.32.1689428333598; Sat, 15 Jul 2023 06:38:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlG3eeaeTkXVG/REdZzJpQsGbhloNPq5VG1GuZo/PJWPAZw1oHa+bSVdxZO/H1rOJewTLSepWA== X-Received: by 2002:a5d:654e:0:b0:314:2d71:1f7a with SMTP id z14-20020a5d654e000000b003142d711f7amr7316786wrv.32.1689428333312; Sat, 15 Jul 2023 06:38:53 -0700 (PDT) Received: from localhost (2.72.115.87.dyn.plus.net. [87.115.72.2]) by smtp.gmail.com with ESMTPSA id i17-20020adff311000000b003143853590csm13768244wro.104.2023.07.15.06.38.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 06:38:52 -0700 (PDT) From: Andrew Burgess To: Rainer Orth , gdb-patches@sourceware.org Subject: Re: [PATCH] Guard against killing unrelated processes in amd64-disp-step.exp In-Reply-To: References: Date: Sat, 15 Jul 2023 14:38:51 +0100 Message-ID: <875y6li9as.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Rainer Orth writes: > When testing current gdb trunk on Solaris/amd64, the whole session was > reliably terminated by make check. I could trace this to the following > entry in gdb.arch/amd64-disp-step/gdb.log: > > FAIL: gdb.arch/amd64-disp-step.exp: add into rcx: send_signal=on: get inferior pid > Executing on target: kill -ALRM -1 (timeout = 300) > builtin_spawn -ignore SIGHUP kill -ALRM -1 > > If $inferior_pid doesn't refer a single process for some reason, this > kill would terminate either a process group or the whole session. > > This patch avoids this by ensuring that the pid arg is positive. > > Tested on amd64-pc-solaris2.11 and x86_64-pc-linux-gnu. > > Ok for trunk? > > Rainer > > -- > ----------------------------------------------------------------------------- > Rainer Orth, Center for Biotechnology, Bielefeld University > > > diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step.exp b/gdb/testsuite/gdb.arch/amd64-disp-step.exp > --- a/gdb/testsuite/gdb.arch/amd64-disp-step.exp > +++ b/gdb/testsuite/gdb.arch/amd64-disp-step.exp > @@ -222,7 +222,10 @@ proc rip_test { reg test_start_label tes > # If we use 'signal' to send the signal GDB doesn't actually do > # the displaced step, but instead just delivers the signal. > set inferior_pid [get_inferior_pid] > - remote_exec target "kill -ALRM $inferior_pid" > + # Ensure that $inferior_pid refers to a single process. > + if {$inferior_pid > 0} { > + remote_exec target "kill -ALRM $inferior_pid" > + } Does this not hide the fact that the test is no longer doing what it expected? I'm fine with the 'if {$inferior_pid > 0}' being added to ensure we don't signal some random process(es), but I think we should probably add something like: gdb_assert {[expr $inferior_pid > 0]} \ "check for a sane inferior pid" if {$inferior_pid > 0} { remote_exec target "kill -ALRM $inferior_pid" } This way you will still see a FAIL. Thoughts? Thanks, Andrew