脚热是什么原因| 寒战是什么症状| 吃胡萝卜有什么好处| ddp是什么化疗药| 书香是什么意思| 桑叶泡水喝有什么好处| 牛肉不能跟什么一起吃| 小乌龟吃什么| 圆脸适合什么发型好看| 独立户口需要什么条件办理| 测骨龄去医院挂什么科| 爱因斯坦是什么学家| 拔萝卜是什么意思| 宫保鸡丁宫保是指什么| 香港五行属什么| 堂哥的女儿叫什么| 华法林是什么药| 右胳膊发麻是什么原因| 吼不住是什么意思| 手心有痣代表什么意思| 卵巢疼是什么原因| 口蜜腹剑是什么意思| 女性阴部潮湿是什么原因| 装孙子是什么意思| mr是什么检查| 儿童牙龈肿痛吃什么药| 经常拉肚子吃什么药好| 树大招风的意思是什么| 吃什么受孕率又快又高| 下眼睑肿胀是什么原因| 什么人容易得焦虑症| 1990年什么命| 无缘无故吐血是什么原因| 绿豆和什么不能一起吃| 羊属于什么科| 宝宝不爱喝水有什么好的办法吗| 尿的是白色米汤是什么病| 孕妇梦见黑蛇是什么意思| 什么力气| nike是什么意思| 大便脂肪球是什么意思| 中午吃什么饭家常菜| 辟谣是什么意思| 甘油三酯高说明什么| 头皮痒用什么洗头好| 灵枢是什么意思| 大便为什么是绿色的| peaches是什么意思| 澳门为什么叫澳门| 例假淋漓不尽是什么原因造成的| 嘴干是什么病的征兆| 毡房是什么意思| C反应蛋白高是什么原因| 棚户区改造和拆迁有什么区别| 起什么转什么成语| 胳膊疼是什么病的前兆| 土字旁的字与什么有关| 撮箕是什么意思| 给猫咪取什么名字好听| 什么是丛林法则| 验血能查出什么病| 喜新厌旧是什么生肖| 突然发胖要警惕什么病| 海豹吃什么| 尿酸高吃什么药降尿酸效果好| 鳞状上皮细胞是什么| 捆是什么意思| 时来运转是什么生肖| 屁股上有痣代表什么| 宜余事勿取是什么意思| 外围女是什么意思| 腮腺炎不能吃什么东西| 人体最大的排毒器官是什么| 1998年五行属什么| 胃反酸吃什么| acs是什么意思| 隆胸有什么危害和后遗症吗| 为什么会有甲状腺结节| 1月23日是什么星座| 脉浮是什么意思| 推拿是什么意思| 腹泻能吃什么| 榴莲是什么季节的水果| fic是什么意思| 吃什么都咸是什么原因| 清新的什么| 为什么会得结石| 平顶山为什么叫平顶山| 微波炉不能用什么容器| 治疗阴虱子用什么药最好| 腹泻什么意思| 手脚发麻是什么原因| 羊内腰和外腰分别是什么| dady是什么意思| 姘头是什么意思| 乞巧节是什么节| 为什么小便会带血| 女人右手中指有痣代表什么| 女累读什么| 睾丸痒是什么原因| 肠道有息肉有什么症状| 手抖是因为什么| 咖啡豆是什么动物粪便| 比例是什么| 为什么叫印度阿三| 西京医院什么科室最强| 9.29是什么星座| 贫血三项是指什么检查| 银饰为什么会变黑| 天什么海什么| 舌苔发白是什么原因| 鸡蛋加什么吃壮阳持久| 求购是什么意思| 为什么会肚子痛| 低密度脂蛋白高有什么危害| 失眠看什么科| 子宫前置是什么意思| 缘分是什么意思| 脸小适合什么发型| 36什么意思| 东莞有什么好玩的地方| 航班号是什么| 尿道口下裂是什么样子| 荷兰机场叫什么| 牛肉炒什么好吃| 腹水是什么症状| 沙棘是什么植物| 再接再厉是什么意思| 狗狗尾巴下垂代表什么| 属鸡的适合干什么行业最赚钱| 小211是什么意思| 在水一方什么意思| 2004属什么生肖| 硬膜囊前缘受压是什么意思| 七手八脚是什么意思| slow什么意思| 荔枝什么人不能吃| 小气道病变是什么意思| sp什么意思| 夏至节气吃什么| 毫无保留什么意思| 什么人吃天麻最好| 三年级用什么笔| 佛家思想的核心是什么| 胎盘位置低有什么危险| 胃下垂有什么症状表现| 周武王叫什么名字| 蓝色加什么颜色是紫色| 尾盘放量拉升意味着什么| 印堂发红是什么的征兆| 心季是什么原因| 刷牙时牙酸是什么原因| 上午11点是什么时辰| 肝郁脾虚是什么意思| 卡其色是什么颜色| 朝鲜冷面是什么面| 北京中秋节有什么活动| 氯化钠是什么| 眼睛充血用什么眼药水| 成语是什么意思| 吩可以组什么词| 什么是天葬| 是什么数学符号| 什么是小暑| 用什么挠脚心最痒| 明矾和白矾有什么区别| 为什么拉尿会刺痛| 杰五行属什么| 安排是什么意思| 涤塔夫是什么面料| 童五行属什么| 二月初二是什么星座| 高密度脂蛋白低是什么原因| 医院查过敏源挂什么科| 蛇舌草有什么功效| 小孩老是咬手指甲是什么原因| ab血型和o型生的孩子是什么血型| 白手起家是什么生肖| 身上起红疙瘩是什么| 甲功五项查的是什么| 天麻与什么煲汤最好| 僵尸肉吃了有什么危害| 女生问你喜欢她什么怎么回答| 金鱼吃什么食物| 天方夜谭是什么生肖| 胸有成竹是什么生肖| 什么逼人| 朗字五行属什么| 四个月宝宝可以吃什么辅食| 血脉是什么意思| 什么是内分泌失调| 射手女跟什么星座最配| 甲减长期服用优甲乐有什么危害| 长智齿一般什么年龄| 首鼠两端是什么意思| 水蛭是什么动物| 拔牙需要注意什么| 肠易激综合征中医叫什么| 15点是什么时辰| 碱性磷酸酶偏低是什么意思| 右眼袋跳动是什么原因| 浊气是什么| 肌肉萎缩是什么症状| 后年是什么生肖| 肝实质回声不均匀是什么意思| 秋天有什么花| 做梦梦见被蛇咬是什么意思| 生气胸口疼是什么原因| 什么东西清肺最好| 胎动频繁是什么原因| 体脂率是什么| 鲁迅的原名叫什么| 1996年属什么的| 豆豉是什么| 安享晚年是什么意思| 小孩打喷嚏流鼻涕吃什么药| 为什么吃了饭就想睡觉| 做什么业务员好| 禄存是什么意思| 性出血是什么原因造成的呢要怎么办| 女人梦到被蛇咬是什么意思| 烟酰胺有什么作用| 总打嗝是什么原因| 乌唇是什么原因| 霉菌性阴炎用什么药止痒效果好| 什么是原发性高血压| 线索是什么意思| mnm是什么单位| 做梦梦见蜘蛛是什么意思| 精炼植物油是什么油| 扭伤挂什么科| 梦见猫吃老鼠什么意思| 皮肤软组织感染是什么意思| 1度房室传导阻滞是什么意思| 吉祥三宝是什么意思| 头晕有点恶心是什么原因| 朱砂痣代表什么| 龙虾不能和什么一起吃| 耳道发炎用什么药| 翡翠对人体有什么好处| 死是什么意思| 怀孕天数从什么时候算起| 什么为笑| 舌根发麻是什么原因| 清炖鸡放什么调料| 睡觉手麻是什么原因引起的女人| 富贵竹开花什么预兆| 赶的偏旁是什么| 避孕套和安全套有什么区别| 众望所归是什么意思| 女同是什么意思| 喝白酒有什么好处| 水痘疫苗第二针什么时候打| 什么药补肾壮阳| 头一直摇晃是什么病| 社会科学院是干什么的| 为什么印度人叫阿三| 多囊是什么原因造成的| 巾帼不让须眉什么意思| 女男是什么字| 检查阑尾炎挂什么科| 浮躁是什么意思| 2月8日什么星座| 脾脏切除后有什么影响| 百度
|
|
Subscribe / Log in / New account

