Re: Relatively deterministic panic with sendfile(2) when running tests in the sxlock code

From: Enji Cooper (yaneurabeya) <"Enji>
Date: Mon, 15 Oct 2018 18:55:02 -0700
> 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
_at__at_ -526,6 +526,8 _at__at_ 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

Received on Mon Oct 15 2018 - 23:55:07 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:18 UTC