Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
a couple days ago I asked a question on Stackoverflow about how I can manually modify page table entries (my code has a bug somewhere, see the Stackoverflow post).
Sadly, no-one could give me an answer. Does anyone here have an idea what the issue might be?
Don't introduce a kernel module that does anything which the rest of the kernel does not expect. If the kernel does not now provide an internal facility that does what you want – or that can be safely be made to do what you want on all architctures(!) that the kernel now supports, then you need to be discussing this requirement with the kernel developers directly.
Don't introduce a kernel module that does anything which the rest of the kernel does not expect. If the kernel does not now provide an internal facility that does what you want – or that can be safely be made to do what you want on all architctures(!) that the kernel now supports, then you need to be discussing this requirement with the kernel developers directly.
Thanks! In general I could not agree more with your answer
I want to use this in an attack on Intel SGX processors as part of a research project, which is a highly unusual situation. It need not be stable nor run on different architectures - it just needs to work for this particular case, no matter how hacky it is.
If anyone has an idea how I could get this working, please let me know.
You should start by carefully studying the kernel code that manages the page tables now. Remember also that you must purge TLB caches on the chip and that you must consider all cores or CPUs. The existing code already does this correctly. The very serious problem is going to be that your modifications could be wiped-out by other code in the kernel that (of course) has no notion of them.
I am trying to disable the caching for the Linux operating system only, i.e., Kernel space. I figured out that there are two ways to do this:
1- Using MTRR: This turned out to be infeasible as MTRR allow disabling caching for ranges of physical addresses. I am using a 64bit Tinycore Linux on x86_64, which means that kernel space can be mapped to the whole RAM (unlike 32bit systems where space maps to low physical memory).
2- Using PAT: This seems to be the better option as it works on virtual pages. However I am not sure whether I should use the IA32_PAT register and how? or modify the page table entries for kernel pages and how?
Did you ever solve this problem? can your code be used to disable caching for kernel only? could anyone provide full code for disabling cache for kernel space only or at least instructions from using IA32_PAT or modifying page table entries?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.