On Fri, Jun 12, 2020 at 3:50 AM Borislav Petkov <b...@alien8.de> wrote: > > Disable writing to MSRs from userspace by default. Writes can still be > allowed by supplying the allow_writes=1 module parameter and the kernel > will be tainted so that it shows in oopses.
Since you already added the filtering, this looks fairly sane. IOW, what MSR's do we expect people to maybe write to normally? You added MSR_IA32_ENERGY_PERF_BIAS as an allowed MST, maybe there are others? So I'm not against this, but I suspect the whitelist should be thought through more, and then maybe the "allow_writes" parameter should be yes/no/default/<msr-list>, where "default" is that list of known-normal MSR's. And I suspect it's a lot longer list than your single one. IIRC, people were working around CPU bugs or features by doing MSR writes at startup. So the first phase might be to introduce this, but have the default for non-recognized MSR's be "log", not "deny". Linus