Please consider subscribing to LWN 百度 原标题:最高人民检察院依法决定对冀文林立案侦查相关新闻:  东方网7月18日消息:日前,最高人民检察院经审查决定,依法对海南省原副省长冀文林以涉嫌受贿罪立案侦查并采取强制措施。

Subscriptions are the lifeblood of LWN.net. If you appreciate this content and would like to see more of it, your subscription will help to ensure that LWN continues to thrive. Please visit this page to join up and keep LWN on the net.

January 18, 2019

This article was contributed by Marta Rybczyńska

Hardware memory encryption is, or will soon be, available on multiple generic CPUs. In its absence, data is stored — and passes between the memory chips and the processor — in the clear. Attackers may be able to access it by using hardware probes or by directly accessing the chips, which is especially problematic with persistent memory. One new memory-encryption offering is Intel's Multi-Key Total Memory Encryption (MKTME) [PDF]; AMD's equivalent is called Secure Encrypted Virtualization (SEV). The implementation of support for this feature is in progress for the Linux kernel. Recently, Alison Schofield proposed a user-space API for MKTME, provoking a long discussion on how memory encryption should be exposed to the user, if at all.

Filesystem encryption options offer a wide choice of possibilities; their use is now standard practice in a number of settings, protecting user data when it is at rest. On the other hand, data stored in main memory is kept in the clear, as are exchanges between memory chips and the processors. In a virtualized environment, if attackers can find a way to read memory from neighbor virtual machines, they can access the data from those machines. Physical attacks are possible by removing memory chips or spying on the memory buses. This is becoming a more serious threat with persistent-memory technologies, where the data stays in the clear even after power is removed. Memory-encryption technologies are aiming to address some of those attacks.

