[Bug 297516] sendfile: Assertion uio->uio_rw == UIO_WRITE in 32-bit compat mode

[email protected]
Newsgroups gmane.os.freebsd.bugs
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=297516

            Bug ID: 297516
           Summary: sendfile: Assertion uio->uio_rw == UIO_WRITE in 32-bit
                    compat mode
           Product: Base System
           Version: 16.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: [email protected]
          Reporter: [email protected]

Attempting to use freebsd32_sendfile on a 64-bit kernel will instantly panic as
shown below.  This is a regression.  I don't know exactly when it was
introduced, but I don't think that it was present as recently as early July.

STACK TRACE
===========

panic: Assertion uio->uio_rw == UIO_WRITE failed at
/usr/home/somers/src/freebsd.org/src/main/sys/kern/uipc_mbuf.c:2002
...
#10 0xffffffff80c3b749 in vpanic (fmt=<optimized out>,
    ap=ap@entry=0xfffffe00d86618a0)
    at /usr/home/somers/src/freebsd.org/src/main/sys/kern/kern_shutdown.c:962
        buf = "Assertion uio->uio_rw == UIO_WRITE failed at
/usr/home/somers/src/freebsd.org/src/main/sys/kern/uipc_mbuf.c:2002", '\000'
<repeats 143 times>
        __pc = 0x0
        __pc = 0x0
        __pc = 0x0
        other_cpus = {__bits = {65527, 0 <repeats 15 times>}}
        td = 0xfffff80017657000
        bootopt = <optimized out>
        newpanic = <optimized out>
#11 0xffffffff80c3b5c3 in panic (
    fmt=0xffffffff81da5280 <cnputs_mtx> "\021S,\201\377\377\377\377")
    at /usr/home/somers/src/freebsd.org/src/main/sys/kern/kern_shutdown.c:887
        ap = {{gp_offset = 32, fp_offset = 48,
            overflow_arg_area = 0xfffffe00d86618d0,
            reg_save_area = 0xfffffe00d8661870}}
#12 0xffffffff80cf2756 in mc_uiotomc (mc=mc@entry=0xfffffe00d86619b0,
    uio=0xfffff800af319b00, length=65536, lspace=lspace@entry=0, how=18,
    how@entry=2, flags=0)
    at /usr/home/somers/src/freebsd.org/src/main/sys/kern/uipc_mbuf.c:2002
        total = <optimized out>
        error = <optimized out>
        mb = <optimized out>
#13 0xffffffff80d0b280 in uipc_sosend_stream_or_seqpacket (
    so=0xfffff80124870400, addr=<optimized out>, uio0=0xfffff800af319b00,
    m=<optimized out>, c=<optimized out>, flags=0, td=0xdeadc0dedeadc0de)
    at /usr/home/somers/src/freebsd.org/src/main/sys/kern/uipc_usrreq.c:1194
        unp2 = 0xffffffff80fc95a0 <mac_socket_check_send+208>
        needsopts = 0
        mc = {mc_q = {stqh_first = 0x0, stqh_last = 0xfffffe00d86619b0},
          mc_len = 0, mc_mlen = 0}
        cmc = {mc_q = {stqh_first = 0x0, stqh_last = 0xfffffe00d8661998},
          mc_len = 0, mc_mlen = 0}
        nonblock = <optimized out>
        eor = false
        sent = 0
        aio = <optimized out>
        uio = 0xfffff800af319b00
        error = <optimized out>
        resid = 24
        so2 = <optimized out>
        sb = <optimized out>
#14 0xffffffff80cff349 in sousrsend (so=0xffffffff81da5280 <cnputs_mtx>,
    addr=0xfffffe00d86615f0, uio=0xffffffff813fb398, control=0x12, flags=0,
    userproc=0x0)
    at /usr/home/somers/src/freebsd.org/src/main/sys/kern/uipc_socket.c:2671
        len = <optimized out>
        td = <optimized out>
        saved_vnet = 0x0
        error = <optimized out>
#15 0xffffffff80cc0784 in fo_write (fp=0xfffff8001763d7d0,
    uio=0xfffff800af319b00, active_cred=0xffffffff813fb398,
    td=0xfffff80017657000, flags=<optimized out>)
    at /usr/home/somers/src/freebsd.org/src/main/sys/sys/file.h:375
No locals.
#16 kern_filewrite (td=0xfffff80017657000, fd=fd@entry=5,
    fp=0xfffff8001763d7d0, auio=auio@entry=0xfffff800af319b00,
    flags=flags@entry=0, cntp=cntp@entry=0xfffffe00d8661ce8)
    at /usr/home/somers/src/freebsd.org/src/main/sys/kern/sys_generic.c:601
        ktruio = 0x0
        cnt = 24
        error = <optimized out>
