diff --git a/plan.txt b/plan.txt index 6f881ee..8338846 100644 --- a/plan.txt +++ b/plan.txt @@ -1,3 +1,4 @@ +Nested data pins have to work Collect alignment data from struct members Fix bit fields in place diff --git a/subject/main.c b/subject/main.c index b8a42dc..abfc7d6 100644 --- a/subject/main.c +++ b/subject/main.c @@ -8,20 +8,20 @@ int third_pid(); struct task_struct global = { .pid = 42, .comm = "main_global" }; static void print_layout() { - // TODO -> Make builtin __spslr_initial_offsetof(type, field) that is not patched - printf("Current task_struct layout:\n"); - printf(" stuck0 (int) : %2llu -> %2llu\n", 0, offsetof(struct task_struct, stuck0)); - printf(" pid (int) : %2llu -> %2llu\n", 8, offsetof(struct task_struct, pid)); - printf(" comm (const char*) : %2llu -> %2llu\n", 16, offsetof(struct task_struct, comm)); - printf(" tasks (struct list_head) : %2llu -> %2llu\n", 24, offsetof(struct task_struct, tasks)); - printf(" stuck1 (int) : %2llu -> %2llu\n", 40, offsetof(struct task_struct, stuck1)); - printf(" stuck2 (int) : %2llu -> %2llu\n", 44, offsetof(struct task_struct, stuck2)); + // TODO -> Make builtin __spslr_initial_offsetof(type, field) that is not patched + printf("Current task_struct layout:\n"); + printf(" stuck0 (int) : %2llu -> %2llu\n", 0, offsetof(struct task_struct, stuck0)); + printf(" pid (int) : %2llu -> %2llu\n", 8, offsetof(struct task_struct, pid)); + printf(" comm (const char*) : %2llu -> %2llu\n", 16, offsetof(struct task_struct, comm)); + printf(" tasks (struct list_head) : %2llu -> %2llu\n", 24, offsetof(struct task_struct, tasks)); + printf(" stuck1 (int) : %2llu -> %2llu\n", 40, offsetof(struct task_struct, stuck1)); + printf(" stuck2 (int) : %2llu -> %2llu\n", 44, offsetof(struct task_struct, stuck2)); } int main(void) { - spslr_selfpatch(); - print_layout(); + spslr_selfpatch(); + print_layout(); struct list_head task_list; INIT_LIST_HEAD(&task_list); @@ -46,7 +46,8 @@ int main(void) printf(" pid=%d, comm=%s\n", task->pid, task->comm); } - size_t myOffset = ((size_t)&((struct task_struct*)0)->tasks); // BROKEN, relevancy for kernel unknown + size_t myOffset = ((size_t)&((struct task_struct*)0)->tasks); + printf("DIY offsetof(task_struct, tasks) yiels %2llu\n", myOffset); return second_pid() * third_pid(); }