lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210915033753.1201597-1-houtao1@huawei.com>
Date:   Wed, 15 Sep 2021 11:37:50 +0800
From:   Hou Tao <houtao1@...wei.com>
To:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <kafai@...com>
CC:     <netdev@...r.kernel.org>, <bpf@...r.kernel.org>,
        <houtao1@...wei.com>
Subject: [RFC PATCH bpf-next 0/3] introduce dummy BPF STRUCT_OPS

Hi,

Currently the test of BPF STRUCT_OPS depends on the specific bpf
implementation of tcp_congestion_ops, but it can not cover all
basic functionalities (e.g, return value handling), so introduce
a dummy BPF STRUCT_OPS for test purpose.

The test procedure works in the following way:
(1) write to newly-created /sys/kernel/bpf_test/dummy_ops_ctl
The format is "test_case_N [option_integer_return]".

(2) test_case_N in bpf_testmod.ko will be call dummy_ops method
It will call bpf_get_dummy_ops() first to get the dummy_ops,
call its method, and check the return value of the method. If
the method succeeds and its return value is expected, the write
succeeds, else it fails.

But there is one concerns: the format of dummy_ops_ctl is too
simply. It can only check a integer state update from dummy_ops
method. If multiple states are updated in a dummy struct_ops
method, it can not verify these updates are expected in
bpf_testmod.ko. Are such test is needed here ?

Any comments are welcome.

Hou Tao (3):
  bpf: add dummy BPF STRUCT_OPS for test purpose
  selftests/bpf: call dummy struct_ops in bpf_testmode
  selftests/bpf: add test for BPF STRUCT_OPS

 include/linux/bpf_dummy_ops.h                 |  28 +++
 kernel/bpf/Kconfig                            |   7 +
 kernel/bpf/Makefile                           |   2 +
 kernel/bpf/bpf_dummy_struct_ops.c             | 173 ++++++++++++++++++
 kernel/bpf/bpf_struct_ops_types.h             |   4 +
 .../selftests/bpf/bpf_testmod/bpf_testmod.c   | 152 ++++++++++++++-
 .../selftests/bpf/prog_tests/bpf_dummy_ops.c  |  95 ++++++++++
 .../selftests/bpf/progs/bpf_dummy_ops.c       |  34 ++++
 8 files changed, 493 insertions(+), 2 deletions(-)
 create mode 100644 include/linux/bpf_dummy_ops.h
 create mode 100644 kernel/bpf/bpf_dummy_struct_ops.c
 create mode 100644 tools/testing/selftests/bpf/prog_tests/bpf_dummy_ops.c
 create mode 100644 tools/testing/selftests/bpf/progs/bpf_dummy_ops.c

-- 
2.29.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