瀏覽代碼

fix(susfs-patches): correct taskmmu.c fake patch for 6.6 <=30

The original 6.6.30 kernel code in the show_smaps_rollup contention
recovery path is:
  if (vma->vm_end > last_vma_end)
      smap_gather_stats(vma, &mss, last_vma_end);
  }

The SUSFS patch hunk #6 expects:
  if (vma->vm_end > last_vma_end) {
      smap_gather_stats(vma, &mss, last_vma_end);
      last_vma_end = vma->vm_end;
  }

The old fake patch used a buggy sed+perl combo that created duplicate
lines at wrong nesting. The new fake patch uses a single Python3
one-liner that cleanly adds the brace, the missing last_vma_end
assignment, and the closing brace.
TheWildJames 1 月之前
父節點
當前提交
25e01b8b09
共有 1 個文件被更改,包括 4 次插入15 次删除
  1. 4 15
      .github/actions/susfs-patches/action.yml

+ 4 - 15
.github/actions/susfs-patches/action.yml

@@ -101,21 +101,10 @@ runs:
       working-directory: ${{ github.workspace }}/kernel/common
       run: |
         echo "Applying 6.6 SUSFS fixes"
-        # if [ "${{ inputs.sublevel }}" -le "30" ]; then
-        #   echo "Applying taskmmu.c Android 15 6.6 Fake Patch"
-        #   perl -0777 -i -pe '
-        #   s{
-        #     (\t+\t\tif\s*\(\s*vma->vm_end\s*>\s*last_vma_end\s*\))
-        #     (
-        #       \n\t+\t\t\tsmap_gather_stats\(vma,\s*&mss,\s*last_vma_end\);
-        #       \n\t+\t\t\tlast_vma_end\s*=\s*vma->vm_end;
-        #     )
-        #   }
-        #   {
-        #     $1 . " {" . $2 . "\n\t\t\t}"
-        #   }ex
-        #   ' fs/proc/task_mmu.c
-        # fi
+        if [ "${{ inputs.sublevel }}" -le "30" ]; then
+          echo "Applying taskmmu.c Android 15 6.6 Fake Patch"
+          python3 -c 'import re;c=open("fs/proc/task_mmu.c").read();c=re.sub(r"(\t+\t\tif\s*\(\s*vma->vm_end\s*>\s*last_vma_end\s*\))\n(\t+\t\t\tsmap_gather_stats\(vma,\s*&mss,\s*last_vma_end\);)\n(\t+)\}",lambda m:m.group(1)+" {\n"+m.group(2)+"\n"+m.group(3)+"\t\tlast_vma_end = vma->vm_end;\n"+m.group(3)+"\t}\n"+m.group(3)+"}",c,count=1);open("fs/proc/task_mmu.c","w").write(c)'
+        fi
         if [ "${{ inputs.sublevel }}" -le "92" ]; then
           echo "Applying base.c Android 15 6.6 Fake Patch"
           sed -i '/^#include <linux\/cpufreq_times.h>$/a #include <linux/dma-buf.h>' fs/proc/base.c