lkml.org 
[lkml]   [2013]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRE: [RFC PATCH net-next 2/6] x86: bpf_jit_comp: support BPF_S_ANC_SECCOMP_LD_W instruction
Date
From
> >> +#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...

David





\
 
 \ /
  Last update: 2013-04-26 18:01    [W:0.104 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site