- Use RIP instead of X86_PF_INSTR for vsyscall emulation
- Remove ENDBR64 from FRED entry points -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEV76QKkVc4xCGURexaDWVMHDJkrAFAmjdZywACgkQaDWVMHDJ krDe9Q/+NK8z6/VePxmccG1f1pm7MfvNyt2/cllXXqLT+oNMazRJ6EG3GBw41Ii8 76G9Qd9JificBJnAKSn6QyAzxTaz9x44sx31cEjZpdKEriS6KyzszZb+fs0sISpW 3XhmiThnhgmkUguknFNyay73qgX9ZEsl5oqTJgGu7ZC6jaCW+QO7JEIonuVp2KeF qEgK9mTrvph7hRhImufBW1bAEKfpMHQT+XedDNEKElpNoPJ63Mnur/X9oSUAtlPM mWYNzmaAQgBUG2wBf0cGNOIgKtmxWHNlSPEPZDGL80b5oV6kPExrRR0AQ7xjbTh6 Nw6LOfi2wGNzzaPNHIgCjIrvkGlcPfgtMvVSB62e8V3CDarUHb8uyyLuM/QAvfyE P7REgF8Dj8AnxaIb1xbkSMPR2kyrbHlTYKI1920osXhU45XO+vBAdwOa3TYCdf9R WAjJ8p7jo8l3Gich1MIiqPVN4q5CFg0xVAVNIyrl+A/FAKDw8UC3zQoU4rdGywMA R8xvcNeAOaS+WGDvCjXs9IumQo/8VzlbylcRJgyJnQZ0Rmf+wiWK5FQxAT0iowDB BF4PMLB9eAJf1T91KYCb9OfMs3ljTuuEgbIvSpYp2Q9U70Nz9j+JqQe9NhKuJJsd Xxu264lzIeSlCBK8Qw37P82f50uDDrVyM6J3YN7kUGQZYLUaOkk= =d807 -----END PGP SIGNATURE----- Merge tag 'x86_entry_for_6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull x86 entry updates from Dave Hansen: "A pair of x86/entry updates. The FRED one adjusts the kernel to the latest spec. The spec change prevents attackers from abusing kernel entry points. The second one came about because of the LASS work[1]. It moves the vsyscall emulation code away from depending on X86_PF_INSTR which is not available on some CPUs. Those CPUs are pretty obscure these days, but this still seems like the right thing to do. It also makes this code consistent with some things that the LASS code is going to do. - Use RIP instead of X86_PF_INSTR for vsyscall emulation - Remove ENDBR64 from FRED entry points" Link: https://lore.kernel.org/lkml/20250620135325.3300848-1-kirill.shutemov@linux.intel.com/ [1] * tag 'x86_entry_for_6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/fred: Remove ENDBR64 from FRED entry points x86/vsyscall: Do not require X86_PF_INSTR to emulate vsyscall
This commit is contained in:
commit
7c738cb4ca
|
@ -16,7 +16,7 @@
|
|||
|
||||
.macro FRED_ENTER
|
||||
UNWIND_HINT_END_OF_STACK
|
||||
ENDBR
|
||||
ANNOTATE_NOENDBR
|
||||
PUSH_AND_CLEAR_REGS
|
||||
movq %rsp, %rdi /* %rdi -> pt_regs */
|
||||
.endm
|
||||
|
|
|
@ -124,7 +124,12 @@ bool emulate_vsyscall(unsigned long error_code,
|
|||
if ((error_code & (X86_PF_WRITE | X86_PF_USER)) != X86_PF_USER)
|
||||
return false;
|
||||
|
||||
if (!(error_code & X86_PF_INSTR)) {
|
||||
/*
|
||||
* Assume that faults at regs->ip are because of an
|
||||
* instruction fetch. Return early and avoid
|
||||
* emulation for faults during data accesses:
|
||||
*/
|
||||
if (address != regs->ip) {
|
||||
/* Failed vsyscall read */
|
||||
if (vsyscall_mode == EMULATE)
|
||||
return false;
|
||||
|
@ -136,13 +141,19 @@ bool emulate_vsyscall(unsigned long error_code,
|
|||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* X86_PF_INSTR is only set when NX is supported. When
|
||||
* available, use it to double-check that the emulation code
|
||||
* is only being used for instruction fetches:
|
||||
*/
|
||||
if (cpu_feature_enabled(X86_FEATURE_NX))
|
||||
WARN_ON_ONCE(!(error_code & X86_PF_INSTR));
|
||||
|
||||
/*
|
||||
* No point in checking CS -- the only way to get here is a user mode
|
||||
* trap to a high address, which means that we're in 64-bit user code.
|
||||
*/
|
||||
|
||||
WARN_ON_ONCE(address != regs->ip);
|
||||
|
||||
if (vsyscall_mode == NONE) {
|
||||
warn_bad_vsyscall(KERN_INFO, regs,
|
||||
"vsyscall attempted with vsyscall=none");
|
||||
|
|
Loading…
Reference in New Issue