diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2016-02-19 22:05:22 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-02-22 03:07:09 (GMT) |
commit | 8e2fe1d9f1a20924f98ea46931a1d7fb092aa876 (patch) | |
tree | 538a9916d34e6019f250cc5e4246453786e0848e /crypto/authencesn.c | |
parent | 8b393f833346e0a5f0cb4269271d47be8fecd372 (diff) | |
download | linux-8e2fe1d9f1a20924f98ea46931a1d7fb092aa876.tar.xz |
bpf: add new arg_type that allows for 0 sized stack buffer
Currently, when we pass a buffer from the eBPF stack into a helper
function, the function proto indicates argument types as ARG_PTR_TO_STACK
and ARG_CONST_STACK_SIZE pair. If R<X> contains the former, then R<X+1>
must be of the latter type. Then, verifier checks whether the buffer
points into eBPF stack, is initialized, etc. The verifier also guarantees
that the constant value passed in R<X+1> is greater than 0, so helper
functions don't need to test for it and can always assume a non-NULL
initialized buffer as well as non-0 buffer size.
This patch adds a new argument types ARG_CONST_STACK_SIZE_OR_ZERO that
allows to also pass NULL as R<X> and 0 as R<X+1> into the helper function.
Such helper functions, of course, need to be able to handle these cases
internally then. Verifier guarantees that either R<X> == NULL && R<X+1> == 0
or R<X> != NULL && R<X+1> != 0 (like the case of ARG_CONST_STACK_SIZE), any
other combinations are not possible to load.
I went through various options of extending the verifier, and introducing
the type ARG_CONST_STACK_SIZE_OR_ZERO seems to have most minimal changes
needed to the verifier.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'crypto/authencesn.c')
0 files changed, 0 insertions, 0 deletions