Re: [REGRESSION][PATCH] bpf_jit drops the ball on indirect negativemem references

From: Eric Dumazet
Date: Fri Mar 30 2012 - 05:12:41 EST


Le jeudi 29 mars 2012 Ã 13:54 +0200, Jan Seiffert a Ãcrit :

>
> + .p2align 1
> bpf_slow_path_word:
> bpf_slow_path_common(4)
> js bpf_error
> @@ -115,6 +116,7 @@ bpf_slow_path_word:
> bswap %eax
> ret
>
> + .p2align 1
> bpf_slow_path_half:
> bpf_slow_path_common(2)
> js bpf_error
> @@ -123,12 +125,14 @@ bpf_slow_path_half:
> movzwl %ax,%eax
> ret

All these ".p2align 1" are noise for this patch.

This should be done as separate patch, explaining the rationale.

...

> case BPF_S_LD_W_IND:
> - func = sk_load_word_ind;
> + func = sk_load_word;
> common_load_ind: seen |= SEEN_DATAREF | SEEN_XREG;
> t_offset = func - (image + addrs[i]);
> - EMIT1_off32(0xbe, K); /* mov imm32,%esi */
> + if (K) {
> + EMIT2(0x8d, 0xb3); /* lea imm32(%rbx),%esi */
> + EMIT(K, 4);
> + } else {
> + EMIT2(0x89,0xde); /* mov %ebx,%esi */
> + }
> EMIT1_off32(0xe8, t_offset); /* call sk_load_xxx_ind */
> break;


Please add the code for imm8 offsets as well ?

if (is_imm8(K))
EMIT3(0x8d, 0x73, K); /* lea imm8(%rbx),%esi */
else
EMIT2_off32(0x8d, 0xb3, K); /* lea imm32(%rbx),%esi */

Thanks



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/