gpt4 book ai didi

arm - 与 LDR 相比,LDTR 等 ARM 非特权加载存储指令的应用是什么?

转载 作者:行者123 更新时间:2023-12-02 03:04:47 26 4
gpt4 key购买 nike

我今天第一次遇到 LDTR ARMv8 指令。

我在 ARMv8 DB 上阅读了它的描述手册部分C3.2.5“非特权加载/存储”,据我了解,它基本上允许EL1在EL0限制下进行内存访问。

此功能的应用是什么?

这是否会让利用内核错误使内核将数据写入错误地址的攻击变得更加困难?

考虑到通常有多个进程同时运行,LDTR 如何知道要使用哪个页表转换?或者这些限制是否涉及与页表上指定的权限无关的其他类型的权限?

最佳答案

此链接为您提供了用例示例:https://developer.arm.com/documentation/102376/0100/Permissions-attributes

[...] a hypervisor can see all the resources that are allocated to a virtual machine. This is because executing at a higher exception level means that the level of privilege is also higher.

However, this is not always desirable. Malicious applications might try to trick an OS into accessing data on behalf of the application, which the application should not be able to see. This requires the OS to check pointers in systems calls.

The Arm architecture provides several controls to make this simpler. First, there is the PSTATE.PAN (Privileged Access Never) bit. When this bit is set, loads and stores from EL1 (or EL2 when E2H==1) to unprivileged regions will generate an exception (Permission Fault) [...]

Sometimes the OS does need to access unprivileged regions, for example, to write to a buffer owned by an application. To support this, the instruction set provides the LDTR and STTR instructions.

LDTR and STTR are unprivileged loads and stores. They are checked against EL0 permission checking even when executed by the OS at EL1 or EL2. Because these are explicitly unprivileged accesses, they are not blocked by PAN [...]

This allows the OS to distinguish between accesses that are intended to access privileged data and those which are expected to access unprivileged data. This also allows the hardware to use that information to check the accesses.

关于arm - 与 LDR 相比,LDTR 等 ARM 非特权加载存储指令的应用是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59287799/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com