LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 06-19-2017, 04:46 AM   #1
muurs
LQ Newbie
 
Registered: Jun 2017
Posts: 2

Rep: Reputation: Disabled
Manually modify page table entry flags


Hi guys,

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?

Thanks!
 
Old 06-19-2017, 10:48 AM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,599
Blog Entries: 4

Rep: Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905
Don't monkey-around with the Linux Kernel.

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.
 
Old 06-20-2017, 11:28 AM   #3
muurs
LQ Newbie
 
Registered: Jun 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sundialsvcs View Post
Don't monkey-around with the Linux Kernel.

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.
 
Old 06-20-2017, 12:41 PM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,599
Blog Entries: 4

Rep: Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905
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.
 
Old 05-01-2020, 07:58 AM   #5
c01ahib
LQ Newbie
 
Registered: May 2020
Posts: 10

Rep: Reputation: Disabled
Is this solved?

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?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing Page Table , Process Table prabagaranvt Linux - Kernel 1 06-22-2011 07:35 PM
Modify rsnapshot backups manually brianmcgee Linux - Software 0 10-21-2009 01:54 AM
access paging table memory using another page table via MMU? valpa Linux - Kernel 8 08-26-2008 03:26 PM
Page table walk manually WebBeing Programming 0 08-05-2008 06:50 PM
How to manually modify the content of the K menu in KDE? pujolasdf Linux - Software 2 03-27-2005 11:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 05:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration