mirror of
https://github.com/pwndbg/linux-exploit-dev-env.git
synced 2026-11-13 18:59:53 -10:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20a2cc181f | ||
|
|
9000b43609 | ||
|
|
ddf4350349 | ||
|
|
03a637dade | ||
|
|
fb0328472b | ||
|
|
a037d251dc | ||
|
|
5239a1a8df |
No files matched your search
@@ -7,7 +7,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-22.04, ubuntu-20.04]
|
||||
kernel: [{ack: 0, version: 5.10.y}, {ack: 0, version: 5.15.y}, {ack: 0, version: 6.1.y}, {ack: 1, version: android13-5.10-lts}]
|
||||
kernel: [{ack: 0, version: 5.10.y}, {ack: 0, version: 5.15.y}, {ack: 0, version: 6.1.y}, {ack: 0, version: 6.6.y}, {ack: 1, version: android13-5.10-lts}, {ack: 1, version: android14-5.15-lts}]
|
||||
arch: [arm64, x86_64]
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 100
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
[submodule "ack/common-modules/virtual-device"]
|
||||
path = ack/common-modules/virtual-device
|
||||
url = https://android.googlesource.com/kernel/common-modules/virtual-device
|
||||
branch = android13-5.10
|
||||
branch = android14-5.15
|
||||
[submodule "ack/common"]
|
||||
path = ack/common
|
||||
url = https://android.googlesource.com/kernel/common
|
||||
branch = android13-5.10
|
||||
branch = android14-5.15
|
||||
[submodule "linux"]
|
||||
path = linux
|
||||
url = https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
|
||||
|
||||
@@ -26,7 +26,7 @@ ifeq ($(ARCH),aarch64)
|
||||
else ifeq ($(ARCH),x86)
|
||||
$(warning $(YELLOW)Incorrect architecture 'x86', using 'x86_64' instead $(NC))
|
||||
ARCH := x86_64
|
||||
else ifeq ($(filter x86_64 arm64,$(ARCH)),)
|
||||
else ifeq ($(filter x86_64 arm64 i386,$(ARCH)),)
|
||||
$(error Invalid architecture $(ARCH))
|
||||
endif
|
||||
|
||||
@@ -39,61 +39,71 @@ clean: linux_clean tools-vm_clean
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo '$(GREEN)General Environment Variables:$(NC)'
|
||||
@echo ' ARCH - Specify one of the supported architectures: x86_64, arm64 (default: x86_64)'
|
||||
@echo ' ACK - Set to 1 if building ACK instead of the Linux kernel. Does not need to be set for `ack` and `run-ack` targets (default: 0)'
|
||||
@echo ' ARCH - Specify one of the supported architectures: x86_64, i386, arm64 (default: x86_64)'
|
||||
@echo ' ACK - Set to 1 to build ACK instead of the Linux kernel. Does not need to be set for `ack` and `run-ack` targets (default: 0)'
|
||||
@echo ' VERBOSE - Set to 1 to enable verbose output (default: 0)'
|
||||
@echo ''
|
||||
@echo '$(GREEN)Build/Config:$(NC)'
|
||||
@echo ' Targets:'
|
||||
@echo ' linux (default) - Builds the Linux kernel'
|
||||
@echo ' linux_defconfig - Builds the Linux kernel'
|
||||
@echo ' linux_modules - Builds the Linux kernel modules'
|
||||
@echo ' linux (default) - Build the Linux kernel'
|
||||
@echo ' linux_defconfig - Run `make defconfig`'
|
||||
@echo ' linux_menuconfig - Run `make menuconfig`'
|
||||
@echo ' linux_modules - Build the Linux kernel modules'
|
||||
@echo ' linux_debpkg - Creates a Debian package for the kernel'
|
||||
@echo ' ack - Builds the Android Common Kernel'
|
||||
@echo ' tools-vm - Builds linux/tools/vm'
|
||||
@echo ' ack - Build the Android Common Kernel'
|
||||
@echo ' tools-vm - Build linux/tools/vm'
|
||||
@echo ''
|
||||
@echo ' Environment Variables:'
|
||||
@echo ' LINUX_DEFCONFIG - The defconfig to use when building the kernel (default: defconfig, ACK default: gki_defconfig)'
|
||||
@echo ' LINUX_SRC - The path to the kernel source directory (default: linux, ACK default: ack/common)'
|
||||
@echo ' LINUX_OUT - The path where the kernel build output should be stored (default: out/linux/$$ARCH, ACK default: out/ack/common/$$ARCH)'
|
||||
@echo ' LINUX_CONFIG_FRAGMENT - A kernel config fragment to merge with the defconfig (default: config/config.fragment, ACK default: config/config.fragment)'
|
||||
@echo ' LINUX_CONFIG_FRAGMENT - A kernel config fragment to merge with the defconfig (default: config/config.fragment)'
|
||||
@echo ''
|
||||
@echo '$(GREEN)Clean:$(NC)'
|
||||
@echo ' Targets:'
|
||||
@echo ' clean - Cleans output from default build targets'
|
||||
@echo ' <target>_clean - Cleans output for <target>'
|
||||
@echo ' clean - Clean output from default build targets'
|
||||
@echo ' <target>_clean - Clean output for <target>, where <target> is one of: ack, linux, tools-vm, rootfs'
|
||||
@echo ''
|
||||
@echo '$(GREEN)Run/Debug:$(NC)'
|
||||
@echo ' Targets:'
|
||||
@echo ' run - Run QEMU with the built kernel, bootloader, and rootfs image'
|
||||
@echo ' run - Run QEMU with the built kernel and rootfs image'
|
||||
@echo ' run-ack - Same as `run` but runs ACK instead'
|
||||
@echo ''
|
||||
@echo ' Environment Variables:'
|
||||
@echo ' GDB - Set to 1 to start a gdbserver and wait for GDB when running QEMU (default: 0)'
|
||||
@echo ' CPU - Specify the number of CPUs to use when running QEMU (default: 4)'
|
||||
@echo ' MEM - Specify the memory size in MB to use when running QEMU (default: 1024)'
|
||||
@echo ' QEMU_EXTRA_ARGS - Specify additional arguments to pass to QEMU (default: "")'
|
||||
@echo ' QEMU_EXTRA_KERNEL_CMDLINE - Specify additional arguments to pass to the kernel (default: "")'
|
||||
@echo ' QEMU_KERNEL_IMAGE - The path to the kernel image to run (x86_64 default: $$LINUX_OUT/arch/$$ARCH/boot/bzImage, arm64 default: $$LINUX_OUT/arch/$$ARCH/boot/Image)'
|
||||
@echo ' ROOTFS - The path to the rootfs image file (default: rootfs/rootfs-$$ARCH.img)'
|
||||
@echo ' ROOTFS_FORMAT - The format of the rootfs image file (default: qcow2)'
|
||||
@echo ' INITRD - The path to a gziped initramfs CPIO file to use instead of a rootfs image (default: "")'
|
||||
@echo ' RDINIT - The value of the `rdinit` kernel command line paramter (default: "", default if INITRD is set: /sbin/init)'
|
||||
@echo ' CPU - The number of CPUs to use when running QEMU (default: 4)'
|
||||
@echo ' MEM - The memory size in MB to use when running QEMU (default: 1024)'
|
||||
@echo ' QEMU_EXTRA_ARGS - Additional arguments to pass to QEMU (default: "")'
|
||||
@echo ' QEMU_EXTRA_KERNEL_CMDLINE - Additional arguments to pass to the kernel (default: "")'
|
||||
@echo ' QEMU_KERNEL_IMAGE - The path to the kernel image to run (x86_64/i386 default: $$LINUX_OUT/arch/$$ARCH/boot/bzImage, arm64 default: $$LINUX_OUT/arch/$$ARCH/boot/Image)'
|
||||
@echo ' ROOTFS - The path to the rootfs image file (default: rootfs/alpine-$$ARCH.img)'
|
||||
@echo ' ROOTFS_FORMAT - The format of the rootfs image file: raw, qcow2 (default: qcow2)'
|
||||
@echo ' INITRD - Set to 1 to use the $$CPIO_FILE initramfs instead of the $$ROOTFS image as the rootfs, or specify the path to an alternative CPIO file (default: "")'
|
||||
@echo ' RDINIT - The value of the `rdinit` kernel command line parameter (default: "", default if INITRD is set: /sbin/init)'
|
||||
@echo ' ECHR - The value of the QEMU `-echr` flag (default: 1)'
|
||||
@echo ' ROOT - The value of the `root` kernel command line parameter (default: /dev/vda)'
|
||||
@echo ' RW - Whether to mount the rootfs as read-write or read-only: ro, rw (default: rw)'
|
||||
@echo ' KASLR - Set to 1 to enable KASLR (default: 0)'
|
||||
@echo ''
|
||||
@echo '$(GREEN)rootfs:$(NC)'
|
||||
@echo ' Targets:'
|
||||
@echo ' rootfs-init - Extracts the Alpine Linux rootfs to rootfs/alpine-$$ARCH, makes arch-specific changes, and builds a rootfs image at rootfs/alpine-$$ARCH.img'
|
||||
@echo ' rootfs - An alias for the `ext4` target'
|
||||
@echo ' ext4 - Builds a QCOW2 rootfs image at rootfs/alpine-$$ARCH.img with an ext4 filesystem'
|
||||
@echo ' cpio - Builds a gziped initramfs CPIO file from the $$INITRAMFS_DIR directory'
|
||||
@echo ' rootfs-mount - Mount rootfs image at /tmp/rootfs'
|
||||
@echo ' rootfs-unmount - Unmount rootfs image'
|
||||
@echo ' rootfs-init - Extract the Alpine Linux rootfs to $$ROOTFS_DIR and then run the `rootfs-overlay` target'
|
||||
@echo ' rootfs-overlay - Apply arch-specific changes to $$ROOTFS_DIR and run the `rootfs` target'
|
||||
@echo ' rootfs - Run the `ext4` and `cpio` targets'
|
||||
@echo ' ext4 - Build a $$ROOTFS $$ROOTFS_FORMAT (default qcow2) image with an ext4 filesystem from $$ROOTFS_DIR'
|
||||
@echo ' cpio - Build a $$CPIO_FILE gzipped initramfs CPIO file from $$ROOTFS_DIR'
|
||||
@echo ' initramfs - An alias for the `cpio` target'
|
||||
@echo ' uncpio - Extract $$CPIO_FILE to $$ROOTFS_DIR'
|
||||
@echo ' rootfs-mount - Mount $$ROOTFS image at /tmp/rootfs'
|
||||
@echo ' rootfs-unmount - Unmount rootfs image from /tmp/rootfs'
|
||||
@echo ' chroot - chroot into $$ROOTFS_DIR'
|
||||
@echo ''
|
||||
@echo ' Environment Variables:'
|
||||
@echo ' EXT4_SIZE - The disk size of the rootfs image to build'
|
||||
@echo ' ROOTFS_DIR - The directory to create the ext4 rootfs image and initramfs CPIO from (default: rootfs/alpine-$$ARCH)'
|
||||
@echo ' ROOTFS - The path to the rootfs image file (default: rootfs/rootfs-$$ARCH.img)'
|
||||
@echo ' ROOTFS_FORMAT - The format of the rootfs image file (default: qcow2)'
|
||||
@echo ' ROOTFS - The path to the rootfs image file (default: rootfs/alpine-$$ARCH.img)'
|
||||
@echo ' ROOTFS_FORMAT - The format of the rootfs image file: raw, qcow2 (default: qcow2)'
|
||||
@echo ' CPIO_FILE - The path to the CPIO file to create (default: rootfs/alpine-$$ARCH.cpio.gz)'
|
||||
@echo ''
|
||||
@echo '$(GREEN)Miscellaneous:$(NC)'
|
||||
@echo ' Targets:'
|
||||
@@ -139,6 +149,9 @@ LINUX_CONFIG := $(LINUX_OUT)/.config
|
||||
ifeq ($(ARCH),x86_64)
|
||||
TARGET := x86_64-pc-linux-gnu
|
||||
KERNEL_IMAGE := $(LINUX_OUT)/arch/$(ARCH)/boot/bzImage
|
||||
else ifeq ($(ARCH),i386)
|
||||
TARGET := i386-pc-linux-gnu
|
||||
KERNEL_IMAGE := $(LINUX_OUT)/arch/$(ARCH)/boot/bzImage
|
||||
else ifeq ($(ARCH),arm64)
|
||||
TARGET := aarch64-linux-gnu
|
||||
KERNEL_IMAGE := $(LINUX_OUT)/arch/$(ARCH)/boot/Image
|
||||
@@ -152,7 +165,8 @@ LINUX_MAKE := \
|
||||
CROSS_COMPILE=$(TARGET)- \
|
||||
LLVM=1 LLVM_IAS=1 \
|
||||
V=$(VERBOSE) \
|
||||
O=$(LINUX_OUT)
|
||||
O=$(LINUX_OUT) \
|
||||
-j `nproc`
|
||||
|
||||
$(CLANG_DIR):
|
||||
$(warning $(YELLOW)Clang directory $(CLANG_DIR) does not exist, downloading prebuilt binaries $(NC))
|
||||
@@ -382,7 +396,9 @@ ifeq ($(ARCH),x86_64)
|
||||
ifneq ($(CI),true)
|
||||
QEMU_ARGS += -accel kvm
|
||||
endif
|
||||
|
||||
else ifeq ($(ARCH),i386)
|
||||
QEMU_BIN := qemu-system-i386
|
||||
QEMU_KERNEL_CMDLINE += console=ttyS0
|
||||
else
|
||||
QEMU_BIN := qemu-system-aarch64
|
||||
QEMU_KERNEL_CMDLINE += console=ttyAMA0
|
||||
|
||||
@@ -52,61 +52,71 @@ ARCH=arm64 make run
|
||||
```
|
||||
$ make help
|
||||
General Environment Variables:
|
||||
ARCH - Specify one of the supported architectures: x86_64, arm64 (default: x86_64)
|
||||
ACK - Set to 1 if building ACK instead of the Linux kernel. Does not need to be set for `ack` and `run-ack` targets (default: 0)
|
||||
ARCH - Specify one of the supported architectures: x86_64, i386, arm64 (default: x86_64)
|
||||
ACK - Set to 1 to build ACK instead of the Linux kernel. Does not need to be set for `ack` and `run-ack` targets (default: 0)
|
||||
VERBOSE - Set to 1 to enable verbose output (default: 0)
|
||||
|
||||
Build/Config:
|
||||
Targets:
|
||||
linux (default) - Builds the Linux kernel
|
||||
linux_defconfig - Builds the Linux kernel
|
||||
linux_modules - Builds the Linux kernel modules
|
||||
ack - Builds the Android Common Kernel
|
||||
tools-vm - Builds linux/tools/vm
|
||||
linux (default) - Build the Linux kernel
|
||||
linux_defconfig - Run `make defconfig`
|
||||
linux_menuconfig - Run `make menuconfig`
|
||||
linux_modules - Build the Linux kernel modules
|
||||
linux_debpkg - Creates a Debian package for the kernel
|
||||
ack - Build the Android Common Kernel
|
||||
tools-vm - Build linux/tools/vm
|
||||
|
||||
Environment Variables:
|
||||
LINUX_DEFCONFIG - The defconfig to use when building the kernel (default: defconfig, ACK default: gki_defconfig)
|
||||
LINUX_SRC - The path to the kernel source directory (default: linux, ACK default: ack/common)
|
||||
LINUX_OUT - The path where the kernel build output should be stored (default: out/linux/$ARCH, ACK default: out/ack/common/$ARCH)
|
||||
LINUX_CONFIG_FRAGMENT - A kernel config fragment to merge with the defconfig (default: config/config.fragment, ACK default: config/config.fragment)
|
||||
LINUX_CONFIG_FRAGMENT - A kernel config fragment to merge with the defconfig (default: config/config.fragment)
|
||||
|
||||
Clean:
|
||||
Targets:
|
||||
clean - Cleans output from default build targets
|
||||
<target>_clean - Cleans output for <target>
|
||||
clean - Clean output from default build targets
|
||||
<target>_clean - Clean output for <target>, where <target> is one of: ack, linux, tools-vm, rootfs
|
||||
|
||||
Run/Debug:
|
||||
Targets:
|
||||
run - Run QEMU with the built kernel, bootloader, and rootfs image
|
||||
run - Run QEMU with the built kernel and rootfs image
|
||||
run-ack - Same as `run` but runs ACK instead
|
||||
|
||||
Environment Variables:
|
||||
GDB - Set to 1 to start a gdbserver and wait for GDB when running QEMU (default: 0)
|
||||
CPU - Specify the number of CPUs to use when running QEMU (default: 4)
|
||||
MEM - Specify the memory size in MB to use when running QEMU (default: 1024)
|
||||
QEMU_EXTRA_ARGS - Specify additional arguments to pass to QEMU (default: "")
|
||||
QEMU_EXTRA_KERNEL_CMDLINE - Specify additional arguments to pass to the kernel (default: "")
|
||||
KERNEL_IMAGE - The path to the kernel image to run (x86_64 default: $LINUX_OUT/arch/$ARCH/boot/bzImage, arm64 default: $LINUX_OUT/arch/$ARCH/boot/Image)
|
||||
ROOTFS - The path to the rootfs image file (default: rootfs/rootfs-$ARCH.img)
|
||||
ROOTFS_FORMAT - The format of the rootfs image file (default: qcow2)
|
||||
INITRD - The path to a gziped initramfs CPIO file to use instead of a rootfs image (default: "")
|
||||
RDINIT - The value of the `rdinit` kernel command line paramter (default: "", default if INITRD is set: /sbin/init)
|
||||
CPU - The number of CPUs to use when running QEMU (default: 4)
|
||||
MEM - The memory size in MB to use when running QEMU (default: 1024)
|
||||
QEMU_EXTRA_ARGS - Additional arguments to pass to QEMU (default: "")
|
||||
QEMU_EXTRA_KERNEL_CMDLINE - Additional arguments to pass to the kernel (default: "")
|
||||
QEMU_KERNEL_IMAGE - The path to the kernel image to run (x86_64/i386 default: $LINUX_OUT/arch/$ARCH/boot/bzImage, arm64 default: $LINUX_OUT/arch/$ARCH/boot/Image)
|
||||
ROOTFS - The path to the rootfs image file (default: rootfs/alpine-$ARCH.img)
|
||||
ROOTFS_FORMAT - The format of the rootfs image file: raw, qcow2 (default: qcow2)
|
||||
INITRD - Set to 1 to use the $CPIO_FILE initramfs instead of the $ROOTFS image as the rootfs, or specify the path to an alternative CPIO file (default: "")
|
||||
RDINIT - The value of the `rdinit` kernel command line parameter (default: "", default if INITRD is set: /sbin/init)
|
||||
ECHR - The value of the QEMU `-echr` flag (default: 1)
|
||||
ROOT - The value of the `root` kernel command line parameter (default: /dev/vda)
|
||||
RW - Whether to mount the rootfs as read-write or read-only: ro, rw (default: rw)
|
||||
KASLR - Set to 1 to enable KASLR (default: 0)
|
||||
|
||||
rootfs:
|
||||
Targets:
|
||||
rootfs-init - Extracts the Alpine Linux rootfs to rootfs/alpine-$ARCH, makes arch-specific changes, and builds a rootfs image at rootfs/alpine-$ARCH.img
|
||||
rootfs - An alias for the `ext4` target
|
||||
ext4 - Builds a QCOW2 rootfs image at rootfs/alpine-$ARCH.img with an ext4 filesystem
|
||||
cpio - Builds a gziped initramfs CPIO file from the $INITRAMFS_DIR directory
|
||||
rootfs-mount - Mount rootfs image at /tmp/rootfs
|
||||
rootfs-unmount - Unmount rootfs image
|
||||
rootfs-init - Extract the Alpine Linux rootfs to $ROOTFS_DIR and then run the `rootfs-overlay` target
|
||||
rootfs-overlay - Apply arch-specific changes to $ROOTFS_DIR and run the `rootfs` target
|
||||
rootfs - Run the `ext4` and `cpio` targets
|
||||
ext4 - Build a $ROOTFS $ROOTFS_FORMAT (default qcow2) image with an ext4 filesystem from $ROOTFS_DIR
|
||||
cpio - Build a $CPIO_FILE gzipped initramfs CPIO file from $ROOTFS_DIR
|
||||
initramfs - An alias for the `cpio` target
|
||||
uncpio - Extract $CPIO_FILE to $ROOTFS_DIR
|
||||
rootfs-mount - Mount $ROOTFS image at /tmp/rootfs
|
||||
rootfs-unmount - Unmount rootfs image from /tmp/rootfs
|
||||
chroot - chroot into $ROOTFS_DIR
|
||||
|
||||
Environment Variables:
|
||||
EXT4_SIZE - The disk size of the rootfs image to build
|
||||
INITRAMFS_DIR - The directory to create the initramfs from (default: rootfs/alpine-$ARCH)
|
||||
ROOTFS_DIR - The directory to create the ext4/rootfs image from (default: rootfs/alpine-$ARCH)
|
||||
ROOTFS - The path to the rootfs image file (default: rootfs/rootfs-$ARCH.img)
|
||||
ROOTFS_FORMAT - The format of the rootfs image file (default: qcow2)
|
||||
ROOTFS_DIR - The directory to create the ext4 rootfs image and initramfs CPIO from (default: rootfs/alpine-$ARCH)
|
||||
ROOTFS - The path to the rootfs image file (default: rootfs/alpine-$ARCH.img)
|
||||
ROOTFS_FORMAT - The format of the rootfs image file: raw, qcow2 (default: qcow2)
|
||||
CPIO_FILE - The path to the CPIO file to create (default: rootfs/alpine-$ARCH.cpio.gz)
|
||||
|
||||
Miscellaneous:
|
||||
Targets:
|
||||
@@ -114,7 +124,7 @@ Miscellaneous:
|
||||
linux_checkout - Checks out the version specified by $VERSION of the linux kernel in $LINUX_SRC
|
||||
|
||||
Environment Variables:
|
||||
VERSION - The version to download or checkout. If the patch version is a 'y', the latest version of the kernel with that major and minor version is used. Examples: 5.10, 5.10.107, v5.10, 5.10.y, linux-5.10.y, android13-5.10
|
||||
VERSION - The version to download or checkout. For checkout only, if the third number in the version string is a 'y', the latest version of the kernel with that major and minor version is used. Examples: 5.10, 5.10.107, v5.10, 5.10.y, linux-5.10.y
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
+1
-1
Submodule ack/common updated: 7b529581b9...0add0e52ef.
Submodule ack/common-modules/virtual-device updated: 5213b7155b...bc1ecbc0ef.
+1
-1
Submodule linux updated: c9c3395d5e...2cc14f52ae.
Binary file not shown.
+1
-1
@@ -1,4 +1,4 @@
|
||||
file ##LINUX_OUT##/vmlinux
|
||||
source ##LINUX_OUT##/vmlinux-gdb.py
|
||||
target remote :1234
|
||||
add-symbol-file ##LINUX_OUT##/modules_install/lib/modules/5.10.107/extra/art_rootkit.ko -s .text 0xffffffc0091b0800
|
||||
# add-symbol-file ##LINUX_OUT##/modules_install/lib/modules/5.10.107/extra/my_module.ko -s .text 0xffffffc0091b0800
|
||||
Reference in new issue
Block a user