This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: [PATCH] [RFC] PR target/52813 and target/11807
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Dimitar Dimitrov <dimitar at dinux dot eu>
- Cc: Bernd Edlinger <bernd dot edlinger at hotmail dot de>, Christophe Lyon <christophe dot lyon at linaro dot org>, Thomas Preudhomme <thomas dot preudhomme at linaro dot org>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, "richard dot sandiford at arm dot com" <richard dot sandiford at arm dot com>, "gdb at sourceware dot org" <gdb at sourceware dot org>
- Date: Wed, 19 Dec 2018 02:28:46 -0600
- Subject: Re: [PATCH] [RFC] PR target/52813 and target/11807
- References: <DB7PR07MB53537B024F807B2F383C87B0E4A30@DB7PR07MB5353.eurprd07.prod.outlook.com> <871s6g0z5z.fsf@arm.com> <DB7PR07MB53539859098ACF34CF4C5A55E4BC0@DB7PR07MB5353.eurprd07.prod.outlook.com> <3795301.LoOEyI2oHe@tpdeb>
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