Skip to content
Closed

Dev #165

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
8c2d2ae
sucompat: change to inlinehook, skip calculate sizeof pt_regs
Apr 8, 2024
decaf80
skip calculate sizeof struct pt_regs
Apr 8, 2024
3d9bdeb
su command: fuck compat compat-syscall for 32-bits
Apr 9, 2024
6f1781a
fix: hook input_handle_event
May 1, 2024
cbd6d6d
maintain pt_regs offset
May 1, 2024
221a3d5
1. kpatch is deprecated, instead is supercmd 2. hook imporvoed 3. …
bmax121 May 16, 2024
20de590
fix ci build
May 16, 2024
537bec4
fix ci build
May 16, 2024
fb450ed
update dev ci
May 16, 2024
50a65d3
update ci
May 16, 2024
d8f84fe
a
May 21, 2024
f51bcb8
a
May 21, 2024
93aff59
make user hdr
May 25, 2024
1230078
make user hdr
May 25, 2024
24b9669
make user hdr
May 26, 2024
e33d3a6
supercall: Fix super key authentication (#99)
pomelohan Jun 11, 2024
2cca05f
kpm on post-fs-data, 0..
Jun 13, 2024
df0df40
tmp fix rc work
Jun 14, 2024
6c59ee8
supercall: Add SUPERCALL_SU_GET_SAFEMODE (#101)
pomelohan Jun 15, 2024
dd63feb
a
Jul 8, 2024
b8deb49
a
Jul 14, 2024
031bcfd
user_init: Fix `services` typo
Admirepowered Jul 20, 2024
8fee643
selinux: Fix Android specific configs handling in policydb_write()
pomelohan Jul 20, 2024
2b1fd1c
Merge pull request #108 from pomelohan/dev
bmax121 Jul 20, 2024
37a0481
user_init: Add `uid-listener` feature (#110)
pomelohan Jul 24, 2024
ec82432
kptools with -s instead of -S, to avoide side-channel detection
Jul 31, 2024
4455d14
Merge branch 'dev' of https://github.com/bmax121/KernelPatch into dev
Jul 31, 2024
6ea388d
disable hash superkey after reset key
Jul 31, 2024
ad4ea83
reset superkey dont disable hash
Jul 31, 2024
7304994
a
Jul 31, 2024
d501a84
a
Aug 13, 2024
c485790
a
Aug 18, 2024
b1e3678
fix kallsyms_all=n
Aug 21, 2024
27ce684
kpm: Fix alignment issue in `module` (#118)
NepXIN Aug 26, 2024
9841e46
a
Sep 1, 2024
ab52802
Merge branch 'dev' of https://github.com/bmax121/KernelPatch into dev
Sep 1, 2024
b237b6d
a
Sep 1, 2024
33b7e08
fix supercmd report
Sep 5, 2024
6511dab
feat: try support 6.6
Sep 5, 2024
c098861
fix: preset symbol
Sep 5, 2024
34ae841
export syscall hook function
Sep 13, 2024
3fc74c2
add exclude, change shell default su scontext
Sep 18, 2024
bb3a828
1. enable sepolicy flag fix, 2. fix some supercmd, 3. module code siz…
Sep 21, 2024
deed2d1
test fix bti
Sep 21, 2024
dabe16f
fix: bti caused boot-stock or hook-crash
Sep 21, 2024
b6c45ae
fix typo
Sep 21, 2024
925f287
rename patch_symbol to patch_config
Sep 22, 2024
3eafd3a
fix sepolicy
Sep 24, 2024
325faac
tmp save
Sep 28, 2024
f4a1aab
refactor: su command
Sep 30, 2024
a4c4082
add exclude api, add exclude command to supercmd
Sep 30, 2024
74a299d
a
Sep 30, 2024
f01a1f3
a
Oct 2, 2024
03e9738
a
Oct 2, 2024
9d90bf0
a
Oct 2, 2024
67ab867
add exclude supercall
Oct 3, 2024
124f704
add kstorage list interface, android exclude list interface
Oct 5, 2024
bce85b1
fix su list, opt user init
Oct 6, 2024
f576680
fix allow uids
Oct 6, 2024
13af937
fix su compat permission check
Oct 7, 2024
9ba7e3d
fix and opt: kallsyms_marker
Oct 23, 2024
4a62873
fix patch option --root-skey
Oct 24, 2024
50e6a15
userd: Fix `boot-completed` event trigger (#134)
pomelohan Oct 26, 2024
6a55d8c
add buildtime
Oct 27, 2024
77b26e9
fix, typo
Oct 28, 2024
e70b529
format
Oct 28, 2024
82a2849
fix: duplicate supercall id
Oct 28, 2024
7b0295d
kptools: add dump iconfig (#140)
Admirepowered Nov 15, 2024
d2e86e3
fix patch failed for linux 6.1.99 (pixel6,pixel8)
Nov 21, 2024
fa35fde
userd: Fix `/dev/user_init_log` moving (#147)
pomelohan Nov 27, 2024
fe8603f
add zlib in windows (#149)
Admirepowered Dec 5, 2024
40492c8
fix:#148 (#154)
Tr33NewBee Jan 7, 2025
d2aa842
Revert "fix:#148 (#154)" (#155)
bmax121 Jan 7, 2025
fd4d5a7
fix memmem
bmax121 Feb 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: false
BreakBeforeSemicolons: None
# BreakBeforeSemicolons: None
ColumnLimit: 120
CommentPragmas: "^ IWYU pragma:"
CompactNamespaces: false
Expand Down
89 changes: 16 additions & 73 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,19 @@ jobs:
- name: Build kpimg
run: |
export TARGET_COMPILE=`pwd`/arm-gnu-toolchain-12.2.rel1-x86_64-aarch64-none-elf/bin/aarch64-none-elf-

cd kernel
make
mv kpimg kpimg-linux
mv kpimg.elf kpimg.elf-linux
make clean

export ANDROID=1
make
mv kpimg kpimg-android
mv kpimg.elf kpimg.elf-android
make clean

unset ANDROID
make
mv kpimg kpimg-linux
mv kpimg.elf kpimg.elf-linux
make clean

cd ..
cd kpms
Expand Down Expand Up @@ -125,7 +128,7 @@ jobs:
replacesArtifacts: true
omitBodyDuringUpdate: true

Build-android-kpatch-kptools:
Build-android-kptools:
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -149,7 +152,7 @@ jobs:
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25b
ndk-version: r26b
add-to-path: true

- name: Make hdr
Expand All @@ -158,21 +161,6 @@ jobs:
cd kernel
make hdr

- name: Build kpatch-android
run: |
cd user
export ANDROID=1
mkdir -p build/android && cd build/android
echo ${{ steps.setup-ndk.outputs.ndk-path }}
cmake \
-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_PLATFORM=android-33 \
-DANDROID_ABI=arm64-v8a ../..
cmake --build .
unset ANDROID
mv kpatch kpatch-android

- name: Build kptools-android
run: |
cd tools
Expand All @@ -192,8 +180,6 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.parse_version.outputs.VERSION }}
artifacts: |
user/build/android/kpatch-android
user/build/android/libapjni.so
tools/build/android/kptools-android
allowUpdates: true
replacesArtifacts: true
Expand Down Expand Up @@ -267,6 +253,7 @@ jobs:
install: >-
msys/make
msys/gcc
msys/zlib-devel
- name: Copyfile
shell: pwsh
run: |
Expand All @@ -283,8 +270,11 @@ jobs:
- name: Copyfile2
shell: pwsh
run: |
cp .\tools\kptools.exe .\tools\kptools-msys2.exe
7z a kptools-msys2-win .\tools\kptools-msys2.exe D:\a\_temp\msys64\usr\bin\msys-2.0.dll
mkdir .\win
cp .\tools\kptools.exe .\win\kptools-msys2.exe
cp D:\a\_temp\msys64\usr\bin\msys-2.0.dll .\win
cp D:\a\_temp\msys64\usr\bin\msys-z.dll .\win
7z a kptools-msys2-win .\win
- name: Release
uses: ncipollo/[email protected]
with:
Expand All @@ -295,53 +285,6 @@ jobs:
allowUpdates: true
replacesArtifacts: true

Build-kptools-windows-llvm:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out
uses: actions/checkout@v3
- name: Install mingw32 cross toolchains
run: |
MINGW_LLVM_URL="https://github.com/mstorsjo/llvm-mingw/releases/download/20231128/llvm-mingw-20231128-msvcrt-ubuntu-20.04-x86_64.tar.xz"
mkdir -p $HOME/mingw-llvm
wget $MINGW_LLVM_URL -O $HOME/mingw-llvm/llvm.tar.xz
cd $HOME/mingw-llvm
tar -xvf llvm.tar.xz --strip-components 1
- name: Generate version
id: parse_version
run: |
MAJOR=$(grep '#define MAJOR' version | awk '{print $3}')
MINOR=$(grep '#define MINOR' version | awk '{print $3}')
PATCH=$(grep '#define PATCH' version | awk '{print $3}')
VERSION="$MAJOR.$MINOR.$PATCH"
echo "Generated Version: $VERSION"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Build kptools
run: |
export PATH="$HOME/mingw-llvm/bin:$PATH"
export ANDROID=1
ABIS="x86_64 i686 aarch64 armv7"
for i in $ABIS; do
make -C kernel hdr TARGET_COMPILE=placeholder
echo "- Compiling kptools-$i-win.exe"
make -C tools CC=$i-w64-mingw32-clang
mv tools/kptools.exe kptools-$i-win.exe
make -C tools clean
done
7za a kptools-llvm-win.zip -tZIP *.exe
- name: Release
uses: ncipollo/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.parse_version.outputs.VERSION }}
artifacts: |
kptools-llvm-win.zip
allowUpdates: true
replacesArtifacts: true
omitBodyDuringUpdate: true

Build-kptools-mac:
runs-on: macos-latest
permissions:
Expand Down
42 changes: 12 additions & 30 deletions .github/workflows/build_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ on:
push:
branches: ["dev"]
paths:
- ".github/workflows/build.yml"
- ".github/workflows/build_dev.yml"
- "kernel/**"
- "user/**"
- "tools/**"
- "version"
pull_request:
branches: ["dev"]
paths:
- ".github/workflows/build.yml"
- ".github/workflows/build_dev.yml"
- "kernel/**"
- "user/**"
- "tools/**"
Expand Down Expand Up @@ -48,14 +48,18 @@ jobs:
run: |
export TARGET_COMPILE=`pwd`/arm-gnu-toolchain-12.2.rel1-x86_64-aarch64-none-elf/bin/aarch64-none-elf-
cd kernel
make
mv kpimg kpimg-linux
mv kpimg.elf kpimg.elf-linux
make clean

export ANDROID=1
make
mv kpimg kpimg-android
mv kpimg.elf kpimg.elf-android
make clean

unset ANDROID
make
mv kpimg kpimg-linux
mv kpimg.elf kpimg.elf-linux
make clean

cd ..
cd kpms
Expand Down Expand Up @@ -85,7 +89,6 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.parse_version.outputs.VERSION }}-dev
commit: dev
artifacts: |
kernel/kpimg-linux
kernel/kpimg-android
Expand Down Expand Up @@ -127,14 +130,13 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.parse_version.outputs.VERSION }}-dev
commit: dev
artifacts: |
kpuser.zip
allowUpdates: true
replacesArtifacts: true
prerelease: true

Build-android-kpatch-kptools:
Build-android-kptools:
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -158,7 +160,7 @@ jobs:
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r25b
ndk-version: r26b
add-to-path: true

- name: Make hdr
Expand All @@ -167,21 +169,6 @@ jobs:
cd kernel
make hdr

- name: Build kpatch-android
run: |
cd user
export ANDROID=1
mkdir -p build/android && cd build/android
echo ${{ steps.setup-ndk.outputs.ndk-path }}
cmake \
-DCMAKE_TOOLCHAIN_FILE=${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DANDROID_PLATFORM=android-33 \
-DANDROID_ABI=arm64-v8a ../..
cmake --build .
unset ANDROID
mv kpatch kpatch-android

- name: Build kptools-android
run: |
cd tools
Expand All @@ -200,10 +187,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.parse_version.outputs.VERSION }}-dev
commit: dev
artifacts: |
user/build/android/kpatch-android
user/build/android/libapjni.so
tools/build/android/kptools-android
allowUpdates: true
replacesArtifacts: true
Expand Down Expand Up @@ -246,7 +230,6 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.parse_version.outputs.VERSION }}-dev
commit: dev
artifacts: |
tools/build/kptools-linux
allowUpdates: true
Expand Down Expand Up @@ -289,7 +272,6 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.parse_version.outputs.VERSION }}-dev
commit: dev
artifacts: |
tools/build/kptools-mac
allowUpdates: true
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
build

