Page MenuHomeFreeBSD

Disallows SCTP socket for sendfile()
ClosedPublic

Authored by tuexen on Mar 13 2020, 11:19 AM.
Tags
None
Referenced Files
F132357949: D24059.diff
Thu, Oct 16, 5:11 AM
Unknown Object (File)
Wed, Oct 15, 6:46 AM
Unknown Object (File)
Sat, Oct 11, 1:35 AM
Unknown Object (File)
Mon, Sep 22, 10:51 PM
Unknown Object (File)
Thu, Sep 18, 8:04 PM
Unknown Object (File)
Sep 13 2025, 11:16 PM
Unknown Object (File)
Sep 12 2025, 9:55 AM
Unknown Object (File)
Sep 12 2025, 6:40 AM
Subscribers

Details

Summary

SCTP sockets were or were not supported by sendfile() in the past. However, at least since the rewrite of sendfile(), SCTP sockets can't be used in combination with sendfile(). So fail such calls indicating EINVAL.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/kern/kern_sendfile.c
581 ↗(On Diff #69473)

What exactly is the problem?

sys/kern/kern_sendfile.c
581 ↗(On Diff #69473)

Haven't looked at it, never used sendfile in combination with SCTP. If I remember it correctly, when @glebius rewrote the code, we had to do some changes related to sb_acc and sb_ccc. Right now we use

#define sb_cc sb_acc

At that point there was a discussion (if I remember it correctly) between rrs@ and glebius@ whether sendfile worked with SCTP before the rewrite or not. However, sendfile support doesn't work with SCTP sockets now as you can see in your syzkaller instance.
If you look at traces were SCTP is involved, you will find a set of crashes where calling sendfile() on an SCTP is involved. I want to mitigate these problems.

markj added inline comments.
sys/kern/kern_sendfile.c
581 ↗(On Diff #69473)

I see. Right, SCTP does not implement pru_ready, which is certainly a prerequisite.

This revision is now accepted and ready to land.Mar 13 2020, 5:12 PM
This revision was automatically updated to reflect the committed changes.