x86: Enable LASS support with vsyscall=xonly mode
Status from this message: The following commit has been merged into the x86/cpu branch of tip:
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
Changes in v3 from the cover letter
-------------
- Pick up review tags from Peter Anvin.
- Pick up tested-by tags from Maciej.
- Minor change in patch 1 to make the reorganized code flow similar to the original.
Patches in v3 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | x86/vsyscall: Reorganize the page fault emulation codearch/ arch/ arch/ | +39 | 0 replies | |
| 2/5 | x86/traps: Consolidate user fixups in the #GP handlerarch/ arch/ | +6 | 0 replies | |
| 3/5 | x86/vsyscall: Restore vsyscall=xonly mode under LASSarch/ arch/ arch/ | +27 | 0 replies | |
| 4/5 | x86/vsyscall: Disable LASS if vsyscall mode is set to EMULATEDocumentation/ arch/ | +8 | 0 replies | |
| 5/5 | x86/cpu: Remove LASS restriction on vsyscall emulationarch/ | +0 | 0 replies |
Reviews trailers per patch
All 5 patches have a Reviewed-by or Acked-by.
| Patch | Dave Hansen | H. Peter Anvin (Intel) | Maciej Wieczor-Retman | Rick Edgecombe |
|---|---|---|---|---|
| 1/5 | A-b | R-b | T-b | |
| 2/5 | A-b | R-b | T-b | |
| 3/5 | R-b | T-b | ||
| 4/5 | R-b | R-b | T-b | R-b |
| 5/5 | R-b | R-b | T-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.
Cover letter [PATCH v3 0/5] x86: Enable LASS support with vsyscall=xonly mode
Linear Address Space Separation (LASS) is currently disabled [1] when support for vsyscall emulation is configured. This series extends LASS support specifically to the default mode (vsyscall=xonly).
Changes in v3
-------------
- Pick up review tags from Peter Anvin.
- Pick up tested-by tags from Maciej.
- Minor change in patch 1 to make the reorganized code flow similar to the original.
Note, Peter suggested a few more changes to tighten the #PF vsyscall emulation code. I'll post those separately as they are beyond the scope of this series.
v2: https://lore.kernel.org/lkml/[email protected]/
Patches
-------
These patches were originally part of the v10 LASS series [2] before being split out into a smaller series to make it easier to review and merge. The overall approach to enable vsyscall support was okayed by Andy Lutomirski [3].
The patches are based on the tip x86/cpu branch which has the recently merged LASS-EFI series [4].
Issue
-----
Userspace attempts to access any kernel address generate a #GP when LASS is enabled. Legacy vsyscall functions are located in the address range 0xffffffffff600000 - 0xffffffffff601000. Prior to LASS, default access (XONLY) to the vsyscall page would generate a page fault and the access would be emulated in the kernel. Currently, as the #GP handler lacks any emulation support, LASS is disabled when config X86_VSYSCALL_EMULATION is set.
Solution
--------
These patches primarily update the #GP handler to reuse the existing vsyscall emulation code for #PF. In XONLY mode, the faulting RIP is readily available and can be used to determine if the #GP was triggered due to a vsyscall access.
In contrast, the vsyscall EMULATE mode is deprecated and not expected to be used by anyone. Supporting EMULATE mode with LASS would require complex instruction decoding in the #GP fault handler, which is not worth the effort. So, LASS is disabled in the rare case when someone absolutely needs to enable vsyscall=emulate via the command line.
Please find more details in the individual commit messages.
Links
-----
[1]: https://lore.kernel.org/lkml/[email protected]/
[2]: https://lore.kernel.org/lkml/[email protected]/
[3]: https://lore.kernel.org/lkml/[email protected]/
[4]: https://lore.kernel.org/lkml/[email protected]/
Sohil Mehta (5):
x86/vsyscall: Reorganize the page fault emulation code x86/traps: Consolidate user fixups in the #GP handler x86/vsyscall: Restore vsyscall=xonly mode under LASS x86/vsyscall: Disable LASS if vsyscall mode is set to EMULATE x86/cpu: Remove LASS restriction on vsyscall emulation
.../admin-guide/kernel-parameters.txt | 4 +- arch/x86/entry/vsyscall/vsyscall_64.c | 91 ++++++++++++------- arch/x86/include/asm/vsyscall.h | 13 ++- arch/x86/kernel/cpu/common.c | 15 --- arch/x86/kernel/traps.c | 12 ++- arch/x86/kernel/umip.c | 3 + arch/x86/mm/fault.c | 2 +- 7 files changed, 79 insertions(+), 61 deletions(-)
base-commit: 68400c1aaf02636a97c45ba198110b66feb270a9
Signature · 1 line
2.43.0