Message ID | 20230504184349.3632259-1-sdf@google.com (mailing list archive) |
---|---|
Headers | show |
Series | bpf: Don't EFAULT for {g,s}setsockopt with wrong optlen | expand |
On 5/4/23 11:43 AM, Stanislav Fomichev wrote: > 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). Looks good. A respin is needed to address the selftest issues. The bpf CI will help to confirm that. Looking forward to v5. Thanks.
On Fri, May 5, 2023 at 3:00 PM Martin KaFai Lau <martin.lau@linux.dev> wrote: > > On 5/4/23 11:43 AM, Stanislav Fomichev wrote: > > 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). > > Looks good. A respin is needed to address the selftest issues. The bpf CI will > help to confirm that. > > Looking forward to v5. Thanks. Thank you for the review, will take a look! The part about endianness is surprising. Existing cases don't care because they are 1 byte; the new ones are 4 and should, in theory, need the flipping.