Re: [patch 01/10] x86/fpu/signal: Clarify exception handling in restore_fpregs_from_user()

From: Borislav Petkov
Date: Mon Aug 30 2021 - 16:07:25 EST


On Mon, Aug 30, 2021 at 09:33:42PM +0200, Borislav Petkov wrote:
> I guess you wanna fixup the comment over XSTATE_OP() too and perhaps
> mention ex_handler_fault() explicitly so that one can make her/his way
> around the code and pinpoint quickly where it sticks that exception
> number into rAX.

Diff ontop. I think it should not say anything about X86_TRAP_PF or
EFAULT or any other error value but simply that it returns one. It is
callers' task to act upon the specific error value returned.

---
diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h
index 5771af87e4b4..d59bc5df7438 100644
--- a/arch/x86/include/asm/fpu/internal.h
+++ b/arch/x86/include/asm/fpu/internal.h
@@ -199,7 +199,7 @@ static inline void fxsave(struct fxregs_state *fx)

/*
* After this @err contains 0 on success or the negated trap number when
- * the operation raises an exception. For faults this results in -EFAULT.
+ * the operation raises an exception, see ex_handler_fault().
*/
#define XSTATE_OP(op, st, lmask, hmask, err) \
asm volatile("1:" op "\n\t" \

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette