Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Oct 2001 13:18:37 -0500 (EST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        sobomax@FreeBSD.org
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: ports/devel/ORBit Makefile ports/devel/ORBit/files         patch-src::IIOP::giop-msg-buffer.c
Message-ID:  <Pine.NEB.3.96L.1011028122718.15623C-100000@fledge.watson.org>
In-Reply-To: <E15xtOb-0002Me-00@smtp2.port.ru>

next in thread | previous in thread | raw e-mail | index | archive | help

On Sun, 28 Oct 2001, Maxim Sobolev wrote:

> > My local Linux box has:
> > 
> >   ...
> >   linux/uio.h: *  UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
> >   ...
> >   #define UIO_MAXIOV      1024
> >   #if 0
> >   #define UIO_MAXIOV      16      /* Maximum iovec's in one operation 
> >                                      16 matches BSD */
> >                                   /* Beg pardon: BSD has 1024 --ANK */
> >   #endif
> 
> I doubt that Linux is really enforces this limit, because if it does,
> then the ORBit would be broken there as well. BTW, could you please do
> me a favor and run the following program on your Linux box and send me
> its output? It tests and reports real value of the limit. 

<snip>

Here's the output:

phoenix:/tmp/tmp> gcc -Wall -g -o o  o.c
o.c: In function `main':
o.c:10: warning: implicit declaration of function `exit'
o.c:13: warning: implicit declaration of function `close'
phoenix:/tmp/tmp> ./o 
16385

Interestingly, from the Linux source on that box:

linux-2.4/fs/read_write.c:

        /*
         * First get the "struct iovec" from user memory and
         * verify all the pointers
         */
        ret = 0;
        if (!count)
                goto out_nofree;
        ret = -EINVAL;
        if (count > UIO_MAXIOV)
                goto out_nofree;
        if (!file->f_op)
                goto out_nofree;
        if (count > UIO_FASTIOV) {
                ret = -ENOMEM;
                iov = kmalloc(count*sizeof(struct iovec), GFP_KERNEL);
                if (!iov)
                        goto out_nofree;
        }

So it really looks like, for a file readv or writev, it should reject high
count values.  Likewise the socket code:

linux-2.4/net/socket.c:

        /* do not move before msg_sys is valid */
        err = -EINVAL;
        if (msg_sys.msg_iovlen > UIO_MAXIOV)
                goto out_put;

        /* Check whether to allocate the iovec area*/
        err = -ENOMEM;
        iov_size = msg_sys.msg_iovlen * sizeof(struct iovec);
        if (msg_sys.msg_iovlen > UIO_FASTIOV) {
                iov = sock_kmalloc(sock->sk, iov_size, GFP_KERNEL);
                if (!iov)
                        goto out_put;
        }

Pointing it at a file instead of a device doesn't seem to make a
difference.

Not sure what to think :-).

Robert N M Watson             FreeBSD Core Team, TrustedBSD Project
robert@fledge.watson.org      NAI Labs, Safeport Network Services




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1011028122718.15623C-100000>