From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 4ILaAwfNm2H1AgAAWB0awg (envelope-from ) for ; Mon, 22 Nov 2021 12:01:59 -0500 Received: by simark.ca (Postfix, from userid 112) id 0D8C81F0CE; Mon, 22 Nov 2021 12:01:59 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, NICE_REPLY_A autolearn=unavailable autolearn_force=no version=3.4.2 Received: from 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A041C1ECEB for ; Mon, 22 Nov 2021 12:01:58 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 43487385841D for ; Mon, 22 Nov 2021 17:01:58 +0000 (GMT) Received: from mx2.freebsd.org (mx2.freebsd.org [96.47.72.81]) by sourceware.org (Postfix) with ESMTPS id D5CF43858406 for ; Mon, 22 Nov 2021 17:01:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D5CF43858406 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 8F831B4491; Mon, 22 Nov 2021 17:01:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HyYTQ3PDwz4R81; Mon, 22 Nov 2021 17:01:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from [IPV6:2601:648:8601:8b20:7de4:e77a:791:6f5] (unknown [IPv6:2601:648:8601:8b20:7de4:e77a:791:6f5]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id CE313920B; Mon, 22 Nov 2021 17:01:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <95fbffc3-8d30-6e75-4f52-f6e534a13b20@FreeBSD.org> Date: Mon, 22 Nov 2021 09:01:44 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: [PATCH] gdb fix for catch-syscall.exp Content-Language: en-US To: Carl Love , Simon Marchi , gdb-patches@sourceware.org References: <3b8e450b9fb4f4bec97a6bfbe6e6a4816be780ee.camel@us.ibm.com> <4d51616392553dd308672f65f18909ebf0513fc0.camel@us.ibm.com> From: John Baldwin In-Reply-To: <4d51616392553dd308672f65f18909ebf0513fc0.camel@us.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rogerio Alves Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 11/19/21 4:27 PM, Carl Love via Gdb-patches wrote: > Simon: > > On Thu, 2021-11-18 at 13:10 -0500, Simon Marchi wrote: >> >> Hi Carl, >> >> This patch causes this failure regression on Ubuntu 20.04, amd64: >> >> FAIL: gdb.base/catch-syscall.exp: execve: continue to main >> >> From gdb.log: >> >> 615 continue^M >> 616 Continuing.^M >> 617 process 2022222 is executing new program: >> /home/smarchi/build/binutils- >> gdb/gdb/testsuite/outputs/gdb.base/catch-syscall/catch-syscall^M >> 618 ^M >> 619 Catchpoint 18 (returned from syscall execve), 0x00007ffff7fd0100 >> in _start () from /lib64/ld-linux-x86-64.so.2^M >> 620 (gdb) FAIL: gdb.base/catch-syscall.exp: execve: continue to main >> > > Interesting. I understood that the execve call would not return to the > caller except in the case of an error. Not sure why it behaves > differently on amd64 versus Power and Intel? Let me take a look and > see if I can create a fix with a test multiple to cover both cases. > > Thanks for letting me know. Note that the thread/process that calls execve() does still "return" from the kernel, it just returns to the entry point of the executable with the contents of the user address space wiped. I'm not quite sure how Linux treats this, but on FreeBSD at least this "return" is treated as a successful return from the execve system call. In fact, I think Linux on at least amd64 reports two events: one for an "execve" event and one for the system call return event judging by a commit made in FreeBSD to emulate ptrace() for Linux binaries: https://cgit.freebsd.org/src/commit/?id=6e66030c4c05331f9b0adf87c31f2f233dd3ae1f -- John Baldwin