From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54030 invoked by alias); 19 Dec 2018 09:29:54 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 52990 invoked by uid 89); 19 Dec 2018 09:29:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,KAM_NUMSUBJECT,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=H*f:sk:871s6g0, placed X-HELO: gate.crashing.org Received: from gate.crashing.org (HELO gate.crashing.org) (63.228.1.57) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Dec 2018 09:29:52 +0000 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id wBJ8SwsY001708; Wed, 19 Dec 2018 02:29:03 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id wBJ8Sme6001686; Wed, 19 Dec 2018 02:28:50 -0600 Date: Wed, 19 Dec 2018 09:29:00 -0000 From: Segher Boessenkool To: Dimitar Dimitrov Cc: Bernd Edlinger , Christophe Lyon , Thomas Preudhomme , "gcc-patches@gcc.gnu.org" , "richard.sandiford@arm.com" , "gdb@sourceware.org" Subject: Re: [PATCH] [RFC] PR target/52813 and target/11807 Message-ID: <20181219082846.GL3803@gate.crashing.org> References: <871s6g0z5z.fsf@arm.com> <3795301.LoOEyI2oHe@tpdeb> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3795301.LoOEyI2oHe@tpdeb> User-Agent: Mutt/1.4.2.3i X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg01369.txt.bz2 On Wed, Dec 19, 2018 at 08:40:13AM +0200, Dimitar Dimitrov wrote: > On Mon, Dec 17 2018 20:15:02 EET Bernd Edlinger wrote: > > out of curiosity I looked at the clobber statement in > > gdb/nat/linux-ptrace.c: > > > > asm volatile ("pushq %0;" > > ".globl linux_ptrace_test_ret_to_nx_instr;" > > "linux_ptrace_test_ret_to_nx_instr:" > > "ret" > > : : "r" ((uint64_t) (uintptr_t) return_address) > > : "%rsp", "memory"); > > > > it turns out to be a far jump, instruction. > > GDB functionality should not be affected if SP clobber is removed, even if the > generated code is slightly different. Please see this comment: > http://sourceware.org/ml/gdb-patches/2018-12/msg00204.html > > As I understand it, this particular code is never meant to return. It should > either stop due to the NX mapping of return_address/%0, or hit the breakpoint > placed at return_address/%0. If it doesn't return it is undefined behaviour, so anything might happen and that is perfectly alright. Defining labels is an asm is undefined, too. Maybe real assembler code is wanted here? I.e. a .s file. Segher