[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1366990066.8964.216.camel@edumazet-glaptop>
Date: Fri, 26 Apr 2013 08:27:46 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Laight <David.Laight@...LAB.COM>
Cc: Xi Wang <xi.wang@...il.com>, Daniel Borkmann <dborkman@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Russell King <linux@....linux.org.uk>,
Heiko Carstens <heiko.carstens@...ibm.com>,
Eric Dumazet <edumazet@...gle.com>,
Will Drewry <wad@...omium.org>,
Andrew Morton <akpm@...ux-foundation.org>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: RE: [RFC PATCH net-next 2/6] x86: bpf_jit_comp: support
BPF_S_ANC_SECCOMP_LD_W instruction
On Fri, 2013-04-26 at 16:15 +0100, David Laight wrote:
> > >> +#ifdef CONFIG_SECCOMP_FILTER
> > >> + case BPF_S_ANC_SECCOMP_LD_W:
> > >> + if (K == offsetof(struct seccomp_data, arch)) {
> > >> + int arch = syscall_get_arch(current, NULL);
> > >> +
> > >> + EMIT1_off32(0xb8, arch); /* mov arch,%eax */
> > >> + break;
> > >> + }
> > >> + func = (u8 *)seccomp_bpf_load;
> > >> + t_offset = func - (image + addrs[i]);
> > >> + EMIT1_off32(0xbf, K); /* mov imm32,%edi */
> > >> + EMIT1_off32(0xe8, t_offset); /* call seccomp_bpf_load */
> > >> + break;
> > >> +#endif
> > >
> > > This seems seriously wrong to me.
> >
> > Can you elaborate?
>
> The 'call seccomp_bpf_load' needs a pc-relative offset,
> I assume that is what EMIT1_off32() generates.
>
> The other two instructions want an absolute 32 bit value...
Hmm, this part is fine, we perform the relative adjustments in
t_offset = func - (image + addrs[i]);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists