Re: [RFC PATCH v4 17/29] bpf tools: Relocate eBPF programs

From: Namhyung Kim
Date: Mon Jun 01 2015 - 01:35:01 EST


On Wed, May 27, 2015 at 05:19:52AM +0000, Wang Nan wrote:
> If an eBPF program access a map, LLVM generates a relocated load
> instruction. To enable the usage of that map, relocation must be done
> by replacing original instructions by map loading instructions.
>
> Based on relocation description collected during 'opening' phase, this
> patch replaces the instructions with map loading with correct map fd.

I think this message is a bit confusing.. How about this?

If an eBPF program accesses a map, LLVM generates a load instruction
with pseudo map fd. Since actual map fd can only be known after it
loads the map at runtime, it records such information in relocation
section(s). So in order to access the map, relocation must be done by
replacing original (pseudo) map fd with correct map fd.

Thanks,
Namhyung
--
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/