Quellcode durchsuchen

fix(action): update Android 13 5.10 SUSFS patch logic for improved sublevel handling

TheWildJames vor 4 Monaten
Ursprung
Commit
8958ba52aa
1 geänderte Dateien mit 14 neuen und 109 gelöschten Zeilen
  1. 14 109
      .github/actions/susfs/action.yml

+ 14 - 109
.github/actions/susfs/action.yml

@@ -95,15 +95,16 @@ runs:
             perl -i -pe 's/\bmask,\s*mark->ignored_mask\)/inotify_mark_user_mask(mark)/g' fs/notify/fdinfo.c
           fi
         fi
-        #if [ "${{ inputs.kernel_version }}" = "5.10" ] && [ "${{ inputs.android_version }}" = "android13" ]; then
-        #  echo "Applying Android 13 5.10 SUSFS fixes"
-        #  if [ "${{ inputs.sublevel }}" -le "117" ]; then
-        #    sed -i '/^\s*\/\*/,/^\s*u32 mask = mark->mask & IN_ALL_EVENTS;$/d' fs/notify/fdinfo.c
-        #    perl -i -pe 's/\bmask,\s*mark->ignored_mask\)/inotify_mark_user_mask(mark)/g' fs/notify/fdinfo.c
-        #  fi
-        #fi
+        if [ "${{ inputs.kernel_version }}" = "5.10" ] && [ "${{ inputs.android_version }}" = "android13" ]; then
+          echo "Applying Android 13 5.10 SUSFS fixes"
+          if [ "${{ inputs.sublevel }}" -le "107" ]; then
+            perl -i -pe 's/^\s*u32 mask = mark->mask & IN_ALL_EVENTS;?\s*$//g' fs/notify/fdinfo.c
+            perl -i -pe 's/\bmask,\s*mark->ignored_mask\)/inotify_mark_user_mask(mark)/g' fs/notify/fdinfo.c
+          fi
+        fi
         if [ "${{ inputs.kernel_version }}" = "5.15" ] && [ "${{ inputs.android_version }}" = "android13" ]; then
           echo "Applying Android 13 5.15 SUSFS fixes"
+          if 
           if grep -q '^size_t this_len = min_t(size_t, count, PAGE_SIZE);$' fs/proc/base.c; then
             sed -i 's/^int this_len = min_t(int, count, PAGE_SIZE);$/size_t this_len = min_t(size_t, count, PAGE_SIZE);/' fs/proc/base.c
             FIX_REJ=1
@@ -162,12 +163,12 @@ runs:
             perl -i -pe 's/\binotify_mark_user_mask\(mark\)/mask, mark->ignored_mask)/g' fs/notify/fdinfo.c
           fi
         fi
-        #if [ "${{ inputs.kernel_version }}" = "5.10" ] && [ "${{ inputs.android_version }}" = "android13" ]; then
-        #  if [ "${{ inputs.sublevel }}" -le "107" ]; then
-        #    perl -i -pe 's/^(\s*if \(inode\) \{)/$1\n        \/\*\n         * IN_ALL_EVENTS represents all of the mask bits\n         * that we expose to userspace.  There is at\n         * least one bit (FS_EVENT_ON_CHILD) which is\n         * used only internally to the kernel.\n         *\/\n        u32 mask = mark->mask & IN_ALL_EVENTS;/m' fs/notify/fdinfo.c
-        #    perl -i -pe 's/\binotify_mark_user_mask\(mark\)/mask, mark->ignored_mask)/g' fs/notify/fdinfo.c
-        #  fi
-        #fi
+        if [ "${{ inputs.kernel_version }}" = "5.10" ] && [ "${{ inputs.android_version }}" = "android13" ]; then
+          if [ "${{ inputs.sublevel }}" -le "107" ]; then
+            perl -i -pe 's/^(\s*if $$inode$$ \{)/$1\n        u32 mask = mark->mask & IN_ALL_EVENTS;/' fs/notify/fdinfo.c
+            perl -i -pe 's/\binotify_mark_user_mask\(mark\)/mask, mark->ignored_mask)/g' fs/notify/fdinfo.c
+          fi
+        fi
         if [ "${{ inputs.kernel_version }}" = "5.15" ] && [ "${{ inputs.android_version }}" = "android13" ]; then
           sed -i '/#include <linux\/mnt_idmapping.h>$/d' fs/namespace.c
           sed -i '/#include <linux\/mnt_idmapping.h>$/d' fs/open.c