test
.test

script
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ CONFIG_KALLSYMS=y

Currently only supports arm64 architecture.

Linux 3.18 - 6.2 (theoretically)
Linux 6.3+ (not yet adapted)
Linux 3.18 - 6.6 (theoretically)

## Get Involved

Expand Down
1 change: 1 addition & 0 deletions doc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
api
3 changes: 3 additions & 0 deletions doc/en/super-command.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Super Command

truncate SUPERKEY help
18 changes: 18 additions & 0 deletions doxyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
PROJECT_NAME = "KernelPatch Document"
OUTPUT_DIRECTORY = ./doc/api

INPUT = \
./user/supercall.h \
./kernel/include/hook.h \
./kernel/patch/include/accctl.h \
./kernel/patch/include/taskext.h \
./kernel/patch/include/uapi/scdefs.h \

FILE_PATTERNS = *.h *.md

RECURSIVE = YES
GENERATE_LATEX = NO
SOURCE_BROWSER = YES
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
5 changes: 3 additions & 2 deletions kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ ${TARGET}.elf: ${OBJS}

.PHONY: hdr
hdr:
cp -Rf patch/include/uapi ../user
cp -f include/preset.h ../tools
cp -Rf patch/include/uapi ../user/
cp -f ../version ../user/
cp -f include/preset.h ../tools/

.PHONY: clean
clean:
Expand Down
4 changes: 2 additions & 2 deletions kernel/base/baselib.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ char *lib_strncat(char *dst, const char *src, size_t n)
*q++ = ch = *p++;
if (!ch) return dst;
}
*q = '\0';
// *q = '\0';
return dst;
}

Expand Down Expand Up @@ -277,7 +277,7 @@ char *lib_strncpy(char *dst, const char *src, size_t n)
*q++ = ch = *p++;
if (!ch) break;
}
*q = '\0';
// *q = '\0';
return dst;
}

Expand Down
Loading
Loading