Update HAOC 3.0 to HAOC 4.0 for Deepin - #2087
Conversation
Update the IEE base code with bitmap infrastructure, staged initialization, and arm64 gate setup. - Add x86 and arm64 HAOC bitmap helpers, and wire the bitmap-type update handler into the IEE gate table. - Add typed page-marking helpers for IEE-owned pages alongside the existing order-based set_iee_page() interface. - Split x86 IEE setup into early, init, and post-init phases. - Add x86 gate dispatch that uses direct handler calls before HAOC has enabled the protected gate path. - Add the arm64 direct-call gate path, post-init gate rewrite, bitmap setup, and early IEE data bitmap tagging. - Add the arm64 IEE debug and split-linear-mapping Kconfig hooks. Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn>
Update IEE_SIP with bitmap-backed SIP data, CR4 pin handling, and arm64 SI text and TTBR0 gate updates. - Mark x86 .iee.si_data as HAOC SIP data instead of generic read-only memory. - Restore CR4 pin checking inside the x86 SIP handler, and move SMEP/SMAP pin removal into IEE post-init. - Move kernel_set_to_readonly into SIP data and update it through iee_memcpy after rodata has been protected. - Let arm64 split SI text PMD block mappings, clear continuous mapping bits, and mark SI text PTEs non-global before applying PXNTable. - Route arm64 reserved TTBR0 writes through the SIP handler, and tag TTBR0 with the IEE ASID from the enabled HAOC path. - Add arm64 SIP debug gate handling so debug mode can skip the IEE stack switch and clear HPD before reporting a bad gate state. Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn>
Update IEE_PTRP with the HAOC4.0 token block layout and token lookup by task slab page index. - Add the 64-byte token block layout and derive token allocation order from the task slab order. - Add iee_get_task_token() on x86 and arm64 so token users locate the token slot by slab page index. - Switch token gate handlers, the SIP TTBR0 check, and scheduler PGD verification to the new token lookup. - Reuse Deepin's existing page allocation path on arm64, but free token pages with the derived token order. Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn>
Update CREDP with typed cred pages, task token tracking, and gated subjective cred updates. - Mark static and slab-backed cred pages as IEE_CRED on x86 and arm64, and restore bitmap/protection state when slabs are freed. - Add curr_cred to task tokens, and initialize or clear it when tokens are validated or invalidated. - Verify CREDP writes against the IEE_CRED bitmap type and the current task token before mutating protected cred fields. - Move CREDP token state from task-object IEE aliases to the IEE_PTRP token lookup path. - Route override_creds() and revert_creds() through CREDP gates, and update only the subjective cred pointer. Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn>
Support page table protection and isolation for x86. Signed-off-by: sh <m18080292938@163.com> Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn>
Support page table protection and isolation for arm64. Signed-off-by: zhangshiyangB7 <zhangshiyang21s@ict.ac.cn> Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn>
Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn>
Support key protection for x86. Co-authored-by: hubing <mhubing@mail.ustc.edu.cn> Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn>
Support key protection for arm64. Co-authored-by: zhangshiyangB7 <zhangshiyang21s@ict.ac.cn> Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn>
Support selinux protection for x86. Co-authored-by: Signed-off-by: sh <m18080292938@163.com> Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn>
Support selinux protection for arm64. Co-authored-by: zhangshiyangB7 <zhangshiyang21s@ict.ac.cn> Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn>
Clarify IEE_PTRP and IEE_PTRP_W Kconfig help on x86. Drop separate IEE_IO_CHECK and IEE_CS_CHECK gates in generic paths so read-side iee_verify_token() runs whenever PTRP is enabled and PTRP_W is off. Co-authored-by: szh <shanzhihan24b@ict.ac.cn> Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn>
…tion - HAOC4.0/arm64/CYCLE_CHECK: support CONFIG_IEE_PTRP_W & CONFIG_IEE_CYCLE_CHECK - HAOC4.0/arm64/CS_CHECK: support CONFIG_IEE_PTRP_W & CONFIG_IEE_CS_CHECK - HAOC4.0/arm64/IO_CHECK: support CONFIG_IEE_PTRP_W & CONFIG_IEE_IO_CHECK Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn>
Co-authored-by: chengwu12 <bitorange@foxmail.com> Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn>
Co-authored-by: chengwu12 <bitorange@foxmail.com> Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn>
…ation Introduce CONFIG_PTP_S and IEE_USER_PGTABLE to support staged Page-Table Protection (kernel/user page Separation). Split PTP write paths so user page tables can use direct writes while kernel tables stay on ptp gate paths, with user-side safety checks for alias/integrity. Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn> (cherry picked from commit c03cf3608ac85964f1c34c40cf951126aefc62fc)
…eration (PTP_S) Add ARM64 support for HAOC Page-Table Protection Separation (PTP_S). This introduces separated page-table protection semantics so user and kernel page-table updates can follow different enforcement paths while keeping the existing strict gate protection for kernel mappings. The change is designed to preserve current behavior when PTP_S is disabled and only enables the new separation model when configured. Signed-off-by: Liu Zhehui <liuzhh@zgclab.edu.cn> (cherry picked from commit 25d2717f0ec6e2b3abc5fe56312de0ae1310e26e)
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Skipping CI for Draft Pull Request. |
Reviewer's GuideUpgrade HAOC from 3.0 to 4.0 on both arm64 and x86, extending kernel hardening features (IEE/IEE_PTRP/PTP/CREDP/KEYP/VARP/SELINUXP) and tightening page-table, cred, key, and SELinux policy protection via new verification logic, kernel threads, and bitmap-based tracking of protected memory types. Sequence diagram for cred update with HAOC task_token verificationsequenceDiagram
participant Task as task_struct
participant Token as task_token
participant HAOC as haoc_iee_credp
Note over Task,Token: Cred copy for new kernel task
Task->>HAOC: _iee_copy_kernel_cred(old,new)
HAOC->>Token: iee_get_task_token(current)
HAOC->>Token: token.new_cred = new
HAOC->>new: _iee_memcpy(old,new)
Note over Task,Token: Initialize copied cred for child
Task->>HAOC: _iee_init_copied_cred(new_task,new)
HAOC->>Token: iee_get_task_token(current)
HAOC->>Token: iee_get_task_token(new_task)
HAOC->>Token: [check token.valid]
HAOC->>Token: [verify token.new_cred == new]
HAOC->>Token: token.new_cred = NULL
HAOC->>Token: token.curr_cred = new
HAOC->>new_task: new_task.cred = new
Note over Task,Token: Commit new credentials
Task->>HAOC: _iee_commit_creds(new)
HAOC->>Token: iee_get_task_token(current)
HAOC->>Token: [verify token.new_cred == new]
HAOC->>Token: token.new_cred = NULL
HAOC->>Token: write_seqcount_begin(token.seq)
HAOC->>Token: token.curr_cred = new
HAOC->>Task: rcu_assign_pointer(real_cred,new)
HAOC->>Task: rcu_assign_pointer(cred,new)
HAOC->>Token: write_seqcount_end(token.seq)
Note over Task,Token: Background cycle checker
actor CheckerThread
CheckerThread->>HAOC: check_all_threads()
HAOC->>Token: iee_cycle_verify_cred(task)
HAOC->>Token: [panic if token.curr_cred != task.cred]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
2026-08-14T02:18:09.3240706Z ./arch/arm64/include/asm/pgalloc.h:62:7: error: call to undeclared function 'pgtable_l4_enabled'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] |
There was a problem hiding this comment.
Pull request overview
Upgrades Deepin’s HAOC integration to 4.0 across x86-64 and arm64.
Changes:
- Adds page-table, key, SELinux, credential, pointer, and variable protection.
- Integrates HAOC gates into memory management, keyrings, filesystems, and architecture code.
- Enables HAOC 4.0 features in Deepin desktop configurations.
Reviewed changes
Copilot reviewed 196 out of 196 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
| security/smack/smack_lsm.c | Protects Smack key metadata |
| security/selinux/status.c | Protects SELinux status state |
| security/selinux/ss/services.c | Protects policy lifecycle |
| security/selinux/include/security.h | Adds protected setters |
| security/selinux/ima.c | Uses protected policy lock |
| security/selinux/hooks.c | Initializes protected SELinux state |
| security/keys/user_defined.c | Adapts user-key payloads |
| security/keys/trusted-keys/trusted_core.c | Adapts trusted keys |
| security/keys/request_key.c | Protects request-key state |
| security/keys/request_key_auth.c | Adapts authorization payloads |
| security/keys/proc.c | Supports split key structures |
| security/keys/internal.h | Declares KEYP caches |
| security/keys/gc.c | Adapts protected-key cleanup |
| security/keys/encrypted-keys/masterkey_trusted.c | Uses protected key semaphore |
| security/keys/encrypted-keys/encrypted.c | Adapts encrypted keys |
| security/keys/dh.c | Uses protected key locking |
| security/keys/big_key.c | Adapts large-key payloads |
| security/integrity/evm/evm_crypto.c | Adapts EVM key access |
| net/rxrpc/server_key.c | Adapts RxRPC server keys |
| net/rxrpc/sendmsg.c | Checks protected payloads |
| net/rxrpc/security.c | Reads protected tokens |
| net/rxrpc/rxkad.c | Adapts RxKAD payloads |
| net/rxrpc/key.c | Adapts RxRPC keys |
| net/rxrpc/conn_event.c | Reads protected connection keys |
| net/rxrpc/af_rxrpc.c | Checks protected payloads |
| net/dns_resolver/dns_key.c | Protects DNS keyring state |
| net/ceph/crypto.c | Adapts Ceph keys |
| net/ceph/ceph_common.c | Reads protected Ceph secrets |
| mm/sparse-vmemmap.c | Adds PTP vmemmap allocation |
| mm/slab.h | Adds protected slab handling |
| mm/slab_common.c | Prevents protected-cache merging |
| mm/pgtable-generic.c | Defers protected table frees |
| mm/mprotect.c | Integrates PTP protection changes |
| mm/mmap.c | Integrates protected unmapping |
| mm/memory.c | Integrates protected fault handling |
| mm/Makefile | Builds HAOC memory support |
| mm/huge_memory.c | Adapts arm64 PMD setup |
| mm/haoc/Makefile | Builds PTP cache |
| mm/early_ioremap.c | Adds protected early fixmaps |
| mm/debug_vm_pgtable.c | Uses protected table setters |
| lib/digsig.c | Uses protected key locking |
| kernel/sysctl.c | Routes VARP sysctl writes |
| kernel/sched/core.c | Adds token and WP handling |
| kernel/module/kmod.c | Protects modprobe_path |
| kernel/fork.c | Adds token and PTP hooks |
| kernel/cred.c | Protects credential overrides |
| init/main.c | Adds x86 HAOC post-init |
| include/linux/ptp-cache.h | Defines protected table cache |
| include/linux/mm.h | Uses PTP page allocation |
| include/linux/mm_types.h | Declares PTP TLB completion |
| include/linux/key.h | Defines KEYP structures |
| include/linux/haoc-ptp.h | Declares WP helpers |
| include/linux/efi.h | Includes arm64 PTP initialization |
| include/keys/request_key_auth-type.h | Adapts authorization payload access |
| include/keys/asymmetric-type.h | Adapts asymmetric payload access |
| include/keys/asymmetric-subtype.h | Adapts subtype access |
| include/asm-generic/tlb.h | Adds PTP TLB removal |
| fs/verity/signature.c | Adapts fs-verity keyring |
| fs/ubifs/auth.c | Uses protected key locking |
| fs/smb/client/smb2pdu.c | Adapts SMB2 SPNEGO keys |
| fs/smb/client/sess.c | Adapts SMB session keys |
| fs/smb/client/connect.c | Uses protected key locking |
| fs/smb/client/cifsacl.c | Adapts CIFS ID mapping |
| fs/smb/client/cifs_spnego.c | Adapts SPNEGO keys |
| fs/read_write.c | Adds credential verification |
| fs/nfs/nfs4idmap.c | Protects NFS keyring state |
| fs/ioctl.c | Adds credential verification |
| fs/exec.c | Adds exec protection hooks |
| fs/ecryptfs/main.c | Uses protected key semaphore |
| fs/ecryptfs/ecryptfs_kernel.h | Adapts encrypted payload access |
| fs/crypto/keysetup_v1.c | Uses protected key locking |
| fs/crypto/keyring.c | Adapts fscrypt keyrings |
| drivers/usb/early/ehci-dbgp.c | Uses protected early fixmap |
| drivers/tty/serial/earlycon.c | Uses protected earlycon fixmap |
| drivers/nvdimm/security.c | Uses protected key locking |
| drivers/md/dm-verity-verify-sig.c | Uses protected signature keys |
| drivers/md/dm-crypt.c | Adapts dm-crypt keys |
| drivers/firmware/efi/arm-runtime.c | Changes PTP EFI unmapping |
| crypto/asymmetric_keys/signature.c | Adapts signature payload checks |
| crypto/asymmetric_keys/public_key.c | Adapts public-key payloads |
| crypto/asymmetric_keys/asymmetric_type.c | Adapts asymmetric-key cleanup |
| crypto/af_alg.c | Uses protected key locking |
| certs/system_keyring.c | Adapts trusted keyring payloads |
| certs/blacklist.c | Protects blacklist permissions |
| block/sed-opal.c | Uses protected key locking |
| arch/x86/platform/efi/efi_64.c | Protects EFI page tables |
| arch/x86/mm/pti.c | Uses PTP table setters |
| arch/x86/mm/pgtable.c | Adds protected table caches |
| arch/x86/mm/pat/set_memory.c | Protects mapping updates |
| arch/x86/mm/init_64.c | Reworks HAOC initialization |
| arch/x86/mm/ident_map.c | Protects identity mappings |
| arch/x86/kernel/vmlinux.lds.S | Adds protected data sections |
| arch/x86/kernel/paravirt.c | Adds protected TLB removal |
| arch/x86/kernel/nmi.c | Handles WP state during NMI |
| arch/x86/kernel/haoc/varp/varp.c | Implements x86 VARP |
| arch/x86/kernel/haoc/varp/Makefile | Builds x86 VARP |
| arch/x86/kernel/haoc/selinuxp/selinuxp.c | Implements x86 SELinuxP |
| arch/x86/kernel/haoc/selinuxp/Makefile | Builds x86 SELinuxP |
| arch/x86/kernel/haoc/ptp/ptp-gate.S | Implements x86 PTP gate |
| arch/x86/kernel/haoc/ptp/Makefile | Builds x86 PTP |
| arch/x86/kernel/haoc/Makefile | Builds HAOC modules |
| arch/x86/kernel/haoc/keyp/Makefile | Builds x86 KEYP |
| arch/x86/kernel/haoc/iee/iee.c | Adds token lookup |
| arch/x86/kernel/haoc/iee/iee-si.c | Extends SIP handling |
| arch/x86/kernel/haoc/iee/iee-func.c | Adds page tagging helpers |
| arch/x86/kernel/haoc/haoc.c | Registers new IEE gates |
| arch/x86/kernel/haoc/gate.h | Defines WP gate macros |
| arch/x86/kernel/cpu/common.c | Moves SIP initialization |
| arch/x86/kernel/alternative.c | Protects text-poke mappings |
| arch/x86/Kconfig | Defines HAOC 4.0 options |
| arch/x86/include/asm/tlb.h | Adds protected TLB free |
| arch/x86/include/asm/pgalloc.h | Uses protected table cache |
| arch/x86/include/asm/haoc/ptp.h | Defines x86 PTP API |
| arch/x86/include/asm/haoc/iee.h | Extends x86 IEE API |
| arch/x86/include/asm/haoc/iee-varp.h | Defines x86 VARP API |
| arch/x86/include/asm/haoc/iee-token.h | Extends task tokens |
| arch/x86/include/asm/haoc/iee-si.h | Extends SIP declarations |
| arch/x86/include/asm/haoc/iee-selinux.h | Defines SELinuxP gates |
| arch/x86/include/asm/haoc/iee-func.h | Extends page APIs |
| arch/x86/include/asm/haoc/iee-cred.h | Extends credential checks |
| arch/x86/include/asm/haoc/haoc-def.h | Adds gate operation IDs |
| arch/x86/include/asm/haoc/haoc-bitmap.h | Defines x86 page tags |
| arch/x86/configs/deepin_x86_desktop_defconfig | Enables HAOC 4.0 |
| arch/x86/boot/compressed/ident_map_64.c | Protects boot mappings |
| arch/arm64/mm/trans_pgd.c | Protects transitional tables |
| arch/arm64/mm/pgd.c | Uses protected PGD allocation |
| arch/arm64/mm/init.c | Changes init-memory cleanup |
| arch/arm64/mm/fault.c | Adds bitmap diagnostics |
| arch/arm64/kernel/vmlinux.lds.S | Adds protected data sections |
| arch/arm64/kernel/setup.c | Initializes table caches |
| arch/arm64/kernel/haoc/varp/varp.c | Implements arm64 VARP |
| arch/arm64/kernel/haoc/varp/Makefile | Builds arm64 VARP |
| arch/arm64/kernel/haoc/selinuxp/selinuxp.c | Implements arm64 SELinuxP |
| arch/arm64/kernel/haoc/selinuxp/Makefile | Builds arm64 SELinuxP |
| arch/arm64/kernel/haoc/ptp/Makefile | Builds arm64 PTP |
| arch/arm64/kernel/haoc/Makefile | Builds arm64 HAOC modules |
| arch/arm64/kernel/haoc/keyp/Makefile | Builds arm64 KEYP |
| arch/arm64/kernel/haoc/iee/iee-si-gate.S | Updates SIP gate |
| arch/arm64/kernel/haoc/iee/iee-init.c | Reworks IEE post-init |
| arch/arm64/kernel/haoc/iee/iee-gate.S | Adds disabled-mode gate path |
| arch/arm64/kernel/haoc/haoc.c | Registers arm64 gates |
| arch/arm64/kernel/cpufeature.c | Uses protected KPTI tables |
| arch/arm64/include/asm/tlb.h | Frees protected tables |
| arch/arm64/include/asm/pgtable.h | Selects HAOC pgtable API |
| arch/arm64/include/asm/pgalloc.h | Adds protected PUD freeing |
| arch/arm64/include/asm/mmu_context.h | Protects TTBR updates |
| arch/arm64/include/asm/haoc/iee.h | Extends pointer translation |
| arch/arm64/include/asm/haoc/iee-varp.h | Defines arm64 VARP API |
| arch/arm64/include/asm/haoc/iee-token.h | Extends arm64 tokens |
| arch/arm64/include/asm/haoc/iee-selinux.h | Defines SELinuxP gates |
| arch/arm64/include/asm/haoc/iee-ptp-init.h | Defines early PTP API |
| arch/arm64/include/asm/haoc/iee-mmu.h | Extends IEE allocation API |
| arch/arm64/include/asm/haoc/iee-init.h | Defines protected sections |
| arch/arm64/include/asm/haoc/iee-func.h | Extends arm64 page APIs |
| arch/arm64/include/asm/haoc/iee-fixmap.h | Defines protected fixmaps |
| arch/arm64/include/asm/haoc/iee-cred.h | Extends credential checks |
| arch/arm64/include/asm/haoc/haoc-def.h | Adds arm64 gate IDs |
| arch/arm64/include/asm/haoc/haoc-bitmap.h | Defines arm64 page tags |
| arch/arm64/include/asm/fixmap.h | Includes PTP fixmap support |
| arch/arm64/configs/deepin_arm64_desktop_defconfig | Enables HAOC 4.0 |
Suppressed comments (2)
security/selinux/ss/services.c:2226
- The first-policy path has the same unchecked protected-cache allocation: a transient allocation failure is passed to the gate and becomes a NULL type check/copy target. Handle allocation failure before publishing the initial policy.
security/selinux/ss/services.c:2227 - This also frees
newpolicybefore the unconditionalsecurity_load_policycaps(newpolicy)call, producing a use-after-free on the initial policy load. Delay the free until after all accesses tonewpolicy, or load from the protected policy copy.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (oldpolicy) { | ||
| sidtab_freeze_begin(oldpolicy->sidtab, &flags); | ||
| #ifdef CONFIG_IEE_SELINUX_P | ||
| iee_sel_rcu_assign_policy(newpolicy, kmem_cache_alloc(policy_jar, GFP_KERNEL)); |
| sidtab_freeze_begin(oldpolicy->sidtab, &flags); | ||
| #ifdef CONFIG_IEE_SELINUX_P | ||
| iee_sel_rcu_assign_policy(newpolicy, kmem_cache_alloc(policy_jar, GFP_KERNEL)); | ||
| kfree(newpolicy); |
| temppolicy = kmemdup(oldpolicy, sizeof(*temppolicy), GFP_KERNEL); | ||
| if (!temppolicy) | ||
| return -ENOMEM; |
| struct mutex *status_lock = kzalloc(GFP_KERNEL, sizeof(struct mutex)); | ||
| struct mutex *policy_mutex = kzalloc(GFP_KERNEL, sizeof(struct mutex)); | ||
|
|
||
| mutex_init(status_lock); | ||
| mutex_init(policy_mutex); |
| struct ptp_pte_free_now_work *ptp_work = | ||
| kmalloc(sizeof(struct ptp_pte_free_now_work), GFP_ATOMIC); | ||
|
|
||
| ptp_work->page = page; | ||
| INIT_WORK(&ptp_work->work, ptp_pte_free_now); |
| #if defined(CONFIG_PTP) && defined(CONFIG_X86_64) | ||
| ptp_disable_wp(&cr0); | ||
| #endif | ||
| change_protection(tlb, vma, start, end, mm_cp_flags); |
| #if defined(CONFIG_PTP) && defined(CONFIG_X86_64) | ||
| ptp_disable_wp(&cr0); | ||
| #endif | ||
| unmap_region(mm, &mas_detach, vma, prev, next, start, end, count, | ||
| !unlock); |
| #if defined(CONFIG_PTP) && defined(CONFIG_X86_64) | ||
| ptp_disable_wp(&cr0); | ||
| #endif | ||
| unmap_vmas(&tlb, &mas, vma, 0, ULONG_MAX, ULONG_MAX, false); |
| c = *(p++); | ||
| if (c == 0 || c == '\n') | ||
| break; | ||
| data[len++] = c; |
| c = *(p++); | ||
| if (c == 0 || c == '\n') | ||
| break; | ||
| data[len++] = c; |
将 HAOC 3.0 更新至 HAOC 4.0,依据 Unixbench,性能开销在 5% 左右。目前提供的功能如下:
IEE:提供内核内隔离执行环境的框架,由受到保护的内存、堆栈、可信的代码出入口等构建而成。在内核由于漏洞发生安全问题时,IEE 可以确保内部的数据和代码不受到影响,因此可以用于加固对内核关键数据的防护,并承载一定的安全检查代码,用于监视内核行为。
IEE_SIP: 保护那些可能破坏IEE隔离性的关键指令,例如写入系统控制寄存器的指令,这些指令将在IEE内部执行。这类关键指令一旦被恶意或错误地执行,将直接破坏内核行为,导致安全敏感数据泄露或权限提升。
IEE_PTRP: 进程的 task_struct结构体包含大量关键指针,例如 struct cred*,它直接决定了进程的权限和能力。一旦该指针被恶意篡改,攻击者即可提升权限,导致严重安全风险。该选项为每个进程提供称为 task_token 的 IEE 元数据,在运行时动态验证 task_struct 中关键指针(例如 struct cred*,该指针决定了进程的权限能力)的完整性,防止指针被非法覆盖或重定向
IEE_PTRP_W: 与PTRP的功能相比,此选项仅对关键指针执行写保护。启用此选项可提升性能,并缩小防护范围。
IEE_SELINUXP:对 Linux 有名的安全子系统 Selinux 进行安全加固的选项。Selinux 是广泛使用的 LSM(Linux security module)的代表之一,它在内核的各个关键函数中进行插桩检查,并引入了自己的一套用户访问控制模型。我们将 Selinux 所使用的最关键的数据结构放入 Haoc 安全内存中进行监视,确保其提供的安全检查不被攻击者绕过。
PTP:由于 IEE 的防护设计基于内核页表实现,需要将内核页表进行隔离和保护,确保 IEE 自身的完整性。此外,内核页表也是内核运行的最关键数据,PTP 通过对内核页表的隔离与监视,确保了内核 DEP (Data execution prevention)防止代码篡改与注入,并阻止 Alias mapping,防止内核数据与代码被攻击者泄露到用户空间。
CREDP:对内核内 cred 结构体的防护。cred 结构体是 Linux 访问控制策略中的关键数据,负责标识进程的各项权限,在进程访问各种资源时提供信息进行安全校验。如果 cred 被非法篡改或替换,攻击者将很容易绕过内核的各种安全防护,达到为所欲为的效果。Haoc 将 cred 放入隔离环境内,所有对 cred 的访问都需要经过 Haoc 的接口进行检验。我们在这些接口布置了相应的安全策略,即使攻击者利用内存安全漏洞,也无法直接修改 cred,或者构建 ROP 攻击复用内核接口修改进程 cred 为非法目标。
KEYP:对内核内 key 结构体的防护。key 是内核密钥环安全子系统的关键数据结构,可以用于强化 Linux 的控制访问策略。但在宏内核中,暴露的 key 结构体仍可能被攻击者通过内核漏洞随意篡改,导致这些安全加固失去意义。Haoc 框架则通过提供可信的内存并确保相关验证代码的控制流完整性,给这些安全加固机制提供了更为可靠的保障。
VARP: 对 Linux 内核中易被攻击者利用的关键全局变量进行安全加固的选项,例如 modprobe_path 等。这类变量会影响内核安全决策或用户态辅助程序执行路径,攻击者获得内核任意写后常通过篡改它们劫持内核行为。我们将这些关键变量放入 Haoc 安全内存,确保这些安全敏感变量在运行期仍可被内核正常读写,但不会被攻击者直接改写以绕过系统保护。
Summary by Sourcery
Enable HAOC 4.0 security hardening for Deepin by integrating page-table protection, credential and key isolation, and SELinux/varp hardening across arm64 and x86, while wiring the new infrastructure into memory management, exec/fork paths, keyrings, and security subsystems.
New Features:
Bug Fixes:
Enhancements: