Skip to contentSkip to conversation

The msr_safe functions and returning -EFAULT

DISCUSSION H. Peter Anvin 2 participants 3 messages Aug 30, 2009 – Sep 1, 2009

lore
Share & tools
lore
#0 lore raw

Right now, the *msr_safe() functions are returning -EFAULT. As far as I can tell, this makes absolutely no sense -- EFAULT is a nonsensical error (it means a pointer into user memory given to a system call is invalid), and the only user that seems to use this as anything other than a boolean is the MSR driver, which wants EIO.

Sending out an email in case I have missed any instances, but I'm inclined to just change this to EIO globally.

Anyone has objections?

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#1 lore raw
Quoted 11 lines · H. Peter Anvin

Right now, the *msr_safe() functions are returning -EFAULT. As far as I can tell, this makes absolutely no sense -- EFAULT is a nonsensical error (it means a pointer into user memory given to a system call is invalid), and the only user that seems to use this as anything other than a boolean is the MSR driver, which wants EIO.

Sending out an email in case I have missed any instances, but I'm inclined to just change this to EIO globally.

Anyone has objections?

I think the only rationale for EFAULT is that the *msr will fail with GP, and a GPing instruction will send a SIGSEGV to usermode, and EFAULT is the synchronous error-code equiv of SIGSEGV. Sorta.

EIO makes more sense overall. Or ENXIO.

J

#2 lore raw
Quoted 10 lines · Jeremy Fitzhardinge
Quoted 9 lines · H. Peter Anvin

Right now, the *msr_safe() functions are returning -EFAULT. As far as I can tell, this makes absolutely no sense -- EFAULT is a nonsensical error (it means a pointer into user memory given to a system call is invalid), and the only user that seems to use this as anything other than a boolean is the MSR driver, which wants EIO.

Sending out an email in case I have missed any instances, but I'm inclined to just change this to EIO globally.

Quoted 8 lines
Quoted 2 lines

Anyone has objections?

I think the only rationale for EFAULT is that the *msr will fail with GP, and a GPing instruction will send a SIGSEGV to usermode, and EFAULT is the synchronous error-code equiv of SIGSEGV. Sorta.

EIO makes more sense overall. Or ENXIO.

Well, EIO is what we want for the MSR driver, so I have just switched it to EIO across the board. As far as I can tell, there were no other users that didn't just test for error or no error.

-hpa