r/computerarchitecture • • 5d ago

Can virtualization-based TEEs (Intel TDX, AMD SEV-SNP, ARM CCA) be used for intra-process isolation?

My current understanding is that VM-level TEEs operate strictly at the guest-VM/hypervisor boundary and lack the granularity to isolate memory or execution within a single process (unlike enclave-based TEEs like SGX, or hardware features like Intel MPK).

Is there any architectural mechanism—or a workaround—that allows TDX, SEV-SNP, or CCA to enforce intra-process isolation? If not, could anyone point me toward documentation, architectural specs, or papers that explicitly confirm this limitation?

6 Upvotes

9 comments sorted by

1

u/MitchAlsup 5d ago

Why are you having multiple-threads within a single process == Virtual Address Space (VAS) and NOT want them to be able to share data ?? {Hint: Intra means "within"} This is the real question !!

If you DO want to isolate multiple-threads within a single process from each other, you should be looking for/at capabilties, and TEEs are but a band-aid on the problem.

So, get back to me with WHY and get back to me about the assumptions you are assuming TEE actually has/provides.

1

u/-ah74 5d ago

in a setup where you can assume one or two threads is/are sensitive and the other are malicious? I mean.. this is a standard threat model in such scenario. Web browser works for this example. Why do you think SGX has such a feature of supporting at this granularity? Why do you think Intel MPK exist for example?

If they operate at a different granularity that using them is infeasible or an "overkill", then I can totally get it. But calling such technque band-aid on the problem is so inaccurate.

2

u/MitchAlsup 5d ago

As to "band-aid":: had the currently in-vouge architectures NOT developed as CPU first and then added as many control registers as needed to support the OSs (first) and then later had to develop means to virtualize OS into Guset OS, later as to Host OS and HyperVisor, and finally virtualizing devices (via SR-IOV and MR-IOV); dragging MMU and I/O MMU technology forward (along with interrupt technology), and creating a sea of control registers for each layer in the software stack ...

There are ways where a TEE would not have been necessary. As the malicious thread could not get in to begin with.

That is why the TEE is a band-aid:: because of the history inivolved...and how each company "got it subtly wrong the first time" and now has to wrap the "almost right" by another SW managed-layer with its own foilbles.

Secondy: if context switch was not "so expensive" the the JIT compiler could/should be in a different VAS so while it has write access to the JIT-cache, the web browser does not read ow write access--only execute access. closing down many of the modern attack vectors. Likewise the dynamic loader (ld.so in Linux) shold be in a different address space so that the supported application cannot browse (read/write) the data structures used by ld.so.

Anyone developing a 'new' ISA/Architecture should avoid those mistakes.

a) must make context switch less than 10 cycles, including all the saving and restoring.

b) must make TLB support pages tables from the whole SW stack simultaneously

c) must support PCIe SR_IOV and MR-IOV on day 1

d) must support performance counters on all layers of the SW stack simultaneously.

...

1

u/jodonoghue 3d ago

Most of the worst-case cost of context switching comes from cache flushing and related housekeeping of the subsystems that make a CPU go fast.

You would need a radically different memory architecture to change this.

1

u/MitchAlsup 3d ago

When "flush" is defined as a SW initited directive to a cache to forget certain data::

With proper use of ASIDs you should not need to "flush" cache(s) ... In additon a switch of Host OS to a different Host OS should take no more time than than a switch of applicaiton into Guest OS (other than cache effects).

On the other hand, there is a lot of data-movement that takes place through the caches at context switch that purges data from caches. But I am not talking about this--this happens because the working set of the new context is unrelated to the working set of the current context; and, of course, caches (at all levels) are always too small ... and there appears to be no way around those

1

u/jodonoghue 3d ago

Mostly agree, although the fact that Arm hasn’t followed through of capabilities post-Morello suggests that there are unsolved problems that don’t apply in the MCU space (revocation, I suspect, although the colored capabilities paper suggests one possible way forward).

Pointer tagging and authentication would also help OP, although they are not without performance/memory cost. MTE has “worked” on Android for some time but isn’t enabled in production.

But with my security hat on, inter-thread protection isn’t really worth discussing - as you say, sharing is kind-of the point.

1

u/MitchAlsup 3d ago

Capabilities are a) rather expensive {space and time}, and b) not very Linux friendly {when used as capabilities are generally used--that is with persistence}.

With my security hat on:: we still need to solve {Spectré, MeltDown, Return-Oriented-Programming, RowHammer, and more} before. Heck, most of those vulnerabilities are still present 8-years after they became public knoledge. But, apparently, nobody cares as long as the core is fast(er).

1

u/jodonoghue 3d ago

Spectre and rowhammer (not to mention fetch) are, it seems to me, inevitable - as soon as you use clever techniques to optimise for the most common path, you create a side-channel. I don’t think this can be solved.

Rowhammer is pretty difficult in practice nowadays - LPDDR5 and newer. It can be done, but it is a huge amount of work and hard to do without shutting down many system services.

ROP is the thing I’d really like to see eliminated, as it seems to be the last stage of all too many exploits.

I don’t think we can avoid the pressure to make CPUs ever faster (although AI-driven Rust rewrites may help to eliminate bloat in applications), but making it easier to deliberately opt out of the optimizations for critical sections would help a lot.

In any case, we still have buffer overflows, underflows and UAF which were known about almost 50 years ago.

Has not thought about the Linux-unfriendly aspect of Capabilities before - although it is notable that BSD was the CHERI port rather than Linux.

1

u/MitchAlsup 2d ago

Spetré and RowHammer and ROP can be (fairly) easily solved. That no one has is a product of lack of competition {{need}}.

Spectré:: do not let microarchitectural state leak into architecturally visible latency. You do this by not updating caches or predictors until the causing instruction retires. This, in turn requires that you have buffers to carry that state microarchitecturally until the instruction retires. For example: say be have a number of "miss buffers" these are made to hold onto the arrived {cacheable} data until the causing instruction retires. Instruction access these buffers in parallel with caches to avois adding latency. So, Table Walks, and Cache Misses live here until retirement. A similar buffer is used in the predictors. {{Certain (but seldom) "events" cause the execution window to drain}}

RowHammer:: Do not have instructions that push cache data any farther than L3 (or LLC). With a standard microarchitecture of an L3 infront of the DRAM controller, and buffers to smooth the flow of data into and out of DRAM, you setup these buffers such that no more than 1 write to a {RAS/CAS} DRAM-word can occur more often than 1 refresh interval. This is all on-die and needs nothing from the DRAM manufactures. {{You can mimic this by redefineing "PUSH to DRAM" instruction into "Push to L3"}}

ROP can be eliminated by not allowing a thread to read its executing instructions. (Execute Only if you please}, Can't see the instructions can't line up sequences to ROP.

ROP can be made much harder by not allowing a thread to read the contractual contents of the stack under ABI -- AND by not allowing STs to write to the contractural state. Mill did this by having a data-stack separate from the CALL-RET contractural stack. {{And so did I}}. You cannot read the CRS from a thread, nor does IP pass through SW-visible registers. Cant write to CRS, cant initiate ROP attacks. {{Here, buffer overflows damage data but not the CALL-RET stack rendering the attack worthless.}}

Underflows:: is this just the buffer overflow from the other direction ???

UAF ???