'How does the Linux kernel temporarily disable x86 SMAP in copy_from_user?

I want to know how the Linux kernel disables x86 SMAP when executing the copy_from_user() function. I tried to find something in source code, but I failed.

Supervisor Mode Access Prevention (SMAP) is a security feature of x86 CPUs to prevent the kernel from accessing unintended user-space memory, which helps to fend off various exploits.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source