linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PROBLEM: Using BPF_PROG_TEST_RUN with data_out != NULL is unsafe
@ 2018-04-04  9:04 Lorenz Bauer
  2018-04-04 10:01 ` Daniel Borkmann
  0 siblings, 1 reply; 3+ messages in thread
From: Lorenz Bauer @ 2018-04-04  9:04 UTC (permalink / raw)
  To: ast, daniel; +Cc: netdev, linux-kernel

Hello,

I’ve encountered an issue when using BPF_PROG_TEST_RUN and capturing the output.
The kernel copies data into user space without checking the length of
the destination buffer.

In bpf_test_finish(), size is the amount of data in the XDP buffer /
skb after the program is run. This can be larger than data_size_in due
to bpf_xdp_adjust_head() and friends.
bpf_test_finish doesn’t clamp size to data_size_out, which is what I
was expecting.

What is the correct way to use this interface?

Best,
Lorenz

-- 
Lorenz Bauer  |  Systems Engineer
25 Lavington St., London SE1 0NZ

www.cloudflare.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-14 10:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-04  9:04 PROBLEM: Using BPF_PROG_TEST_RUN with data_out != NULL is unsafe Lorenz Bauer
2018-04-04 10:01 ` Daniel Borkmann
2018-08-14 10:59   ` Lorenz Bauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).