Minor subject updates

This commit is contained in:
York Jasper Niebuhr 2026-04-03 23:37:45 +02:00
parent aae833788f
commit affe371084
2 changed files with 13 additions and 11 deletions

View File

@ -1,3 +1,4 @@
Nested data pins have to work
Collect alignment data from struct members Collect alignment data from struct members
Fix bit fields in place Fix bit fields in place

View File

@ -8,20 +8,20 @@ int third_pid();
struct task_struct global = { .pid = 42, .comm = "main_global" }; struct task_struct global = { .pid = 42, .comm = "main_global" };
static void print_layout() { static void print_layout() {
// TODO -> Make builtin __spslr_initial_offsetof(type, field) that is not patched // TODO -> Make builtin __spslr_initial_offsetof(type, field) that is not patched
printf("Current task_struct layout:\n"); printf("Current task_struct layout:\n");
printf(" stuck0 (int) : %2llu -> %2llu\n", 0, offsetof(struct task_struct, stuck0)); 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(" 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(" 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(" 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(" stuck1 (int) : %2llu -> %2llu\n", 40, offsetof(struct task_struct, stuck1));
printf(" stuck2 (int) : %2llu -> %2llu\n", 44, offsetof(struct task_struct, stuck2)); printf(" stuck2 (int) : %2llu -> %2llu\n", 44, offsetof(struct task_struct, stuck2));
} }
int main(void) int main(void)
{ {
spslr_selfpatch(); spslr_selfpatch();
print_layout(); print_layout();
struct list_head task_list; struct list_head task_list;
INIT_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); 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(); return second_pid() * third_pid();
} }