Hi everyone!
I think there's an error in the documentation for Control-Protection Error Codes in AMD64 Architecture Programmer's Manual, Volume 2, 8.4.3: According to the docs error code 4 means that "A SETSSBSY instruction encountered an invalid supervisor shadow stack token.". In my experience however, I see this error code when a RSTORSSP instruction fails to execute. This would align with Intel's docs which says that a failing RSTORSSP instruction is indeed signaled by error code 4 (in Intel's doc error code 3 is used for errors around ENDBRANCH which isn't supported by AMD products yet AFAICT). Linux also interprets error code 4 as a failing RSTORSSP instruction: https://github.com/torvalds/linux/blob/8d8d276ba2fb5f9ac4984f5c10ae60858090babc/arch/x86/kernel/cet..... Are the docs wrong here? Should they really say error codes 4 and 5 for RSTORSSP and SETSSBSY instead of 3 and 4?
Regards,
Tom