Memory encryption has been available in Intel chips for some time in the form of Total Memory Encryption (TME). It uses a single, CPU-generated key for all of memory; users can control the usage of TME in the boot-level firmware. A new standard, which will be available in upcoming chips, is MKTME, an extension of TME that supports different encryption settings (including disabling encryption) at the page level, and more keys. Different keys can be used at the same time for different memory regions. The main use case for MKTME seems to be adding more protection in systems with multiple virtual machines (see these slides from LinuxCon China [PDF]). The encryption algorithm supported is AES-XTS 128 with the physical address being taken into account as a type of nonce.

Lower-level support for MKTME in the Linux kernel was submitted in September 2018. Memory encryption was also one of the subjects discussed at the 2018 Linux Storage, Filesystem, and Memory-Management Summit. The recent patch set from Schofield goes further, adding the user interface to set up the encryption and (optionally) keys, assign key identifiers to memory regions; the patch set also adds a key store to support CPU hotplug.

encrypt_mprotect()

Setting up MKTME requires a few steps: create a key, map a region of anonymous memory, and enable the encryption. The key is created and added to the kernel keyring using the add_key() helper function from the keyutils library. It requires the key type and key material (if the key is not to be generated by the CPU) and additional, specific options. Then the user should map a region of anonymous memory with mmap(), then use a new system call to enable protection.

That new system call is encrypt_mprotect(). It takes the same parameters as mprotect() with addition of a key serial number. The prototype is:

    int encrypt_mprotect(unsigned long start, size_t len,
                         unsigned long prot, key_serial_t serial);

An example showing the use of the new system call was submitted with the patch set.

API alternatives, key changes and cache state

Andy Lutomirski expressed a number of objections to the API in its proposed form. The first point was about the new system call, which he described as "an incomplete version of mprotect()" due to its lack of support for memory protection keys. Its only function is to change the encryption key while, he said, the most secure usage is to stick with the CPU-generated key.