#17 0xffffffff80c38faa in vn_sendfile (fp=<optimized out>, sockfd=5,
    hdr_uio=<optimized out>, trl_uio=0xfffff800af319b00,
    offset=<optimized out>, nbytes=0, sent=0xfffffe00d8661d80, flags=0,
    td=0xfffff80017657000)
    at /usr/home/somers/src/freebsd.org/src/main/sys/kern/kern_sendfile.c:1178
        cnt = -2118685976
        sock_fp = 0xfffff8001763d7d0
        mhtail = 0xfffff80124caba00
        va = {va_type = 232, va_mode = 33207, va_bsdflags = 65535,
          va_uid = 1601310144, va_gid = 4294965249,
          va_nlink = 18446735280555793152, va_fsid = 2,
          va_fileid = 18446741875082739712, va_size = 0,
          va_blocksize = -2195392684896, va_atime = {tv_sec = -2130496517,
            tv_nsec = -2195392684896}, va_mtime = {tv_sec = -2198626811904,
            tv_nsec = 549755814128}, va_ctime = {tv_sec = 2, tv_nsec = 3},
          va_birthtime = {tv_sec = -2198626811904, tv_nsec = -8793153758464},
          va_gen = 2, va_flags = 18446741878316866800,
          va_rdev = 18446744071574695594, va_bytes = 618333444,
          va_filerev = 80, va_vaflags = 618332673, va_spare = -2195392684656}
        obj_size = 13
        tls_enq_cnt = -2048
        obj = 0xfffff800177fb1d0
        so = <optimized out>
        mh = <optimized out>
        m = 0x0
        tls = 0x0
        sbytes = <optimized out>
        hdrlen = 0
        softerr = 0
        use_ext_pgs = <optimized out>
        vp = 0xfffff8015f720dc0
        shmfd = <optimized out>
        error = 0
        pr = 0xffffffff81aed910 <streamproto>
        rem = 0
        saved_vnet = 0x0
        off = <optimized out>
        max_pgs = <optimized out>
        ext_pgs_idx = <optimized out>
        nobj_size = <optimized out>
        pga = <optimized out>
        sf = <optimized out>
#18 0xffffffff803f4808 in fo_sendfile (fp=0xffffffff81da5280 <cnputs_mtx>,
    sockfd=-664398352, hdr_uio=0xffffffff813fb398, trl_uio=0xec63ae9b24db0201,
    offset=1, nbytes=0, sent=0xfffffe00d8661d80, flags=18,
    td=0xfffff80017657000)
    at /usr/home/somers/src/freebsd.org/src/main/sys/sys/file.h:445
No locals.
#19 freebsd32_do_sendfile (td=0xfffff80017657000, uap=0xfffff80017657428,
    compat=<optimized out>)
    at
/usr/home/somers/src/freebsd.org/src/main/sys/compat/freebsd32/freebsd32_misc.c:2263
        hdtr32 = {headers = 545570880, hdr_cnt = 3, trailers = 545271984,
          trl_cnt = 2}
        hdr_uio = 0xfffff800af319b80
        trl_uio = 0xfffff800af319b00
        fp = 0xfffff80007f67c80
        rights = {cr_rights = {144115188075855885, 288230376151711744}}
        sbytes = -2195392684560
        offset = <optimized out>
        error = <optimized out>
        hdtr = <optimized out>
        iov32 = <optimized out>
#20 0xffffffff8128edc0 in syscallenter (td=0xfffff80017657000)
    at
/usr/home/somers/src/freebsd.org/src/main/sys/amd64/ia32/../../kern/subr_syscall.c:193
        se = 0xffffffff81a143a0 <freebsd32_sysent+12576>
        p = 0xfffffe013ad31000
        sa = 0xfffff80017657418
        error = <optimized out>
        sy_thr_static = <optimized out>
        traced = <optimized out>
#21 ia32_syscall (frame=0xfffffe00d8661f40)
    at
/usr/home/somers/src/freebsd.org/src/main/sys/amd64/ia32/ia32_syscall.c:231
        ksi = {ksi_link = {tqe_next = 0xfffffe00d8661e70,
            tqe_prev = 0xffffffff80cadc29 <userret+121>}, ksi_info = {
            si_signo = 134092672, si_errno = -2048, si_code = 1231,
            si_pid = 0, si_uid = 618332673, si_status = -329011557,
            si_addr = 0xfffff80017657000, si_value = {sival_int = 788352,
              sival_ptr = 0xc0780, sigval_int = 788352, sigval_ptr = 0xc0780},
            _reason = {_fault = {_trapno = 618332673}, _timer = {
                _timerid = 618332673, _overrun = -329011557}, _mesgq = {
                _mqd = 618332673}, _poll = {_band = -1413093876702707199},
              _capsicum = {_syscall = 618332673}, __spare__ = {
                __spare1__ = -1413093876702707199, __spare2__ = {392523776,
                  -2048, 12, 0, -664395984, -512, -2128813459}}}},
          ksi_flags = -664396096, ksi_sigq = 0x2}
        orig_tf_rflags = 646
        td = 0xfffff80017657000
#22 0xffffffff8119d00f in int0x80_syscall_common ()
    at
/usr/home/somers/src/freebsd.org/src/main/sys/amd64/ia32/ia32_exception.S:75

STEPS TO REPRODUCE
==================

1) Install Rust from rustup
2) rustup target install i686-unknown-freebsd
3) git clone [email protected]:nix-rust/nix.git
4) cd nix
5) cargo test --all-features --target i686-unknown-freebsd -- --test-threads=1
sendfile

-- 
You are receiving this mail because:
You are the assignee for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.