]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: reconcile bpf_tail_call and stack_depth
authorAlexei Starovoitov <ast@fb.com>
Tue, 30 May 2017 20:31:30 +0000 (13:31 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 31 May 2017 23:29:47 +0000 (19:29 -0400)
commit95aebec7745acecb6542bcf4f7318a1767692a98
treeaf3635d78e8274242fd6bf59a076f7a760cea7a7
parentff09a1463cf88573e027e16004ef0640a84b5be6
bpf: reconcile bpf_tail_call and stack_depth

The next set of patches will take advantage of stack_depth tracking,
so make sure that the program that does bpf_tail_call() has
stack depth large enough for the callee.
We could have tracked the stack depth of the prog_array owner program
and only allow insertion of the programs with stack depth less
than the owner, but it will break existing applications.
Some of them have trivial root bpf program that only does
multiple bpf_tail_calls and at init time the prog array is empty.
In the future we may add a flag to do such tracking optionally,
but for now play simple and safe.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/bpf/verifier.c