Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/softdevteam/user_rdpmc

Enable RDPMC from Linux userspace.
https://github.com/softdevteam/user_rdpmc

Last synced: 6 days ago
JSON representation

Enable RDPMC from Linux userspace.

Awesome Lists containing this project

README

        

The user_rdpmc Linux Kernel Module
==================================

A simple Linux kernel module which, when loaded, allows ring 3 (userspace)
programs to use the `RDPMC` assembler instruction by flipping the `PMC` flag in
the `CR4` register.

This module only makes sense on an x86 machine.

Building
--------

Install Linux kernel headers and run `make`.

The build currently assumes a Debian Linux system. You may have to tweak some
paths in the Makefile for other distributions.

Using
-----

First run the `test_rdpmc` program and check that the program crashes, thus
confirming that the userspace cannot invoke `RDPMC`.

Insert the module with `sudo insmod user_rdpmc.ko`. The dmesg buffer should
then display a message similar to:

```
[ 5016.743382] Enabling RDPMC from ring 3 for 4 CPUs
```

Now if you re-run the test program, it should not crash. Userspace can now
invoke `RDPMC`.

If you remove the `user_rdpmc` module, userspace is then denied use of `RDPMC`.