swapgs指令

Searching…

www.felixcloutier.com

SWAPGS — Swap GS Base Register - felixcloutier.com

SWAPGS exchanges the current GS base register value with the value contained in MSR address C0000102H (IA32_KERNEL_GS_BASE). The SWAPGS instruction is a privileged instruction intended for use by system software.

zhuanlan.zhihu.com

Linux Kernel 源码学习:PER_CPU 变量、swapgs及栈切换(一)

当进程从用户态进入内核态时,需要使用 swapgs 指令将 IA32_KERNEL_GS_BASE 寄存器中的内容加载 gs.base,使其指向内核专用地址;反之,进程离开内核态进入用户态时,同样需要使用 swapgs 指令将 IA32_GS_BASE 寄存器中的内容加载至 gs.base。

wiki.osdev.org

SWAPGS - OSDev Wiki

SWAPGS To facilitate using GS to store kernel data (its 'original' intention was to be used in conjunction with SYSCALL/SYSRET), a 'SWAPGS' instruction is present in long mode, which swaps the values in the KernelGSBa...

cloud.tencent.com

Video — click to view

Jun 23, 2020 · 在什么情况下应该使用swapgs指令? swapgs指令通常在哪些场景下被调用? 如何正确使用swapgs指令? 嗨,我是一个核心学习者,有一些关于swapgs的问题。 根据AMD的文档,它交换了 gs.base 隐藏寄存器和KernelGSBase MSR。

blog.csdn.net

Linux...

Mar 5, 2025 · 文章浏览阅读1.8k次,点赞50次,收藏26次。在 Linux Kernel 中,x86-64 系统调用占据着至关重要的地位。系统调用是用户空间程序与内核进行交互的主要机制。与普通函数调用相比,存在着显著的区别。首先,普通函数调用是直接调用,比如在代码中一个函数调用另一个函数,对应的机器指令是 call 指令 ...

bbs.kanxue.com

[原创]KERNEL PWN状态切换原理及KPTI绕过 - kanxue

Apr 18, 2020 · 总结一下: 在提权时,当我们使用sysret指令从内核态中返回前,我们需要先设置rcx为用户态rip,设置r11为用户态rflags,设置rsp为一个用户态堆栈,并执行swapgs交换GS寄存器。 在这之前你需要了解内存分页机制。

linuxkernel.org.cn

7. 内核入口 — Linux 内核文档 - Linux 内核

) 处理 swapgs 指令尤其棘手。 Swapgs 切换 gs 是内核 gs 还是用户 gs。 swapgs 指令相当脆弱:它必须完美嵌套并且仅在单个深度中嵌套,它应该仅在从用户模式进入内核模式时使用,然后在返回到用户空间时才使用,并且必须精确地这样使用。

www.codeleading.com

x86 SWAPGS - 代码先锋网

1、关于swapgs指令,手册描述如下: When FS and GS segment overrides are used in 64-bit mode, their respective base addresses are used in the linear address calculation: (FS or GS).base + index + displacement. FS.base and GS.base ar...

blog.csdn.net

64位Linux中断处理中的SWAPGS指令解析-CSDN博客

Sep 19, 2019 · 文章浏览阅读3.8k次。在中断或异常处理的entry代码处, 会执行SWAPGS切换到kernel GS, GS.base 是存储了中断stack 的地址。1、关于swapgs指令,手册描述如下:When FS and GS segment overrides are used in 64-bit mode, their respective base addresses are used in th...