From 17e70d2166997f2d159a036bad5f7999e9aa144b Mon Sep 17 00:00:00 2001 From: Domagoj Stolfa Date: Wed, 3 Apr 2024 11:56:47 +0100 Subject: [PATCH] c18n: Add a libunwind policy. This commit also fixes the missing unw_getcontext_unsealed in trusted symbols and moves libunwind symbols closer to the setjmp/longjmp ones. --- libexec/rtld-elf/Symbol-c18n.map | 4 ++-- libexec/rtld-elf/rtld_c18n_policy.txt | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libexec/rtld-elf/Symbol-c18n.map b/libexec/rtld-elf/Symbol-c18n.map index aa1cb37c5e0f..a7e9f9afcd82 100644 --- a/libexec/rtld-elf/Symbol-c18n.map +++ b/libexec/rtld-elf/Symbol-c18n.map @@ -9,11 +9,11 @@ FBSDprivate_1.0 { _rtld_sighandler; _rtld_setjmp; _rtld_longjmp; - _rtld_safebox_code; - _rtld_sandbox_code; _rtld_unw_getcontext; _rtld_unw_setcontext; _rtld_unw_getcontext_unsealed; _rtld_unw_setcontext_unsealed; _rtld_unw_getsealer; + _rtld_safebox_code; + _rtld_sandbox_code; }; diff --git a/libexec/rtld-elf/rtld_c18n_policy.txt b/libexec/rtld-elf/rtld_c18n_policy.txt index c742c4bcd299..4c37e161859f 100644 --- a/libexec/rtld-elf/rtld_c18n_policy.txt +++ b/libexec/rtld-elf/rtld_c18n_policy.txt @@ -4,6 +4,9 @@ compartment [TCB] libc.so.7 libthr.so.3 +compartment [libunwind] + libgcc_s.so.1 + caller * trust memset @@ -55,6 +58,7 @@ trust execvpe execvP unw_getcontext + unw_getcontext_unsealed _rtld_thread_start callee [RTLD] @@ -66,3 +70,11 @@ export to [TCB] _rtld_sighandler _rtld_setjmp _rtld_longjmp + +callee [RTLD] +export to [libunwind] + _rtld_unw_getcontext + _rtld_unw_getcontext_unsealed + _rtld_unw_setcontext + _rtld_unw_setcontext_unsealed + _rtld_unw_getsealer