Code Monkey home page Code Monkey logo

libcpuidoverride's Introduction

libcpuidoverride

A shim dynamic loader for overriding CPUID, using processor support for CPUID faulting on Ivy Bridge+, and the Linux kernel support for ARCH_GET_CPUID / ARCH_SET_CPUID subfunctions on 4.12+. This was implemented using a shim dynamic loader instead of e.g. LD_PRELOAD, because glibc 2.26+ performs CPU feature detection within the dynamic loader itself, which is too early to intercept with LD_PRELOAD.

Writeup: https://www.dcddcc.com/blog/2019-05-01-processor-cpuid-faulting-and-dynamic-loader-interposing.html

Overridable CPUID features: SSE, SSE2, SSE3, SSSE3, SSE41, SSE42, AVX, AVX2, AVX512, HLE, RTM.

Usage

cp <binary> <patch_binary>
patchelf --set-interpreter <absolute path>/libcpuidoverride.so <patch_binary>
NO_<feature>=1 <patch_binary>

For example, to disable AVX2 for the cpuid binary:

cp `which cpuid` patched_cpuid
patchelf --set-interpreter `pwd`/libcpuidoverride.so patched_cpuid
NO_AVX2=1 patched_cpuid

Alternatively, build with -Wl,--dynamic-linker=<absolute path>/libcpuidoverride.so.

libcpuidoverride's People

Contributors

ddcc avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.