mbox series

[v2,bpf-next,0/5] Add bpf_getxattr

Message ID 20220621012811.2683313-1-kpsingh@kernel.org (mailing list archive)
Headers show
Series Add bpf_getxattr | expand

Message

KP Singh June 21, 2022, 1:28 a.m. UTC
v1 -> v2

- Used kfuncs as suggested by Alexei
- Used Benjamin Tissoires' patch from the HID v4 series to add a
  sleepable kfunc set (I sent the patch as a part of this series as it
  seems to have been dropped from v5) and acked it. Hope this is okay.
- Added support for verifying string constants to kfuncs

Foundation for building more complex security policies using the
BPF LSM as presented in LSF/MM/BPF:

 http://vger.kernel.org/bpfconf2022_material/lsfmmbpf2022-xattr.pdf

Benjamin Tissoires (1):
  btf: Add a new kfunc set which allows to mark a function to be
    sleepable

KP Singh (4):
  bpf: kfunc support for ARG_PTR_TO_CONST_STR
  bpf: Allow kfuncs to be used in LSM programs
  bpf: Add a bpf_getxattr kfunc
  bpf/selftests: Add a selftest for bpf_getxattr

 include/linux/bpf_verifier.h                  |  2 +
 include/linux/btf.h                           |  2 +
 kernel/bpf/btf.c                              | 42 ++++++++-
 kernel/bpf/verifier.c                         | 85 +++++++++++--------
 kernel/trace/bpf_trace.c                      | 36 ++++++++
 .../testing/selftests/bpf/prog_tests/xattr.c  | 58 +++++++++++++
 tools/testing/selftests/bpf/progs/xattr.c     | 37 ++++++++
 7 files changed, 223 insertions(+), 39 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/xattr.c
 create mode 100644 tools/testing/selftests/bpf/progs/xattr.c

Comments

Benjamin Tissoires June 21, 2022, 12:46 p.m. UTC | #1
On Tue, Jun 21, 2022 at 3:28 AM KP Singh <kpsingh@kernel.org> wrote:
>
> v1 -> v2
>
> - Used kfuncs as suggested by Alexei
> - Used Benjamin Tissoires' patch from the HID v4 series to add a
>   sleepable kfunc set (I sent the patch as a part of this series as it
>   seems to have been dropped from v5) and acked it. Hope this is okay.

FWIW, this is perfectly OK with me.

The reason I dropped the patch from the series is because I don't
absolutely need it anymore: all of my sleepable kfuncs are now
declared as SYSCALL type, which is by definition sleepable.

I still believe it's valuable to be able to define sleepable kfuncs however.

Cheers,
Benjamin

> - Added support for verifying string constants to kfuncs
>
> Foundation for building more complex security policies using the
> BPF LSM as presented in LSF/MM/BPF:
>
>  http://vger.kernel.org/bpfconf2022_material/lsfmmbpf2022-xattr.pdf
>
> Benjamin Tissoires (1):
>   btf: Add a new kfunc set which allows to mark a function to be
>     sleepable
>
> KP Singh (4):
>   bpf: kfunc support for ARG_PTR_TO_CONST_STR
>   bpf: Allow kfuncs to be used in LSM programs
>   bpf: Add a bpf_getxattr kfunc
>   bpf/selftests: Add a selftest for bpf_getxattr
>
>  include/linux/bpf_verifier.h                  |  2 +
>  include/linux/btf.h                           |  2 +
>  kernel/bpf/btf.c                              | 42 ++++++++-
>  kernel/bpf/verifier.c                         | 85 +++++++++++--------
>  kernel/trace/bpf_trace.c                      | 36 ++++++++
>  .../testing/selftests/bpf/prog_tests/xattr.c  | 58 +++++++++++++
>  tools/testing/selftests/bpf/progs/xattr.c     | 37 ++++++++
>  7 files changed, 223 insertions(+), 39 deletions(-)
>  create mode 100644 tools/testing/selftests/bpf/prog_tests/xattr.c
>  create mode 100644 tools/testing/selftests/bpf/progs/xattr.c
>
> --
> 2.37.0.rc0.104.g0611611a94-goog
>