Relatively deterministic panic with sendfile(2) when running tests in the sxlock code
Enji Cooper (yaneurabeya)
yaneurabeya at gmail.com
Tue Oct 16 01:55:07 UTC 2018
> On Oct 15, 2018, at 6:10 AM, Gleb Smirnoff <glebius at freebsd.org> wrote:
>
> Enji,
>
> can you please check that with this patch all your tests pass?
Hi Gleb!
It almost compiled. I just needed to dereference the `so` pointer:
$ git diff /usr/src/sys/kern/kern_sendfile.c
diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c
index 438069aa721..50404ce5745 100644
--- a/sys/kern/kern_sendfile.c
+++ b/sys/kern/kern_sendfile.c
@@ -526,6 +526,8 @@ sendfile_getsock(struct thread *td, int s, struct file **sock_fp,
*so = (*sock_fp)->f_data;
if ((*so)->so_type != SOCK_STREAM)
return (EINVAL);
+ if (SOLISTENING(*so))
+ return (ENOTCONN);
return (0);
}
After I applied that and rebuilt the kernel, it doesn’t panic anymore (and it fails with the correct errno).
Thank you so very much :)!
-Enji
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20181015/c8dbe687/attachment.sig>
More information about the freebsd-net
mailing list