Bladeren bron

fix(susfs): strip static from with_policy helpers on 6.6+, port from GKI

BBG-off bisect still hit undefined security_context_to_sid_with_policy /
security_sid_to_context_with_policy / security_compute_av_user_with_policy
referenced by selinuxfs.c my_write_context/my_write_access. GKI already
fixes this by de-staticing the helpers in selinux_hide.c so the linker
can resolve them. Port that step here.
TheWildJames 3 dagen geleden
bovenliggende
commit
c42981c8a1
1 gewijzigde bestanden met toevoegingen van 18 en 0 verwijderingen
  1. 18 0
      .github/actions/susfs-patches/action.yml

+ 18 - 0
.github/actions/susfs-patches/action.yml

@@ -106,6 +106,24 @@ runs:
           echo "Added page_size_compat.h include"
         fi
        
+   - name: fix with_policy static on 6.6+ (port from GKI)
+     shell: bash
+     run: |
+      if [ "$(printf '%s\n' "6.6" "$KERNEL_VER" | sort -V | head -n1)" = "6.6" ]; then
+        echo "[*] KVER $KERNEL_VER >= 6.6, stripping static from with_policy helpers"
+        for f in $(find "$COMMON" -name selinux_hide.c 2>/dev/null); do
+          if grep -q "^static int security_context_to_sid_with_policy" "$f"; then
+            echo "[*] Stripping static from $f helpers"
+            sed -i 's/^static int security_context_to_sid_with_policy/int security_context_to_sid_with_policy/g' "$f"
+            sed -i 's/^static int security_sid_to_context_with_policy/int security_sid_to_context_with_policy/g' "$f"
+            sed -i 's/^static void security_compute_av_user_with_policy/void security_compute_av_user_with_policy/g' "$f"
+            echo "[+] Stripped static from $f"
+          fi
+        done
+      else
+        echo "[-] KVER $KERNEL_VER < 6.6, skipping"
+      fi
+
    - name: add ksu-susfs to config
      shell: bash
      run: |