r/C_Programming • u/Salat_Leaf • 23d ago
Question How to manipulate read-restricted data (possibly without OS)?
Imagine you have some block of code/data chunk that under no circumstances must never ever get read (rewrites are not critical, since the data is basically gone). There's a thing about Execute only memory, but afaik it requires OS support.
So how do we make sure some of the data is only overriden or executed (if interpreted as machine code) but never read? If possible, it would be nice to be able to set up some custom restrictions like a very specific offset in a program which has access to some data in memory for a one-time constant address read (imagine it compiles into assembly, something like mov %(rax), %rax, then does side-channel secure stuff and overrides the data with rdrand and stuff)
Appreciate any help! which doesn't include redditor behavior in its body
View all comments
Show parent comment
1
u/onlyonequickquestion 23d ago
I was googling it because I'd never really thought about it before, by the time I got back, looks like others have answered. I found Intel sgx might work? Most solutions seemed hardware dependent though. Sounds like some other people have more experience and will be able to give you a better answer. Good luck, sounds like a fun problem to crack.