@@ -204,102 +205,6 @@ runs:
           sed -i -e 's/goto show_pad;/return 0;/' ./fs/proc/task_mmu.c
         fi
 
-    - name: Apply Android 13 5.10 Fixes
-      if: inputs.android_version == 'android13' && inputs.kernel_version == '5.10'
-      shell: bash
-      working-directory: ${{ github.workspace }}/kernel/common
-      run: |
-        if [ "${{ inputs.sublevel }}" -le "107" ]; then
-        sed -i '/u32 mask = mark->mask & IN_ALL_EVENTS;/r'<(cat <<'EOF'
-        #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
-        		mnt = real_mount(file->f_path.mnt);
-        		if (mnt->mnt_id >= DEFAULT_KSU_MNT_ID &&
-        			likely(susfs_is_current_proc_umounted()))
-        		{
-        			struct path path;
-        			char *pathname = kmalloc(PAGE_SIZE, GFP_KERNEL);
-        			char *dpath;
-        			if (!pathname) {
-        				goto orig_flow;
-        			}
-        			dpath = d_path(&file->f_path, pathname, PAGE_SIZE);
-        			if (!dpath) {
-        				goto out_kfree;
-        			}
-        			if (kern_path(dpath, 0, &path)) {
-        				goto out_kfree;
-        			}
-        			if (!path.dentry->d_inode) {
-        				goto out_path_put;
-        			}
-        			seq_printf(m, "inotify wd:%x ino:%lx sdev:%x mask:%x ignored_mask:0 ",
-        					inode_mark->wd, path.dentry->d_inode->i_ino, path.dentry->d_inode->i_sb->s_dev,
-        					(mark->mask & IN_ALL_EVENTS));
-        			show_mark_fhandle(m, path.dentry->d_inode);
-        			seq_putc(m, '\n');
-        			path_put(&path);
-        			kfree(pathname);
-        			iput(inode);
-        			return;
-        out_path_put:
-        			path_put(&path);
-        out_kfree:
-        			kfree(pathname);
-        		}
-        orig_flow:
-        #endif // #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
-        EOF
-        ) fs/notify/fdinfo.c
-        fi
-
-    - name: Apply Android 13 5.15 Fixes
-      if: inputs.android_version == 'android13' && inputs.kernel_version == '5.15'
-      shell: bash
-      working-directory: ${{ github.workspace }}/kernel/common
-      run: |
-        if [ "${{ inputs.sublevel }}" -le "117" ]; then
-        sed -i '/u32 mask = mark->mask & IN_ALL_EVENTS;/r'<(cat <<'EOF'
-        #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
-        		mnt = real_mount(file->f_path.mnt);
-        		if (mnt->mnt_id >= DEFAULT_KSU_MNT_ID &&
-        			likely(susfs_is_current_proc_umounted()))
-        		{
-        			struct path path;
-        			char *pathname = kmalloc(PAGE_SIZE, GFP_KERNEL);
-        			char *dpath;
-        			if (!pathname) {
-        				goto orig_flow;
-        			}
-        			dpath = d_path(&file->f_path, pathname, PAGE_SIZE);
-        			if (!dpath) {
-        				goto out_kfree;
-        			}
-        			if (kern_path(dpath, 0, &path)) {
-        				goto out_kfree;
-        			}
-        			if (!path.dentry->d_inode) {
-        				goto out_path_put;
-        			}
-        			seq_printf(m, "inotify wd:%x ino:%lx sdev:%x mask:%x ignored_mask:0 ",
-        					inode_mark->wd, path.dentry->d_inode->i_ino, path.dentry->d_inode->i_sb->s_dev,
-        					(mark->mask & IN_ALL_EVENTS));
-        			show_mark_fhandle(m, path.dentry->d_inode);
-        			seq_putc(m, '\n');
-        			path_put(&path);
-        			kfree(pathname);
-        			iput(inode);
-        			return;
-        out_path_put:
-        			path_put(&path);
-        out_kfree:
-        			kfree(pathname);
-        		}
-        orig_flow:
-        #endif // #ifdef CONFIG_KSU_SUSFS_SUS_MOUNT
-        EOF
-        ) fs/notify/fdinfo.c
-        fi
-
     - name: Apply Android 14 6.1 Fixes
       if: inputs.android_version == 'android14' && inputs.kernel_version == '6.1'
       shell: bash