Re: [RFC PATCH v3 16/37] bpf tools: Collect eBPF programs from their own sections

From: Alexei Starovoitov
Date: Mon May 18 2015 - 14:32:16 EST


On 5/18/15 5:47 AM, Wangnan (F) wrote:


+ prog->insns_cnt = size / sizeof(struct bpf_insn);
+ memcpy(prog->insns, data,
+ prog->insns_cnt * sizeof(struct bpf_insn));
Doesn't the data need to be swapped?

Thanks,
Namhyung


I'm not very sure, since they are instructions. Byte order of
instructions and byte order of data
are not always same. Think about ARM. Therefore another choice is to
swap them in kernel,
keep user-kernel interface clean.

Alexei Starovoitov, do you think we should use uniformed instruction
byte order in both big and little
endian kernel on user-kernel interface, or let userspace feed swapped
instructions to kernel if
endianess is not match?

see my reply to the other patch. endianness is the job of llvm.
Let's fix it there.

--
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/