Made layout printing responsibility of subject
This commit is contained in:
parent
45481c8403
commit
db19da4a23
@ -2,7 +2,6 @@
|
||||
#include "spslr_program.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
static void seed_rand_time() {
|
||||
@ -352,12 +351,6 @@ int spslr_randomize(uint32_t target) {
|
||||
ff->offset = f->offset;
|
||||
}
|
||||
|
||||
printf("Randomization of target %u...\n", target);
|
||||
for (uint32_t i = 0; i < t->field_count; i++) {
|
||||
const struct FinalField* ff = &t->final_fields[i];
|
||||
printf(" Field %u: %u -> %u\n", i, ff->initial_offset, ff->offset);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -7,9 +7,18 @@ 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(" pid (int) : %2llu -> %2llu\n", 0, offsetof(struct task_struct, pid));
|
||||
printf(" comm (const char*) : %2llu -> %2llu\n", 8, offsetof(struct task_struct, comm));
|
||||
printf(" tasks (struct list_head) : %2llu -> %2llu\n", 16, offsetof(struct task_struct, tasks));
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
spslr_selfpatch();
|
||||
print_layout();
|
||||
|
||||
struct list_head task_list;
|
||||
INIT_LIST_HEAD(&task_list);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user