当前位置:网站首页>Think about the possibility of attacking secure memory through mmu/tlb/cache
Think about the possibility of attacking secure memory through mmu/tlb/cache
2022-06-13 02:12:00 【Code changes the world CTW】
Quick links :
.
Personal blog notes guide Directory ( All )
explain :
By default , This article is all about ARMV8-aarch64 framework
Related links :
ARM trustzone Learning and summary - One is enough
When designing the security architecture , We are Core and DDR There's an extra TZC As memory filter, The data stream is :Core ---> TZC---->DDR, Under this structure ,core Read / write to secure memory initiated as an unsecure , Will be TZC Block .

But this is in the ideal situation , in fact Core Initiate read / write to memory , Not necessarily through TZC Not necessarily DDR, It is possible to arrive at cache The stage is over , That is, data flow becomes Core ---> MMU(TLB+Addtress Translation)---->Cache, So in this case , No, TZC Thing , You might say MMU/Cache There are NS The bit , But you really understand here NS The use of bits ? If core When a read or write is initiated to a secure memory as an unsecure , I force MMU The security attribute flag bit in the page table is forcibly changed to NS=0, How will? ?

In fact, we just need to figure out the principle 、 Clear the data flow , Would not ask the above question S13 The problem. . Let's begin to analyze :
Suppose a security core Read a secure physical memory 0x2000_0000 data ( The virtual address may be 0x_xxxx_xxxx), Then there will be a behavior :
- Before reading and writing , It must be done MMU map, Such as physical address 0x2000_0000 MAP a 0x_xxxx_xxxx Address , here Page Descriptor Medium atrribute Medium
NS=0 - TLB Cache the translation , namely TLB Of entry Contained in the :
0x2000_0000、0x_xxxx_xxxx、NS=0 - Safe memory 0x2000_0000 The data will be cached to cache in ,entry Medium TAG contain
0x2000_0000、NS=0
meanwhile , I have a non safe core Initiate read / write virtual address 0x_yyyy_yyyy, I modify the table on this page by myself , Give Way 0x_yyyy_yyyy Force mapping to secure physical memory 0x2000_0000, There are two configurations :
(1)、0x_yyyy_yyyy—0x2000_0000, NS=0
(2)、0x_yyyy_yyyy—0x2000_0000, NS=1
Let's look at the two configurations respectively , Whether the safe memory can be read :
in the light of (1), Not safe core Initiate a visit , Find out TLB The entry in is 0x_yyyy_yyyy—0x2000_0000, NS=0, Nature will not be hit , And then use Address Translation transformation ,MMU Unsafe... Found Core To access security properties NS=0 Will be rejected directly .
in the light of (2), Not safe core Initiate a visit , because NS=1,TLB May be hit , That is, it can translate 0x2000_0000 Physical address , Even if you don't get hit , after Address Translation transformation , because NS=1, At this time, you can also correctly convert the correct 0x2000_0000 Physical address . Then I will go to cache Query this address in , But at this time cache Of entry Medium NS=0, therefore cache Will not be hit , The next step is to go TZC The flow , Obviously , You are a non safe core Want to access safe memory ,TZC Will stop you .
in summary : Safety is safety , Stop thinking about loopholes .
边栏推荐
- Combining strings and numbers using ssstream
- LabVIEW large project development tools to improve quality
- [learning notes] xr872 GUI littlevgl 8.0 migration (file system)
- Basic exercise of test questions Yanghui triangle (two-dimensional array and shallow copy)
- 16 embedded C language interview questions (Classic)
- 华为设备配置私网IP路由FRR
- [51nod.3210] binary Statistics (bit operation)
- [sequence structure, branch structure, loop structure, continue statement, break statement, return statement] (learning Note 6 -- C language process control)
- Use mediapipe+opencv to make a simple virtual keyboard
- Configuring virtual private network FRR for Huawei equipment
猜你喜欢

Application circuit and understanding of BAT54C as power supply protection

Combining strings and numbers using ssstream
![[pytorch]fixmatch code explanation - data loading](/img/0f/1165dbe4c7410a72d74123ec52dc28.jpg)
[pytorch]fixmatch code explanation - data loading

Why is Huawei matebook x Pro 2022 leading a "laptop" revolution

Calculation of accuracy, recall rate, F1 value and accuracy rate of pytorch prediction results (simple implementation)
![[work with notes] NDK compiles the open source library ffmpeg](/img/24/ed33e12a07e001fc708e0c023e479c.jpg)
[work with notes] NDK compiles the open source library ffmpeg

In addition to the full screen without holes under the screen, the Red Devils 7 series also has these black technologies

STM32 sensorless brushless motor drive

Mac使用Docker安装Oracle

What did Hello travel do right for 500million users in five years?
随机推荐
[printf function and scanf function] (learning note 5 -- standard i/o function)
[keras] generator for 3D u-net source code analysis py
Application circuit and understanding of BAT54C as power supply protection
SQL server deletes all tables and all stored procedures in the database
华为设备配置私网IP路由FRR
ROS learning-6 detailed explanation of publisher programming syntax
Learning notes 51 single chip microcomputer keyboard (non coding keyboard and coding keyboard, scanning mode of non coding keyboard, independent keyboard, matrix keyboard)
蓝牙模块:使用问题集锦
json,xml,txt
How to solve the problem of obtaining the time through new date() and writing out the difference of 8 hours between the database and the current time [valid through personal test]
【LeetCode-SQL】1532. Last three orders
反爬虫策略(ip代理、设置随机休眠时间、哔哩哔哩视频信息爬取、真实URL的获取、特殊字符的处理、时间戳的处理、多线程处理)
SWD debugging mode of stm32
Laptop touch pad operation
Number of special palindromes in basic exercise of test questions
Leetcode daily question - 890 Find and replace mode
[the second day of the actual combat of the smart lock project based on stm32f401ret6 in 10 days] light up with the key ----- input and output of GPIO
Review the history of various versions of ITIL, and find the key points for the development of enterprise operation and maintenance
The fastest empty string comparison method C code
Why is "iFLYTEK Super Brain 2030 plan" more worthy of expectation than "pure" virtual human