He also had doubts about the safety of swapping encrypted memory. The kernel's direct-mapping area, which maps all of physical memory directly into the kernel's address space, can also be the source of cache-coherency issues. Problems could arise because the user's mapping and the kernel's direct mapping will have different keys for the same memory, so data corruption may occur. He doubted that MKTME should be used with anonymous memory (memory not backed up by a file or a device). As a solution, he proposed a different approach: instead of a generic API, there should be specific interfaces for persistent memory and virtual-machine hardening.

Dave Hansen responded, explaining the logic behind the API proposal. The goal of adding the new system call was to allow it to stack with the generic mprotect() and pkey_mprotect(), rather than replacing those other calls. The cache-coherency issues are expected to be avoided by careful reference counting in the VMAs before issuing the PCONFIG instruction that changes the key. He also promised to find out why the user-provided keys had been included.

Dan Williams pointed out that the persistent-memory code only needs to access the encrypted version of the data, so it never uses the direct mapping and can safely move blocks without considering the keys.

Further in the discussion Hansen noted that the persistent-memory use case, which requires a user-supplied key, is reasonable, but it is not covered by the current patch set; he proposed to postpone it until that part is done. Other developers, like Jarkko Sakkinen also asked questions, including about what happens if a key changes suddenly. The answer is that it might result in data corruption if the right cache flushes are missing. The discussion ended for now without a clear conclusion on either the API or the main use case for this feature.

User keys and CPU hotplug

The MKTME code tries not to save any key material longer than needed, so the kernel destroys user-supplied key data once the hardware has been programmed. That leads to a potential problem, though: the kernel will need those keys if a new CPU comes online. This problem was solved by setting up an optional storage for key data in kernel memory. When the mktme_savekeys kernel command line option is enabled, the code uses this store. Otherwise, new CPUs are not allowed if any user-supplied keys are in use.

The saving of encryption keys caused questions; Kai Huang asked if CPU-hotplug support is that important as storing the keys can make them susceptible to cold boot attacks. He noted that there are configurations where the kernel does not support CPU hotplug, and suggested that a per-socket key ID may be a solution. Kirill Shutemov didn't like the idea, as it would add complexity in the MKTME code that would need to keep track of nodes. It would also complicate memory management, especially in the case of memory migration. The solution has not been yet found; the next version of the patch will have to try to resolve the issue.

The security model for virtual-machine isolation

There have been multiple discussions around the security model of MKTME and how the feature is expected to be used, especially in comparison with TME. The developers concentrated on various exploits and malicious code that might try to override the protection.

Lutomirski noted that MKTME does not protect against malicious accesses between virtual machines, as the memory controller does not know where any given access comes from. Sakkinen agreed; he does not see TME making virtual-machine isolation any better. Hansen responded that MKTME does not provide protection when the attacking code can execute code inside the hypervisor. Also, when the kernel keeps non-encrypted mappings of memory that also has encrypted mappings, the attacker may be able to read the memory via the non-encrypted mappings. To avoid those problems, Lutomirski is proposing to reuse the exclusive page-frame ownership mechanism so that the direct mapping page is removed when memory is allocated for user space.

The discussion on the security model covered both virtual machines and CPUs. Interested readers may also refer to a a research paper [PDF] on SEV subversion.

Conclusions

The addition of MKTME support provoked a number of different opinions on how to support the feature. A consensus has not been reached yet and the final implementation may turn out to be different than what has been proposed so far. The discussion shows how difficult it is sometimes to create a good API. The main work the developers have to do now is to understand the use cases better and agree on an interface that will cover those needs. We are likely going to see more iterations of this patch and more discussion in the near future.


Index entries for this article
KernelMemory management/Memory encryption
GuestArticlesRybczynska, Marta


to post comments

A proposed API for full-memory encryption

