Re: [PATCH bpf v2] bpf: relax return code check for subprograms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 13, 2020 at 9:18 AM Dmitrii Banshchikov <me@xxxxxxxxxxxxx> wrote:
>
> Currently verifier enforces return code checks for subprograms in the
> same manner as it does for program entry points. This prevents returning
> arbitrary scalar values from subprograms. Scalar type of returned values
> is checked by btf_prepare_func_args() and hence it should be safe to
> allow only scalars for now. Relax return code checks for subprograms and
> allow any correct scalar values.
>
> Signed-off-by: Dmitrii Banshchikov <me@xxxxxxxxxxxxx>
> Fixes: 51c39bb1d5d10 (bpf: Introduce function-by-function verification)
> ---

LGTM!

Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx>

> v1 -> v2:
>  - Move is_subprog flag determination to check_return_code()
>  - Remove unneeded intermediate function from tests
>  - Use __noinline instead of __attribute__((noinline)) in tests
>
>  kernel/bpf/verifier.c                         | 15 +++++++++++++--
>  .../bpf/prog_tests/test_global_funcs.c        |  1 +
>  .../selftests/bpf/progs/test_global_func8.c   | 19 +++++++++++++++++++
>  3 files changed, 33 insertions(+), 2 deletions(-)
>  create mode 100644 tools/testing/selftests/bpf/progs/test_global_func8.c
>

[...]



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux