Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 May 2015 10:32:40 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        "Alexander V. Chernikov" <melifaro@freebsd.org>
Cc:        "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r283364 - head/sys/sys
Message-ID:  <3116734.QKYigSPBbf@ralph.baldwin.cx>
In-Reply-To: <2823711432562229@web7h.yandex.ru>
References:  <201505241124.t4OBOFe6030452@svn.freebsd.org> <1698551.fhQlKrx2sg@ralph.baldwin.cx> <2823711432562229@web7h.yandex.ru>

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

On Monday, May 25, 2015 04:57:09 PM Alexander V.  Chernikov wrote:
> 25.05.2015, 14:45, "John Baldwin" <jhb@freebsd.org>:
> > On Sunday, May 24, 2015 11:24:15 AM Alexander V. Chernikov wrote:
> >>  Author: melifaro
> >>  Date: Sun May 24 11:24:14 2015
> >>  New Revision: 283364
> >>  URL: https://svnweb.freebsd.org/changeset/base/283364
> >>
> >>  Log:
> >>    Fix SIOCGI2C structure requirement.
> >>
> >>    In reality, SIOCGI2C ioctl requires struct ifreq as many other
> >>    ioctls. Doing copyin() on (significantly) larger struct ifstat sometimes
> >>    triggered EFAULT.
> >>
> >>    Reported by: Olivier Cochard-Labbé <olivier at cochard.me>
> >>    MFC after: 1 week
> >
> > Note that this breaks the ABI.  You may wish to add a SIOCGI2C_OLD that
> In general, yes. Since this was not merged to -stable and I'm mostly sure that ifconfig
> is the only user - this is most likely OK.

Oh, the MFC after threw me off, I didn't realize it was never merged to
stable.  In that case compat is certainly not needed.

> > still uses the larger struct so that old programs continue to work.  OTOH,
> > they were only working by accident before.  If we expect that no code
> Well, yes. I'm wondering why this worked at all (copyout tried to get 8XX bytes instead of 32).

Well, if the ifreq was on the stack there was probably space beyond it, so it
was just a buffer overrun (in effect).

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3116734.QKYigSPBbf>