[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190614133004.gopjz64vbqmbbzqn@treble>
Date: Fri, 14 Jun 2019 08:34:48 -0500
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, netdev@...r.kernel.org,
bpf@...r.kernel.org, Peter Zijlstra <peterz@...radead.org>,
Song Liu <songliubraving@...com>,
Kairui Song <kasong@...hat.com>
Subject: Re: [PATCH 7/9] x86/unwind/orc: Fall back to using frame pointers
for generated code
On Thu, Jun 13, 2019 at 11:00:09PM -0700, Alexei Starovoitov wrote:
> > + if (src_reg == BPF_REG_FP) {
> > + /*
> > + * If the value was copied from RBP (real frame pointer),
> > + * adjust it to the BPF program's frame pointer value.
> > + *
> > + * add dst, -40
> > + */
> > + EMIT4(add_1mod(0x48, dst_reg), 0x83, add_1reg(0xC0, dst_reg),
> > + 0xD8);
> > + }
> > +
>
> That won't work. Any register can point to a stack.
Right, but if the stack pointer comes from BPF_REG_FP then won't the
above correct it? Then if the pointer gets passed around to other
registers it will have the correct value. Or did I miss your point?
> The register can point to a stack of a different JITed function as well.
Do you mean tail calls? Or something else? For tail calls the stack is
shared and the stack layout is the same.
--
Josh
Powered by blists - more mailing lists