Nested anonymous randomization boundaries
This commit is contained in:
parent
0eba2ac3a1
commit
aae833788f
4
plan.txt
4
plan.txt
@ -1,5 +1,5 @@
|
|||||||
Collect alignment data on struct members
|
Collect alignment data from struct members
|
||||||
Fix bit fields and dynamic size fields (at end of structs) in place
|
Fix bit fields in place
|
||||||
|
|
||||||
Move patcher generation to pre-link stage
|
Move patcher generation to pre-link stage
|
||||||
- Aggregate meta data files
|
- Aggregate meta data files
|
||||||
|
|||||||
@ -10,9 +10,12 @@ 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(" pid (int) : %2llu -> %2llu\n", 0, offsetof(struct task_struct, pid));
|
printf(" stuck0 (int) : %2llu -> %2llu\n", 0, offsetof(struct task_struct, stuck0));
|
||||||
printf(" comm (const char*) : %2llu -> %2llu\n", 8, offsetof(struct task_struct, comm));
|
printf(" pid (int) : %2llu -> %2llu\n", 8, offsetof(struct task_struct, pid));
|
||||||
printf(" tasks (struct list_head) : %2llu -> %2llu\n", 16, offsetof(struct task_struct, tasks));
|
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)
|
int main(void)
|
||||||
|
|||||||
@ -5,6 +5,9 @@
|
|||||||
const typeof(((type*)0)->member)* __mptr = (ptr); \
|
const typeof(((type*)0)->member)* __mptr = (ptr); \
|
||||||
(type*)((char*)__mptr - offsetof(type, member)); })
|
(type*)((char*)__mptr - offsetof(type, member)); })
|
||||||
|
|
||||||
|
# define randomized_struct_fields_start struct {
|
||||||
|
# define randomized_struct_fields_end } __attribute__((spslr));
|
||||||
|
|
||||||
// Minimal doubly linked list
|
// Minimal doubly linked list
|
||||||
struct list_head {
|
struct list_head {
|
||||||
struct list_head *next, *prev;
|
struct list_head *next, *prev;
|
||||||
@ -42,8 +45,21 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head)
|
|||||||
|
|
||||||
// A small struct like the Linux kernel's task_struct
|
// A small struct like the Linux kernel's task_struct
|
||||||
struct task_struct {
|
struct task_struct {
|
||||||
|
int stuck0;
|
||||||
|
|
||||||
|
randomized_struct_fields_start
|
||||||
|
|
||||||
|
randomized_struct_fields_start
|
||||||
|
|
||||||
int pid;
|
int pid;
|
||||||
const char *comm;
|
const char *comm;
|
||||||
struct list_head tasks; // linkage for global task list
|
|
||||||
} __attribute__((spslr));
|
randomized_struct_fields_end
|
||||||
|
|
||||||
|
struct list_head tasks; // linkage for global task list
|
||||||
|
|
||||||
|
randomized_struct_fields_end
|
||||||
|
|
||||||
|
int stuck1, stuck2;
|
||||||
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user