Date: Sun, 15 Jun 2008 15:26:39 -0400 From: Coleman Kane <cokane@FreeBSD.org> To: Stanislav Sedov <stas@FreeBSD.org> Cc: Rui Paulo <rpaulo@FreeBSD.org>, Poul-Henning Kamp <phk@phk.freebsd.dk>, kib@FreeBSD.org, current@FreeBSD.org, Peter Jeremy <peterjeremy@optushome.com.au> Subject: Re: cpuctl(formely devcpu) patch test request Message-ID: <1213557999.1816.15.camel@localhost> In-Reply-To: <20080615230250.7f3efae4.stas@FreeBSD.org> References: <20080606020927.8d6675e1.stas@FreeBSD.org> <10261.1212703949@critter.freebsd.dk> <20080606025533.8322ee08.stas@FreeBSD.org> <1212758604.1904.33.camel@localhost> <20080615230250.7f3efae4.stas@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--=-9AWGgl6Mt8h4oK4E0sZM Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Sun, 2008-06-15 at 23:02 +0400, Stanislav Sedov wrote: > On Fri, 06 Jun 2008 09:23:24 -0400 > Coleman Kane <cokane@cokane.org> mentioned: >=20 > > What about using the API in priv(9) or similar, such as is done in the > > mlock(2)/munlock(2) code in sys/vm/vm_mmap.c ? > >=20 >=20 > This is really a good idea. I've added a bunch of priv checks to cpuctl > code, namely PRIV_CPUCTL_RDMSR, PRIV_CPUCTL_WRMSR and PRIV_CPUCTL_UPDATE. > Names are self-describing. CPUID ioctl doesn't need that check as this > operation are entirely safe and doesn't disclose any sensitive informatio= n. > In fact it might be even performed from userland if one will find a way > to bind the process to a specific cpu. >=20 >=20 > On Fri, 6 Jun 2008 09:14:13 +1000 > Peter Jeremy <peterjeremy@optushome.com.au> mentioned: >=20 > > ENOSYS generally means "system call not implemented". You need a respo= nse > > implying that the requested operation isn't supported on the hardware. > > IMHO, ENODEV comes closest to that. > > >=20 > Yeah, it seems that ENODEV is a better choice. > =20 > > I also agree with phk@ that serious thought needs to be given to the > > foot-shooting capability offered by this patch before it is implemented= . > > Maybe add a sysctl to enable the write (at least) functionality - eg > > hw.cpuctl.wrmsr_enable and hw.cpuctl.update_enable (both defaulting to > > disabled). This at least adds a safety catch. I'm not sure if RDMSR > > is dangerous - if so, possibly there should be an enable for it as well= . >=20 > I don't think that extra anti foot-shooting checks are needed: you can't > easily fire up your system via ioctl(2) interface. At least, a little > programming exercise is required. What's regarding microcode updates -=20 > there's a lot of checks if the microcode image valid in update utility, > also the cpu itself checks the microcode CRC before applying update. I think the anti-foot-shooting measures referred to above were also taking into consideration for security reasons. It might be valuable for someone to be able to configure this feature to be rdmsr-only, thereby limiting potential harm vectors in the event that an attacker is likely to crack access to the system for supervisory privileges. This would be a legitimate consideration to make, especially so that the module could at least provide a sane "safe operating mode" to those that would benefit from read-only access. So, for example, I would consider most crackers to be skilled enough to inject an ioctl call somewhere, even if the primary user of the system is not so skilled., but they want to use software written by others that makes use of this interface. >=20 > The latest version of the patch against recent HEAD is available at > ftp://ftp.SpringDaemons.com/dustheap/cpuctl.3.diff >=20 > Thanks! >=20 --=20 Coleman Kane --=-9AWGgl6Mt8h4oK4E0sZM Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkhVbOsACgkQcMSxQcXat5fDkQCfZ2kkzL7POnBUz4L07tVTEAzL rPcAn1w5BpodYPEYXdNMp9rMj+V45qMO =UZBd -----END PGP SIGNATURE----- --=-9AWGgl6Mt8h4oK4E0sZM--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1213557999.1816.15.camel>