Edit Makefile.
# SPDX-License-Identifier: GPL-2.0
KERNEL_PATH ?= /lib/modules/$(shell uname -r)/build
obj-m += lkdtm.o
lkdtm-objs += core.o
lkdtm-objs += bugs.o
Edit Makefile.
# SPDX-License-Identifier: GPL-2.0
KERNEL_PATH ?= /lib/modules/$(shell uname -r)/build
obj-m += lkdtm.o
lkdtm-objs += core.o
lkdtm-objs += bugs.o
# kernel debug build | |
apt install -y build-essential crossbuild-essential-arm64 libssl-dev libncurses-dev flex bison libelf-dev dwarves pahole | |
apt install -y linux-source-5.15.0 | |
wget https://src.fedoraproject.org/rpms/kernel/blob/3fbb080931cb5dddc42d2b92d1bfdb810b76d01e/f/kernel-aarch64-debug-rhel.config | |
# cp kernel-aarch64-debug-rhel.config linux-source-5.15.0/.config | |
cd linux-source-5.15.0 |
# | |
# Automatically generated file; DO NOT EDIT. | |
# Linux/arm64 5.15.78 Kernel Configuration | |
# | |
CONFIG_CC_VERSION_TEXT="aarch64-linux-gnu-gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0" | |
CONFIG_CC_IS_GCC=y | |
CONFIG_GCC_VERSION=110300 | |
CONFIG_CLANG_VERSION=0 | |
CONFIG_AS_IS_GNU=y | |
CONFIG_AS_VERSION=23800 |
#include <stdio.h> | |
void DumpHex(const void* data, size_t size) { | |
char ascii[17]; | |
size_t i, j; | |
ascii[16] = '\0'; | |
for (i = 0; i < size; ++i) { | |
printf("%02X ", ((unsigned char*)data)[i]); | |
if (((unsigned char*)data)[i] >= ' ' && ((unsigned char*)data)[i] <= '~') { | |
ascii[i % 16] = ((unsigned char*)data)[i]; |
Introduced in musl v1.2.1. Design goal: "Strong hardening against memory usage errors by the caller, including detection of overflows, double-free, and use-after-free, and does not admit corruption of allocator state via these errors."
// Singleton: ctx
struct malloc_context {
uint64_t secret;
#ifndef PAGESIZE
size_t pagesize;
KDIR := /home/chriz/repositories/WSL2-Linux-Kernel/ | |
obj-m += chriz_ioctl_kernel.o | |
all: | |
$(MAKE) -C $(KDIR) M=$(PWD) modules | |
gcc -o chriz_ioctl_user chriz_ioctl_user.c | |
clean: | |
rm -rf *.o *.ko *.mod.* *.cmd .module* modules* Module* .*.cmd .tmp* |
Download debian iso
http://cdimage.debian.org/cdimage/release/current/mipsel/iso-cd/debian-9.1.0-mipsel-netinst.iso
Download initrd & vmlinux
/** | |
* g++ -std=c++14 quick_sort_mt.cpp -pthread && ./a.out 10000 1 1 | |
* | |
* | |
* This works: | |
* ./a.out 10000 1 1 | |
* | |
* This fails (unpredictably!): | |
* ./a.out 100000 1 1 | |
**/ |
# !/usr/bin/python | |
# -*- encoding: utf-8 -*- | |
import sys | |
dp = [] | |
for i in range(100): | |
dp.append(0) | |
dp[0] = 0 | |
dp[1] = 1 |
#include <linux/init.h> | |
#include <linux/module.h> | |
#include <linux/kernel.h> | |
#include <linux/list.h> | |
#include <linux/slab.h> | |
struct birthday { | |
int day; | |
int month; | |
int year; |