Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Conversation

@dilinger
Copy link

As reported in issue #8 , rdmsr and wrmsr will silently mis-parse register numbers in a string format
that strtoul() doesn't understand. Pull request #12 fixes this, but the error message is not great.

This pull request includes Yazen's fix for #8 , but also updates the error messages to go to the right place (stderr) and to be more terse and also match the format of other error strings in the tools.

yghannam and others added 2 commits November 24, 2019 00:33
It's possible that a user will provide a register number in a format
that strtoul() can't parse. strtoul() will return 0 if it fails to parse
a value. The msr-tools will then silently read/write to MSR 0x0 and
succeed. At best this may confuse the user, or at worst this will
unintentionally write bad data to the system.

Check that the register number parsing has succeeded. If it fails, then
inform the user, give a suggestion, and exit.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Yazen fixed it so that invalid register strings wouldn't be silently
parsed and used, but the error message was problematic and went
to the wrong place. This sends the error to stderr, and matches the
output to look like other error messages in msr-tools.

Signed-off-by: Andres Salomon <dilinger@queued.net>
@dilinger dilinger changed the title Parse fix Register number parse fix Nov 24, 2019
@dilinger
Copy link
Author

Also, as the maintainer for msr-tools in Debian - I'd very much appreciate a new msr-tools release if you do merge this PR. It's not critical, but it would be nice to upload version 1.4 instead of 1.3git20191124etc. Thanks!

miguelinux added a commit to miguelinux/msr-tools that referenced this pull request Dec 17, 2024
Merge the following PR from https://github.com/intel/msr-tools/

* Fail to read/write if register number is not parsed correctly intel#12
  - intel#12

* Register number parse fix intel#14
  - intel#14

* msr-tools: add man pages for all utilities intel#15
  - intel#15

* Change installation directory back to historical location intel#16
  - intel#16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants