فهرست منبع

Refactor action.yml fix vma pad and __fold error

jimsterino98 1 ماه پیش
والد
کامیت
746a972662
1فایلهای تغییر یافته به همراه17 افزوده شده و 16 حذف شده
  1. 17 16
      .github/actions/susfs-patches/action.yml

+ 17 - 16
.github/actions/susfs-patches/action.yml

@@ -101,22 +101,23 @@ runs:
         echo "No patch file found, skipping"
       fi
 
-   - name: fix VMA_PAD error
-     if: ${{ env.BRANCH == 'SM-X926B-Oneui6.1' || env.BRANCH == 'SM-A546B-Oneui6.0' || env.BRANCH == 'SM-S9180-Oneui6.1' }}
-     shell: bash
-     run: |
-       cd "$COMMON"
-       # Define VMA_PAD_START fallback macro if it does not exist
-       sed -i '/static int show_map_vma/i \
-       #ifndef VMA_PAD_START\n#define VMA_PAD_START(vma) ((vma)->vm_start)\n#endif\n' fs/proc/task_mmu.c
-     
-   - name: fix __fold function error for s25 ultra oneui7
-     if: ${{ env.BRANCH == 'SM-S938B-Oneui7' }}
-     shell: bash
-     run: |
-       cd "$COMMON"
-       sed -i '/static int show_map_vma/i \
-       #ifdef CONFIG_KSU_SUSFS_OPEN_REDIRECT\nstatic inline void __fold_filemap_fixup_entry(struct vma_iterator *vmi, unsigned long *end)\n{\n\tstruct vm_area_struct *next = vma_next(vmi);\n\tif (next) {\n\t\t*end = next->vm_start;\n\t\tvma_prev(vmi);\n\t}\n}\n#endif\n' fs/proc/task_mmu.c
+        # SUSFS's OPEN_REDIRECT code unconditionally calls VMA_PAD_START(), which
+        # only exists on GKI branches that carry Google's page-size-migration
+        # feature (added to each android version's kernel/common branch at a
+        # different, sometime later, os_patch_level). Older os_patch_levels in
+        # our build matrix predate it, so fall back to a no-padding definition
+        # when the real header/macro isn't present. This is version-agnostic and
+        # a no-op wherever the real header already provides it.
+        if grep -q 'VMA_PAD_START(' fs/proc/task_mmu.c && ! grep -qE '#include <linux/pgsize_migration(_inline)?\.h>|define VMA_PAD_START' fs/proc/task_mmu.c; then
+          sed -i '1a #ifndef VMA_PAD_START\n#define VMA_PAD_START(vma) ((vma)->vm_end)\n#endif' fs/proc/task_mmu.c
+          echo "Added VMA_PAD_START fallback definition to fs/proc/task_mmu.c"
+        fi
+
+        # Same story for __fold_filemap_fixup_entry(), declared in page_size_compat.h.
+        if grep -q '__fold_filemap_fixup_entry' fs/proc/task_mmu.c && ! grep -q '#include <linux/page_size_compat.h>' fs/proc/task_mmu.c; then
+          sed -i '/#include <linux\/pkeys.h>/a #include <linux/page_size_compat.h>' fs/proc/task_mmu.c
+          echo "Added page_size_compat.h include to fs/proc/task_mmu.c"
+        fi
        
    - name: add ksu-susfs to config
      shell: bash