History

x86, prctl: Hook L1D flushing in via prctl

Use the existing PR_GET/SET_SPECULATION_CTRL API to expose the L1D flush capability. For L1D flushing PR_SPEC_FORCE_DISABLE and PR_SPEC_DISABLE_NOEXEC are not supported. Enabling L1D flush does not check if the task is running on an SMT enabled core, rather a check is done at runtime (at the time of flush), if the task runs on a SMT sibling then the task is sent a SIGBUS which is executed before the task returns to user space or to a guest. This is better than the other alternatives of: a. Ensuring strict affinity of the task (hard to enforce without further changes in the scheduler) b. Silently skipping flush for tasks that move to SMT enabled cores. Hook up the core prctl and implement the x86 specific parts which in turn makes it functional.

Balbir Singh committed 5 years ago

Commit e893bb11 parent b5f06f62 files · +34 −0Browse files

Showing the changes to include/uapi (1 of 2 files). Show all

Unified · Split

include/uapi/linux/prctl.h+1−0
@@ -213,6 +213,7 @@ struct prctl_mm_map { · 212 unmodified lines
213/* Speculation control variants */213/* Speculation control variants */
214# define PR_SPEC_STORE_BYPASS 0214# define PR_SPEC_STORE_BYPASS 0
215# define PR_SPEC_INDIRECT_BRANCH 1215# define PR_SPEC_INDIRECT_BRANCH 1
216# define PR_SPEC_L1D_FLUSH 2
216/* Return and control values for PR_SET/GET_SPECULATION_CTRL */217/* Return and control values for PR_SET/GET_SPECULATION_CTRL */
217# define PR_SPEC_NOT_AFFECTED 0218# define PR_SPEC_NOT_AFFECTED 0
218# define PR_SPEC_PRCTL (1UL << 0)219# define PR_SPEC_PRCTL (1UL << 0)