bpf: Don't EFAULT for {g,s}setsockopt with wrong optlen
Status from this message: This series was applied to bpf/bpf-next.git (master)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v6 Latest4 patches 1 replyApplied 4/4
- v54 patches 0 repliesSuperseded
- v44 patches 4 repliesSuperseded
Earlier versions · 2
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v3 | 4 patches | 3 replies | Superseded | |
| v2 | 4 patches | 10 replies | Superseded |
Changes in v6 from the cover letter
- no changes; resending due to screwing up v5 series with the unrelated patch
Patches in v6 All 4 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | bpf: Don't EFAULT for {g,s}setsockopt with wrong optlenkernel/ | +15 | 0 replies | Applied |
| 2/4 | selftests/bpf: Update EFAULT {g,s}etsockopt selfteststools/ | +93 | 1 reply | Applied |
| 3/4 | selftests/bpf: Correctly handle optlen > 4096tools/ tools/ tools/ +7 more | +166 | 0 replies | Applied |
| 4/4 | bpf: Document EFAULT changes for sockoptDocumentation/ | +56 | 0 replies | Applied |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.
Cover letter [PATCH bpf-next v6 0/4] bpf: Don't EFAULT for {g,s}setsockopt with wrong optlen
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).
v6:
- no changes; resending due to screwing up v5 series with the unrelated patch
v5:
- goto in the selftest (Martin)
- set IP_TOS to zero to avoid endianness complications (Martin)
v4:
- ignore retval as well when optlen > PAGE_SIZE (Martin)
v3:
- don't hard-code PAGE_SIZE (Martin)
- reset orig_optlen in getsockopt when kernel part succeeds (Martin)
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 | 15 +++ .../bpf/prog_tests/cgroup_getset_retval.c | 20 ++++ .../selftests/bpf/prog_tests/sockopt.c | 99 +++++++++++++++- .../bpf/prog_tests/sockopt_inherit.c | 59 +++------- .../selftests/bpf/prog_tests/sockopt_multi.c | 108 +++++------------- .../bpf/prog_tests/sockopt_qos_to_cc.c | 2 + .../progs/cgroup_getset_retval_getsockopt.c | 13 +++ .../progs/cgroup_getset_retval_setsockopt.c | 17 +++ .../selftests/bpf/progs/sockopt_inherit.c | 18 ++- .../selftests/bpf/progs/sockopt_multi.c | 26 ++++- .../selftests/bpf/progs/sockopt_qos_to_cc.c | 10 +- .../testing/selftests/bpf/progs/sockopt_sk.c | 25 ++-- 13 files changed, 330 insertions(+), 139 deletions(-)
Signature · 1 line
2.40.1.521.gf1e218fcd8-goog