Posted Jan 19, 2019 1:08 UTC (Sat) by jdulaney (subscriber, #83672) [Link] (2 responses)

I wonder how long it will take to find the various government backdoors.

A proposed API for full-memory encryption

Posted Jan 19, 2019 2:31 UTC (Sat) by khim (subscriber, #9252) [Link]

Is kernel actually secure enough to warrant plugging them in? Historically all OSes were buggy enough that it was simpler and cheaper to just look for holes left by developers.

A proposed API for full-memory encryption

Posted May 2, 2019 14:19 UTC (Thu) by judas_iscariote (guest, #47386) [Link]

Why they will even bother with this ? there are gazillions of bugs more easily exploited !

A proposed API for full-memory encryption

Posted Jan 20, 2019 16:15 UTC (Sun) by Freeaqingme (subscriber, #103259) [Link] (3 responses)

I wonder how widespread the use of CPU hotplugging is, especially on bare metal. I've always seen it as a rather obscure use case that perhaps occasionally used in mainframes or something. If that's the case, one could simply say that at first memory encryption is not supported when cpu hotplugging is enabled.

But perhaps my idea of the popularity of the cpu hotplugging functionality is wrong?

A proposed API for full-memory encryption

Posted Jan 20, 2019 22:07 UTC (Sun) by janfrode (subscriber, #244) [Link]

Switching between SMT modes on Power8/9 is probably a form of CPU hotplugging, and it’s very common to do on job setup in HPC.

A proposed API for full-memory encryption

Posted Jan 21, 2019 14:55 UTC (Mon) by naptastic (guest, #60139) [Link]

I've never physically removed a CPU from a running system, but I've used CPU hotplugging as a heavy-handed power/thermal management tool before.

A proposed API for full-memory encryption

Posted Jan 27, 2019 1:20 UTC (Sun) by flussence (guest, #85566) [Link]

It's needed for ACPI suspend.

A proposed API for full-memory encryption

Posted Jan 20, 2019 20:42 UTC (Sun) by jcm (guest, #18262) [Link] (10 responses)

Anyone able to confirm if the solutions out there currently encrypt all coherency traffic between sockets as well? They certainly should but I'm not certain the initial generations do that.

A proposed API for full-memory encryption

Posted Jan 22, 2019 12:39 UTC (Tue) by kiryl (subscriber, #41516) [Link] (2 responses)

MKTME encryption doesn't cover any traffic within socket or between them. It's all plain text. Only traffic to/from memory is encrypted.

A proposed API for full-memory encryption

Posted Jan 23, 2019 0:30 UTC (Wed) by luto (guest, #39314) [Link] (1 responses)

I hope that SGX protects coherency traffic between sockets.

A proposed API for full-memory encryption

Posted Jan 23, 2019 3:53 UTC (Wed) by Paf (subscriber, #91811) [Link]

Why, though? What potential exploit(s) does that cover?

A proposed API for full-memory encryption

Posted Jan 22, 2019 16:56 UTC (Tue) by Paf (subscriber, #91811) [Link] (3 responses)

I'm also not sure I see the point of encrypting cross-socket communications. What is that supposed to protect against?

A proposed API for full-memory encryption

Posted Jan 23, 2019 6:34 UTC (Wed) by zdzichu (subscriber, #17118) [Link] (2 responses)

15 years ago, Microsoft Xbox console was hacked by sniffing traffic on memory bus.

A proposed API for full-memory encryption

Posted Jan 23, 2019 13:55 UTC (Wed) by Paf (subscriber, #91811) [Link] (1 responses)

So, physical intrusion. Ok! I was concerned as I can’t think of any software level stuff for this, and this makes more sense.

A proposed API for full-memory encryption

Posted Jan 26, 2019 19:35 UTC (Sat) by biergaizi (guest, #92498) [Link]

This should eventually fix the cold-boot attack.

A proposed API for full-memory encryption

Posted Jan 22, 2019 18:52 UTC (Tue) by sbates (subscriber, #106518) [Link]

The encryption hardware discussed in this article is integrated into the memory controller(s). So it only affects data as it leaves the coherent bus and heads out to off-chip memory (typically DRAM). This serves two purposes.

1. No plaintext on the DDR bus. Though I’d argue if a black hat has physical access to your DDR bus you have bigger problems ;-).

2. Assuming different keys for each process (or VM) leaking memory from one process to another does not reveal user data.

For inter-SMP buses only 1 is an issue. So I’d argue it’s less critical to encrypt the chip to chip busses than the chip to memory busses. Now I’d argue this holds less and less as these busses scale out so things like OpenGenCCIX might need encryption...

A proposed API for full-memory encryption

Posted Jan 23, 2019 17:31 UTC (Wed) by james (subscriber, #1325) [Link] (1 responses)

The Real World Tech forums debated inter-socket encryption last month.

As usual with forums, it's difficult to ensure posters are who they say they are, but someone calling himself Aaron Spink said:

The simple reality is that you aren't going to MitM any high speed link without a custom board and multiple millions of dollars of large bulky equipment. You can't just put some contacts onto the board and get a viable working signal.
and
AFAIK, no one actually does link level encryption in the field currently for a variety of reasons (not the least of which is that end to end is much simpler and robust).

Presumably, the point is that modern point-to-point high speed connections are designed to run as fast as possible over as few wires as possible. A third device on the link would change the electrical characteristics to the point that the link just wouldn't work -- if it didn't, the link isn't going fast enough.

A proposed API for full-memory encryption

Posted Jan 31, 2019 18:46 UTC (Thu) by jlarrew (guest, #71330) [Link]

The EPYC server line from AMD does inline AES encryption for the cross-socket links.

A proposed API for full-memory encryption

Posted Feb 1, 2019 16:07 UTC (Fri) by timmu_india (subscriber, #71682) [Link]

Does Intel Management Engine has visibility to the encryption steps that happens inside CPU? IME is a huge security hole already.

Request : How to test Total memory enrcyption feature in Latest Ubuntu OS (22.04)

Posted Oct 21, 2022 1:25 UTC (Fri) by Sridha (guest, #161207) [Link]

Hi
Any can help to me for TME testing.

How to test Total memory enrcyption feature in Latest Ubuntu OS (22.04)

Thanks /Sridhar


Copyright © 2019, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds

送护士女朋友什么礼物 滑膜炎吃什么药好 身上到处痒是什么原因 scarves什么意思 为什么白天尿少晚上尿多
积分落户是什么意思 特朗普为什么叫川普 赤小豆和红豆有什么区别 坚字五行属什么 黑洞是什么东西
复印病历需要什么证件 月光蓝是什么颜色 百合有什么作用与功效 s代表什么意思 上呼吸道感染用什么药
牛和什么生肖最配 精液带血是什么原因 什么是调剂 喝酒拉肚子吃什么药 每次上大便都出血是什么原因
杀虫剂中毒有什么症状hcv9jop4ns4r.cn mlf操作是什么意思hcv9jop3ns4r.cn 男性hpv检查挂什么科hcv8jop6ns4r.cn 陈赫为什么离婚hcv9jop6ns3r.cn 王为念和王芳什么关系hcv9jop1ns5r.cn
无的放矢是什么意思hcv7jop6ns1r.cn 清关中是什么意思hcv8jop1ns4r.cn 6.15是什么日子hcv8jop8ns3r.cn 摄政王是什么意思hcv8jop7ns0r.cn 药流可以吃什么水果weuuu.com
名字为什么不能叫安然hcv9jop2ns6r.cn 阴道红肿是什么原因hcv7jop4ns6r.cn 林格液又叫什么hcv7jop9ns2r.cn 胃疼吃什么食物对胃好hcv8jop3ns6r.cn 睡觉就做梦是什么原因hcv7jop6ns3r.cn
LC什么意思creativexi.com 女孩学什么专业好就业ff14chat.com 兰蔻适合什么年龄的人用hcv7jop5ns3r.cn 什么而不什么成语hcv8jop1ns6r.cn 打完耳洞不能吃什么bysq.com
百度