[PATCH bpf-next v2 0/4] bpf: Don't EFAULT for {g,s}setsockopt with wrong optlen

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

 



optval larger than PAGE_SIZE leads to EFAULT if the BPF program
isn't careful enough. This is often overlooked and might break
completely unrelated socket options. Instead of EFAULT,
let's ignore BPF program buffer changes. See the first patch for
more info.

In addition, clearly document this corner case and reset optlen
in our selftests (in case somebody copy-pastes from them).

Stanislav Fomichev (4):
  bpf: Don't EFAULT for {g,s}setsockopt with wrong optlen
  selftests/bpf: Update EFAULT {g,s}etsockopt selftests
  selftests/bpf: Correctly handle optlen > 4096
  bpf: Document EFAULT changes for sockopt

 Documentation/bpf/prog_cgroup_sockopt.rst     | 57 ++++++++++++-
 kernel/bpf/cgroup.c                           | 12 +++
 .../selftests/bpf/prog_tests/sockopt.c        | 80 +++++++++++++++++--
 .../progs/cgroup_getset_retval_getsockopt.c   | 12 +++
 .../progs/cgroup_getset_retval_setsockopt.c   | 16 ++++
 .../selftests/bpf/progs/sockopt_inherit.c     | 16 +++-
 .../selftests/bpf/progs/sockopt_multi.c       | 24 +++++-
 .../selftests/bpf/progs/sockopt_qos_to_cc.c   |  8 +-
 .../testing/selftests/bpf/progs/sockopt_sk.c  | 25 ++++--
 9 files changed, 230 insertions(+), 20 deletions(-)

-- 
2.40.1.495.gc816e09b53d-goog




[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