On Sun, 2008-06-15 at 23:02 +0400, Stanislav Sedov wrote: > On Fri, 06 Jun 2008 09:23:24 -0400 > Coleman Kane <cokane_at_cokane.org> mentioned: > > > 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 ? > > > > 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 information. > In fact it might be even performed from userland if one will find a way > to bind the process to a specific cpu. > > > On Fri, 6 Jun 2008 09:14:13 +1000 > Peter Jeremy <peterjeremy_at_optushome.com.au> mentioned: > > > ENOSYS generally means "system call not implemented". You need a response > > implying that the requested operation isn't supported on the hardware. > > IMHO, ENODEV comes closest to that. > > > > Yeah, it seems that ENODEV is a better choice. > > > I also agree with phk_at_ 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. > > 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 - > 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. > > The latest version of the patch against recent HEAD is available at > ftp://ftp.SpringDaemons.com/dustheap/cpuctl.3.diff > > Thanks! > -- Coleman Kane
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:32 UTC