TencentOS-kernel/tools/testing
Andy Lutomirski 3cbbfad519 selftests/x86: Add a syscall_arg_fault_64 test for negative GSBASE
commit a5d25e01c8146ad8846da4760422e12242fceafe upstream.
Backport summary: for 5.4 kernel fsgsbase support.

If the kernel erroneously allows WRGSBASE and user code writes a
negative value, paranoid_entry will get confused. Check for this by
writing a negative value to GSBASE and doing SYSENTER with TF set. A
successful run looks like:

    [RUN]	SYSENTER with TF, invalid state, and GSBASE < 0
    [SKIP]	Illegal instruction

A failed run causes a kernel hang, and I believe it's because we
double-fault and then get a never ending series of page faults and,
when we exhaust the double fault stack we double fault again,
starting the process over.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/f4f71efc91b9eae5e3dae21c9aee1c70cf5f370e.1590620529.git.luto@kernel.org
(cherry picked from commit a5d25e01c8146ad8846da4760422e12242fceafe)
Signed-off-by: Ethan Zhao <Haifeng.Zhao@intel.com>
2021-08-17 06:29:11 +00:00
..
fault-injection Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
ktest ktest.pl: If size of log is too big to email, email error message 2021-03-16 16:42:19 +08:00
nvdimm tools/test/nvdimm: Fix out of tree build 2021-03-16 16:26:45 +08:00
radix-tree idr test suite: Create anchor before launching throbber 2021-05-20 16:07:06 +08:00
scatterlist Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
selftests selftests/x86: Add a syscall_arg_fault_64 test for negative GSBASE 2021-08-17 06:29:11 +00:00
vsock Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00