| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- name: Setup SUSFS
- description: Clone and apply SUSFS patches with version-specific fixes
- inputs:
- android_version:
- description: 'Android version (e.g., android15)'
- required: true
- kernel_version:
- description: 'Kernel version (e.g., 6.6)'
- required: true
- os_patch_level:
- description: 'OS patch level (e.g., 2024-07)'
- required: true
- sublevel:
- description: 'Kernel sublevel'
- required: true
- susfs_commit:
- description: 'Commit map (branch:commit,branch:commit...)'
- required: false
- runs:
- using: composite
- steps:
- - name: Setup SUSFS Branch
- shell: bash
- run: |
- SUSFS_BRANCH="gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}"
- SUSFS_REPO="https://gitlab.com/simonpunk/susfs4ksu.git"
-
- echo "Preparing SUSFS for branch: $SUSFS_BRANCH"
-
- # Parse commit map to find the commit for this branch
- COMMIT_MAP="${{ inputs.susfs_commit }}"
- TARGET_COMMIT=""
-
- if [ -n "$COMMIT_MAP" ]; then
- # Split by comma
- IFS=',' read -ra ENTRIES <<< "$COMMIT_MAP"
- for entry in "${ENTRIES[@]}"; do
- # Split by colon
- IFS=':' read -r branch commit <<< "$entry"
- if [ "$branch" == "$SUSFS_BRANCH" ]; then
- TARGET_COMMIT="$commit"
- break
- fi
- done
- fi
-
- if [ -n "$TARGET_COMMIT" ]; then
- echo "Found specific commit for $SUSFS_BRANCH: $TARGET_COMMIT"
- git clone "$SUSFS_REPO" -b "$SUSFS_BRANCH" susfs4ksu
- cd susfs4ksu
- git checkout "$TARGET_COMMIT"
- cd ..
- else
- echo "No specific commit found for $SUSFS_BRANCH, cloning latest..."
- git clone "$SUSFS_REPO" -b "$SUSFS_BRANCH" --depth=1 susfs4ksu
- fi
-
- SUSFS_VERSION="v2.1.0"
- echo "SUSFS_VERSION=$SUSFS_VERSION" >> $GITHUB_ENV
- echo "SUSFS_BRANCH=$SUSFS_BRANCH" >> $GITHUB_ENV
- echo "SUSFS_COMMIT=$TARGET_COMMIT" >> $GITHUB_ENV
- - name: Enable KernelSU SUSFS Config
- shell: bash
- working-directory: ${{ github.workspace }}/kernel
- run: |
- cat >> "${{ github.workspace }}/wild_gki.fragment" << 'EOF'
- # KernelSU SUSFS Configuration
- CONFIG_KSU_SUSFS=y
- CONFIG_KSU_SUSFS_SUS_PATH=y
- CONFIG_KSU_SUSFS_SUS_MOUNT=y
- CONFIG_KSU_SUSFS_SUS_KSTAT=y
- CONFIG_KSU_SUSFS_SPOOF_UNAME=y
- CONFIG_KSU_SUSFS_ENABLE_LOG=y
- CONFIG_KSU_SUSFS_HIDE_KSU_SUSFS_SYMBOLS=y
- CONFIG_KSU_SUSFS_SPOOF_CMDLINE_OR_BOOTCONFIG=y
- CONFIG_KSU_SUSFS_OPEN_REDIRECT=y
- CONFIG_KSU_SUSFS_SUS_MAP=y
- EOF
- - name: Apply KSU SUSFS Patches
- shell: bash
- working-directory: ${{ github.workspace }}/kernel/KernelSU-Next
- run: |
- cp ${{ github.workspace }}/kernel_patches/wild/ksun-0daf55582-susfs-v2.1.0-e259e7d6.patch ./
- patch -p1 < ksun-0daf55582-susfs-v2.1.0-e259e7d6.patch
- - name: Apply Kernel SUSFS Patches
- shell: bash
- working-directory: ${{ github.workspace }}/kernel/common
- run: |
- # Apply base SUSFS patches
- cp "${{ github.workspace }}/susfs4ksu/kernel_patches/fs/"* "${{ github.workspace }}/kernel/common/fs/"
- cp "${{ github.workspace }}/susfs4ksu/kernel_patches/include/linux/"* "${{ github.workspace }}/kernel/common/include/linux/"
- cp ${{ github.workspace }}/susfs4ksu/kernel_patches/50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch ./
- FIX_NAMESPACE=0
- if [ "${{ inputs.kernel_version }}" = "6.1" ]; then
- if grep -q '^#include <trace/hooks/blk.h>$' fs/namespace.c; then
- sed -i '/^#include <trace\/hooks\/blk.h>$/d' fs/namespace.c
- FIX_NAMESPACE=1
- fi
- fi
- patch -p1 < 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true
- if [ "$FIX_NAMESPACE" = "1" ]; then
- sed -i '/^#include "internal.h"$/a #include <trace/hooks/blk.h>' fs/namespace.c
- fi
- SHOULD_FIX=0
- if [[ "${{ inputs.android_version }}" = "android12" && "${{ inputs.kernel_version }}" = "5.10" && "${{ inputs.sublevel }}" -le 209 ]]; then
- SHOULD_FIX=1
- elif [[ "${{ inputs.android_version }}" = "android13" && "${{ inputs.kernel_version }}" = "5.10" && "${{ inputs.sublevel }}" -le 209 && "${{ inputs.os_patch_level }}" != "2024-05" ]]; then
- SHOULD_FIX=1
- elif [[ "${{ inputs.android_version }}" = "android13" && "${{ inputs.kernel_version }}" = "5.15" && "${{ inputs.sublevel }}" -le 148 && "${{ inputs.os_patch_level }}" != "2024-05" ]]; then
- SHOULD_FIX=1
- elif [[ "${{ inputs.android_version }}" = "android14" && "${{ inputs.kernel_version }}" = "5.15" && "${{ inputs.sublevel }}" -le 148 && "${{ inputs.os_patch_level }}" != "2024-05" ]]; then
- SHOULD_FIX=1
- elif [[ "${{ inputs.android_version }}" = "android14" && "${{ inputs.kernel_version }}" = "6.1" ]]; then
- SHOULD_FIX=1
- fi
- if [[ "$SHOULD_FIX" = "1" ]]; then
- sed -i -e 's/goto show_pad;/return 0;/' ./fs/proc/task_mmu.c
- fi
- - name: Apply Android 12 5.10 Fixes
- if: inputs.android_version == 'android12' && inputs.kernel_version == '5.10'
- shell: bash
- working-directory: ${{ github.workspace }}/kernel/common
- run: |
- if [ {{ inputs.sublevel }} -le "43" ]; then
- sed '/size_t this_len = min_t(size_t, count, PAGE_SIZE);/r'<(cat <<'EOF'
- #ifdef CONFIG_KSU_SUSFS_SUS_MAP
- vma = find_vma(mm, addr);
- if (vma && vma->vm_file) {
- struct inode *inode = file_inode(vma->vm_file);
- if (SUSFS_IS_INODE_SUS_MAP(inode)) {
- if (write) {
- copied = -EFAULT;
- } else {
- copied = -EIO;
- }
- *ppos = addr;
- mmput(mm);
- goto free;
- }
- }
- #endif
- EOF
- ) fs/proc/base.c
- if [ {{ inputs.sublevel }} -le "117" ]; then
- sed '/size_t this_len = min_t(size_t, count, PAGE_SIZE);/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,
- inotify_mark_user_mask(mark));
- 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
|