Date: Thu, 28 Sep 2006 02:12:51 +0400 From: Ruslan Ermilov <ru@freebsd.org> To: John Baldwin <jhb@freebsd.org> Cc: cvs-src@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/dev/atkbdc atkbd.c src/sys/dev/digi digi.c src/sys/dev/kbdmux kbdmux.c src/sys/dev/syscons scvidctl.c syscons.c src/sys/dev/uart uart_kbd_sun.c src/sys/dev/usb ukbd.c src/sys/dev/vkbd vkbd.c src/sys/fs/procfs procfs_ioctl.c ... Message-ID: <20060927221251.GA35467@rambler-co.ru> In-Reply-To: <200609271752.57082.jhb@freebsd.org> References: <200609271957.k8RJv25Z028902@repoman.freebsd.org> <200609271710.51869.jhb@freebsd.org> <20060927212949.GB83490@rambler-co.ru> <200609271752.57082.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 27, 2006 at 05:52:56PM -0400, John Baldwin wrote: > Could you avoid IOWINT by just assuming that any _IO() ioctl is getting a= n int=20 > as the arg? >=20 There are some _IO() ioctls that pass a pointer to variable sized data, and their ioctl handlers to uiocopy'ing rather than ioctl(). See sys/cam/scsi/scsi_ses.c, SESIOC_* ioctls for one such example. > If an ioctl doesn't use the arg, then you don't lose anything..=20 > do we have any ioctl's that use the arg directly but not as an int? >=20 Unfortunately yes. > The=20 > ioctl(2) manpage implies that 'data' is either a pointer or an int. If y= ou=20 > go this route, you avoid changing all the ioctl values, basically just as= sume=20 > that IOC_VOID means the argument is an int. >=20 That has been considered and found impossible due to the above. We also don't have any spare bits left in the ioctl type field, so IOC_VOID with size =3D=3D sizeof(int) have been used to implement _IOWINT(). IOC_VOID is incorrect name, the argument should either be a pointer or an "int", even when not used by ioctl(). Some ioctl() calls to "void" ioctls in userland don't pass a third argument. I think on architectures that pass arguments on the stack (such as i386) this causes return address to be accessed instead of the argument value. Ioctls that are "void" should either pass "0" or "NULL". Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --BOKacYhQ+x31HxR3 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFGvdjqRfpzJluFF4RAs1RAJ41dFGKesyGojO26HDtr+Wq44sENQCeIp95 8s+w943o2ylJHs2QuGbsisY= =Llm5 -----END PGP SIGNATURE----- --BOKacYhQ+x31HxR3--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060927221251.GA35467>