Memory Tagging Extension (MTE) exploit mitigation for Mastodon
本文为原文前 6,000 字符的节选翻译,完整内容请查看原文。
Memory Tagging Extension (MTE) exploit mitigation for Mastodon
Memory Tagging Extension (MTE) exploit mitigation for Mastodon. Published: November 28, 2026. Table of Contents: Introduction, The old Disobey Discotheque Mastodon architecture, The new Disobey Discotheque Mastodon architecture, Why MTE is an actual “game changer”, Memory bugs, What changes with hardware-backed MTE, How Arm v9.2 MTE works, Lock and key, Where the colors live, What happens on a mismatch, MTE limitations, How Linux kernel MTE works on Arm v9.2, Normal applications, The kernel’s own memory, What the Raxda Orion O6 kernel does not have yet, Why the Mastodon stack, and what parts of Mastodon, What is covered, how, and why, Why Redis and Ruby use glibc malloc on the Orion O6, An MTE-hardened service unit, Compiled code: BTI and PAC, Checking that tagging is really on, The cost on this board, Where MTE stops: CFI, HardenedBSD, shadow stacks and CHERI, Two different jobs, Hardware CFI on Arm: BTI and PAC, Software CFI, HardenedBSD, Using hardware and software CFI together, Shadow stacks: Intel CET and Arm GCS, CHERI and Morello, Apple’s “EMTE” and Google’s MTE, Apple’s MTE implementation, Google’s MTE implementation, Where the Radxa Orion O6 fits, Checked Pointer Arithmetic (CPA), Sources.
针对 Mastodon 的内存标记扩展 (MTE) 漏洞缓解措施。发布日期:2026 年 11 月 28 日。目录:简介、旧版 Disobey Discotheque Mastodon 架构、新版 Disobey Discotheque Mastodon 架构、为什么 MTE 是真正的“游戏规则改变者”、内存错误、硬件支持的 MTE 有何变化、Arm v9.2 MTE 的工作原理、锁与密钥、颜色存储位置、不匹配时会发生什么、MTE 的局限性、Linux 内核 MTE 在 Arm v9.2 上的工作方式、普通应用程序、内核自身的内存、Radxa Orion O6 内核尚不具备的功能、为什么选择 Mastodon 堆栈以及 Mastodon 的哪些部分、涵盖内容、方式及原因、为什么 Redis 和 Ruby 在 Orion O6 上使用 glibc malloc、MTE 加固的服务单元、编译代码:BTI 和 PAC、检查标记是否真正开启、该板卡的成本、MTE 的局限:CFI、HardenedBSD、影子栈和 CHERI、两项不同的工作、Arm 上的硬件 CFI:BTI 和 PAC、软件 CFI、HardenedBSD、同时使用硬件和软件 CFI、影子栈:Intel CET 和 Arm GCS、CHERI 和 Morello、Apple 的“EMTE”与 Google 的 MTE、Apple 的 MTE 实现、Google 的 MTE 实现、Radxa Orion O6 的定位、检查指针算术 (CPA)、来源。
Introduction
Being a passionate security engineer, I care deeply about memory safety and exploit mitigation. This new setup is a proof of concept for the Mastodon app stack that I also care deeply about because it further protects the communities I host as part of Disobey Discotheque, gay.amsterdam and disobey.net. Disobey Discotheque already hosts an open source Web Application Firewall (WAF) called Coraza in front of Mastodon to defend against the OWASP top 10.
简介
作为一名充满激情的安全工程师,我非常关注内存安全和漏洞缓解。这一新设置是我所关心的 Mastodon 应用堆栈的概念验证,因为它进一步保护了我作为 Disobey Discotheque、gay.amsterdam 和 disobey.net 一部分所托管的社区。Disobey Discotheque 已经在 Mastodon 前端托管了一个名为 Coraza 的开源 Web 应用防火墙 (WAF),以防御 OWASP 十大安全风险。
The old Disobey Discotheque Mastodon architecture
Before adding the Radxa Orion O6 [1] system board into Disobey Discotheque’s self-hosted compute stack, gay.amsterdam and disobey.net each ran in their own Proxmox VM. gay.amsterdam had a Debian VM, and disobey.net had an Ubuntu VM. Each VM ran everything for its isolated Mastodon instance; the Mastodon apps, the database, search and media storage.
旧版 Disobey Discotheque Mastodon 架构
在将 Radxa Orion O6 [1] 系统板添加到 Disobey Discotheque 的自托管计算堆栈之前,gay.amsterdam 和 disobey.net 分别运行在各自的 Proxmox 虚拟机中。gay.amsterdam 使用 Debian 虚拟机,而 disobey.net 使用 Ubuntu 虚拟机。每个虚拟机都运行其隔离的 Mastodon 实例所需的一切:Mastodon 应用、数据库、搜索和媒体存储。
The new Disobey Discotheque Mastodon architecture
The Mastodon apps for both instances have moved onto a Radxa Orion O6. Radxa describes the board as built on “Armv9.2 Architecture” [1] and is known to support Arm’s Memory Tagging Extension in its BIOS as an opt-in feature [2]. Migrating disobey.net to this board let Disobey Discotheque retire the Ubuntu VM that hosted disobey.net, and we added cyber.cafe as a development and testing Mastodon instance. The user data for all three instances now lives in one Proxmox VM configured carefully with its own software isolation and hardening. New, automatic patching always applies to cyber.cafe first; new Mastodon releases, Ruby patch releases, and Tor updates for the WebTunnel bridges. Each change is applied to cyber.cafe, checked, and only then applied to gay.amsterdam and then disobey.net. The Radxa Orion O6 reaches the Proxmox VM via 10G LAN over an encrypted WireGuard tunnel.
新版 Disobey Discotheque Mastodon 架构
两个实例的 Mastodon 应用现已迁移到 Radxa Orion O6 上。Radxa 将该板卡描述为基于“Armv9.2 架构”[1] 构建,并且已知其 BIOS 支持 Arm 的内存标记扩展作为可选功能 [2]。将 disobey.net 迁移到该板卡使 Disobey Discotheque 能够停用托管 disobey.net 的 Ubuntu 虚拟机,我们还添加了 cyber.cafe 作为开发和测试 Mastodon 实例。所有三个实例的用户数据现在都存储在一个经过精心配置、具备自身软件隔离和加固功能的 Proxmox 虚拟机中。新的自动补丁总是先应用于 cyber.cafe;包括新的 Mastodon 版本、Ruby 补丁版本以及 WebTunnel 网桥的 Tor 更新。每项更改都会先应用于 cyber.cafe,经检查后再应用于 gay.amsterdam,最后应用于 disobey.net。Radxa Orion O6 通过加密的 WireGuard 隧道经由 10G LAN 连接到 Proxmox 虚拟机。
Why MTE is an actual “game changer”
MTE is literally a game changer for general purpose computing safety, via exploit mitigation. It matters most for software written in C and C++, which can’t protect its own memory. Memory safe languages such as Rust, Go, and Swift protect most of their own memory, but they still run on top of C and C++ code, like the Linux kernel, and MTE protects that too.
为什么 MTE 是真正的“游戏规则改变者”
通过漏洞缓解,MTE 对于通用计算安全而言确实是一个游戏规则改变者。它对于用 C 和 C++ 编写的软件最为重要,因为这些软件无法保护自身的内存。Rust、Go 和 Swift 等内存安全语言可以保护其大部分内存,但它们仍然运行在 C 和 C++ 代码(如 Linux 内核)之上,而 MTE 也保护这些底层代码。
Memory bugs
When an application runs, it keeps its data in memory. Think of memory as a long row of gym lockers. When an application needs space in memory, it asks the memory allocator for some gym lockers and gets back a note with the locker numbers that the application can use. The allocator gets big blocks of lockers from the Linux kernel ahead of time, and hands them out in smaller pieces. That note from the allocator is called a pointer. Applications written in C and C++ blindly trust that note completely. Nothing stops an application from opening a gym locker that isn’t on its note. This fundamental insecurity leads to two very common bugs: Buffer overflow: the application was given lockers 10 to 19, but it also opens locker 20, which belongs to something else. Use-after-free: the application gave locker 10 back, but kept the old note, and later opens locker 10 again. By then, the locker belongs to something else.
内存错误
当应用程序运行时,它会将数据保存在内存中。可以将内存想象成一排长长的健身房储物柜。当应用程序需要内存空间时,它会向内存分配器请求一些储物柜,并收到一张写有可使用储物柜编号的纸条。分配器会提前从 Linux 内核获取大块储物柜,并将它们分成较小的部分分发出去。分配器给出的那张纸条被称为指针。用 C 和 C++ 编写的应用程序会盲目地完全信任这张纸条。没有任何机制阻止应用程序打开纸条上未列出的储物柜。这种根本性的不安全性导致了两个非常常见的错误: 缓冲区溢出:应用程序被分配了 10 到 19 号储物柜,但它却打开了属于其他用途的 20 号储物柜。 释放后使用 (Use-after-free):应用程序归还了 10 号储物柜,但保留了旧纸条,随后又再次打开 10 号储物柜。此时,该储物柜已属于其他用途。