From eldon@dbs.ifom-firc.it Fri Jun 23 09:58:54 2006 Return-Path: Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7207316A49A for ; Fri, 23 Jun 2006 09:58:54 +0000 (UTC) (envelope-from eldon@dbs.ifom-firc.it) Received: from mail.ifom-firc.it (mail.ifom-firc.it [85.239.175.131]) by mx1.FreeBSD.org (Postfix) with ESMTP id A10A843D45 for ; Fri, 23 Jun 2006 09:58:53 +0000 (GMT) (envelope-from eldon@dbs.ifom-firc.it) Received: (qmail 6693 invoked by uid 811); 23 Jun 2006 09:59:34 -0000 Received: from 85.239.175.67 by mail.ifom-firc.it (envelope-from , uid 803) with qmail-scanner-1.25 (clamdscan: 0.88.2/1562. f-prot: 4.4.2/3.14.11. spamassassin: 3.1.3. Clear:RC:1(85.239.175.67):. Processed in 0.163549 secs); 23 Jun 2006 09:59:34 -0000 Received: from unknown (HELO dbs.ifom-firc.it) ([85.239.175.67]) (envelope-sender ) by smtp.ifom-firc.it (qmail-ldap-1.03) with SMTP for ; 23 Jun 2006 09:59:34 -0000 Received: (from eldon@dbs.ifom-firc.it) by dbs.ifom-firc.it (mini_sendmail/1.3.6 29jun2005); Fri, 23 Jun 2006 11:58:51 CEST (sender eldon@dbs.ifom-firc.it) Message-Id: <20060623095853.A10A843D45@mx1.FreeBSD.org> Date: Fri, 23 Jun 2006 09:58:53 +0000 (GMT) From: Valerio Daelli valerio.daelli@gmail.com Reply-To: Valerio Daelli valerio.daelli@gmail.com To: FreeBSD-gnats-submit@freebsd.org Cc: Subject: man page of sendmsg(2) does not include EINVAL X-Send-Pr-Version: 3.113 X-GNATS-Notify: >Number: 99356 >Category: docs >Synopsis: man page of sendmsg(2) does not include EINVAL >Confidential: no >Severity: non-critical >Priority: low >Responsible: ru >State: analyzed >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Fri Jun 23 10:00:34 GMT 2006 >Closed-Date: >Last-Modified: Sun Jan 13 19:33:24 UTC 2008 >Originator: Valerio Daelli >Release: FreeBSD 5.4-RELEASE-p12 i386 >Organization: IFOM >Environment: System: FreeBSD dbs.ifom-firc.it 5.4-RELEASE-p12 FreeBSD 5.4-RELEASE-p12 #0: Thu Mar 2 15:40:11 CET 2006 root@dbs.ifom-firc.it:/usr/obj/usr/src/sys/DBS i386 >Description: The man page of sendmsg(2) does not include EINVAL as possible error value. EINVAL is a possible error value as it appears in then sendit() function in /usr/src/sys/kern/uipc_syscalls.c >How-To-Repeat: man sendmsg >Fix: >Release-Note: >Audit-Trail: Responsible-Changed-From-To: freebsd-doc->rwatson Responsible-Changed-By: ru Responsible-Changed-When: Thu Oct 12 18:40:19 UTC 2006 Responsible-Changed-Why: Robert, can you please look into this? POSIX says that EINVAL may be returned if "the sum of the iov_len values overflows an ssize_t". I see a similar code in FreeBSD: for (i = 0; i < mp->msg_iovlen; i++, iov++) { if ((auio.uio_resid += iov->iov_len) < 0) { error = EINVAL; goto bad; } } except the type of uio_resid in FreeBSD is "int". (On NetBSD, it's size_t.) http://www.freebsd.org/cgi/query-pr.cgi?pr=99356 State-Changed-From-To: open->analyzed State-Changed-By: rwatson State-Changed-When: Sun Jan 13 19:28:16 UTC 2008 State-Changed-Why: Follow-up e-mail with analysis forthcoming. The man page does need to be updated to take into account this and other EINVAL cases. There are also some cases in specific protocols where EINVAL can be returned. http://www.freebsd.org/cgi/query-pr.cgi?pr=99356 From: Robert Watson To: Ruslan Ermilov Cc: FreeBSD-gnats-submit@FreeBSD.org Subject: Re: docs/99356: man page of sendmsg(2) does not include EINVAL Date: Sun, 13 Jan 2008 19:26:50 +0000 (GMT) On Thu, 12 Oct 2006, Ruslan Ermilov wrote: > Synopsis: man page of sendmsg(2) does not include EINVAL > > Responsible-Changed-From-To: freebsd-doc->rwatson > Responsible-Changed-By: ru > Responsible-Changed-When: Thu Oct 12 18:40:19 UTC 2006 > Responsible-Changed-Why: > Robert, can you please look into this? POSIX says that EINVAL > may be returned if "the sum of the iov_len values overflows an > ssize_t". I see a similar code in FreeBSD: > > for (i = 0; i < mp->msg_iovlen; i++, iov++) { > if ((auio.uio_resid += iov->iov_len) < 0) { > error = EINVAL; > goto bad; > } > } > > except the type of uio_resid in FreeBSD is "int". (On NetBSD, > it's size_t.) We can also return EINVAL if msg_controllen is less than the minimum size of a valid cmesg (which must include a struct cmsghdr). Robert N M Watson Computer Laboratory University of Cambridge Responsible-Changed-From-To: rwatson->ru Responsible-Changed-By: rwatson Responsible-Changed-When: Sun Jan 13 19:33:04 UTC 2008 Responsible-Changed-Why: Assign back to Ruslan now he's had my incredibly tardy response. http://www.freebsd.org/cgi/query-pr.cgi?pr=99356 >Unformatted: