[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACAyw99Gn9Zw5-y_vW8VQ+TtHE32cL=zx59wcZ-KfgDcC-iyAQ@mail.gmail.com>
Date: Tue, 14 Aug 2018 11:59:27 +0100
From: Lorenz Bauer <lmb@...udflare.com>
To: Daniel Borkmann <daniel@...earbox.net>
Cc: ast@...nel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: PROBLEM: Using BPF_PROG_TEST_RUN with data_out != NULL is unsafe
Sorry for the late reply.
On 4 April 2018 at 11:01, Daniel Borkmann <daniel@...earbox.net> wrote:
> In case you point data_in and data_out to the same address, then the total buffer size therefore has to be
> attr.test.data_size_in + 256 in order to not overrun anything while not being
> aware of the BPF test program. The XDP_PACKET_HEADROOM is exposed to user space
> in linux/bpf.h.
Would it be possible to extend the API of BPF_PROG_TEST_RUN to allow
user space to specify the
length of the output buffer? The kernel could then either clamp
output, or return an error.
The current API seems fundamentally hard to use, and unsafe. It leads
to kludges like [1] in a library
I'm maintaining.
1: https://github.com/newtools/ebpf/blob/f4398602ca2a37b99a1f29df9a7e8adcc57be680/prog.go#L200-L204
--
Lorenz Bauer | Systems Engineer
25 Lavington St., London SE1 0NZ
www.cloudflare.com
Powered by blists - more mailing lists