Skip to content

Theldus/mode-switch-stat

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mode switch statistics

To mitigate meltdown and spectre vulnerability, the mode switch cost was increased. mode-switch-stat is a easy infrastructure to measure the cost of mode switch. In here, one mode switch trip contains user mode to kernel mode and kernel to user. At present, this tool supports x86_64 architecture only.

Prerequisites

This tool requires Linux kernel headers and NumPy. For Ubuntu/Debian, you can install these packages in advance.

$ sudo apt install linux-headers-$(uname-r)
$ sudo apt install python3-numpy

How to build & testing

Build project:

$ git clone https://github.com/eecheng87/mode-switch-stat.git
$ cd mode-switch-stat
$ make

Testing:

$ make testing

sample output:

Model name: Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
Vulnerability Meltdown: Mitigation; PTI

Avg of mode switch takes 1921.45 cycles and standard deviation is 106.92

Common error

  1. ERROR: could not insert module msT.ko: Operation not permitted

    Solution: Disable SecureBoot (check by mokutil --sb-state)

  2. If kernel version lower than 5.7.0, please disable KALSR or modify macro KERNEL_VERSION to version lower than yours. It's also fine to comment it and force include systab.h and calculating syscall_table by adding offset to original system call table.

How to contribute

Add your output as comment in issue#1

About

Minimal tool for measuring cost of mode switch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 72.1%
  • Python 15.7%
  • Makefile 12.2%