Skip to content

Instantly share code, notes, and snippets.

@Keno

Keno/Results (aarch64)

Last active May 25, 2020
Embed
What would you like to do?
Behavior of process_vm_* syscalls on various architectures
Size 2 copy at page_size - 1: 0
1 bytes less than could have been written
Size 3 copy at page_size - 1: 0
1 bytes less than could have been written
Size 4 copy at page_size - 1: 0
1 bytes less than could have been written
Size 5 copy at page_size - 1: 0
1 bytes less than could have been written
Size 6 copy at page_size - 1: 0
1 bytes less than could have been written
Size 7 copy at page_size - 1: 0
1 bytes less than could have been written
Size 8 copy at page_size - 1: 0
1 bytes less than could have been written
Size 3 copy at page_size - 2: 2
Size 4 copy at page_size - 2: 0
2 bytes less than could have been written
Size 5 copy at page_size - 2: 0
2 bytes less than could have been written
Size 6 copy at page_size - 2: 0
2 bytes less than could have been written
Size 7 copy at page_size - 2: 0
2 bytes less than could have been written
Size 8 copy at page_size - 2: 0
2 bytes less than could have been written
Size 9 copy at page_size - 2: 0
2 bytes less than could have been written
Size 4 copy at page_size - 3: 0
3 bytes less than could have been written
Size 5 copy at page_size - 3: 0
3 bytes less than could have been written
Size 6 copy at page_size - 3: 0
3 bytes less than could have been written
Size 7 copy at page_size - 3: 0
3 bytes less than could have been written
Size 8 copy at page_size - 3: 0
3 bytes less than could have been written
Size 9 copy at page_size - 3: 0
3 bytes less than could have been written
Size 10 copy at page_size - 3: 0
3 bytes less than could have been written
Size 5 copy at page_size - 4: 4
Size 6 copy at page_size - 4: 4
Size 7 copy at page_size - 4: 4
Size 8 copy at page_size - 4: 0
4 bytes less than could have been written
Size 9 copy at page_size - 4: 0
4 bytes less than could have been written
Size 10 copy at page_size - 4: 0
4 bytes less than could have been written
Size 11 copy at page_size - 4: 0
4 bytes less than could have been written
Size 6 copy at page_size - 5: 4
1 bytes less than could have been written
Size 7 copy at page_size - 5: 4
1 bytes less than could have been written
Size 8 copy at page_size - 5: 0
5 bytes less than could have been written
Size 9 copy at page_size - 5: 0
5 bytes less than could have been written
Size 10 copy at page_size - 5: 0
5 bytes less than could have been written
Size 11 copy at page_size - 5: 0
5 bytes less than could have been written
Size 12 copy at page_size - 5: 0
5 bytes less than could have been written
Size 7 copy at page_size - 6: 6
Size 8 copy at page_size - 6: 0
6 bytes less than could have been written
Size 9 copy at page_size - 6: 0
6 bytes less than could have been written
Size 10 copy at page_size - 6: 0
6 bytes less than could have been written
Size 11 copy at page_size - 6: 0
6 bytes less than could have been written
Size 12 copy at page_size - 6: 0
6 bytes less than could have been written
Size 13 copy at page_size - 6: 0
6 bytes less than could have been written
Size 8 copy at page_size - 7: 0
7 bytes less than could have been written
Size 9 copy at page_size - 7: 0
7 bytes less than could have been written
Size 10 copy at page_size - 7: 0
7 bytes less than could have been written
Size 11 copy at page_size - 7: 0
7 bytes less than could have been written
Size 12 copy at page_size - 7: 0
7 bytes less than could have been written
Size 13 copy at page_size - 7: 0
7 bytes less than could have been written
Size 14 copy at page_size - 7: 0
7 bytes less than could have been written
Size 9 copy at page_size - 8: 8
Size 10 copy at page_size - 8: 8
Size 11 copy at page_size - 8: 8
Size 12 copy at page_size - 8: 8
Size 13 copy at page_size - 8: 8
Size 14 copy at page_size - 8: 8
Size 15 copy at page_size - 8: 8
Size 10 copy at page_size - 9: 8
1 bytes less than could have been written
Size 11 copy at page_size - 9: 8
1 bytes less than could have been written
Size 12 copy at page_size - 9: 8
1 bytes less than could have been written
Size 13 copy at page_size - 9: 8
1 bytes less than could have been written
Size 14 copy at page_size - 9: 8
1 bytes less than could have been written
Size 15 copy at page_size - 9: 8
1 bytes less than could have been written
Size 16 copy at page_size - 9: 0
9 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 11 copy at page_size - 10: 10
Size 12 copy at page_size - 10: 8
2 bytes less than could have been written
Size 13 copy at page_size - 10: 8
2 bytes less than could have been written
Size 14 copy at page_size - 10: 8
2 bytes less than could have been written
Size 15 copy at page_size - 10: 8
2 bytes less than could have been written
Size 16 copy at page_size - 10: 0
10 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 17 copy at page_size - 10: 0
10 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 12 copy at page_size - 11: 8
3 bytes less than could have been written
Size 13 copy at page_size - 11: 8
3 bytes less than could have been written
Size 14 copy at page_size - 11: 8
3 bytes less than could have been written
Size 15 copy at page_size - 11: 8
3 bytes less than could have been written
Size 16 copy at page_size - 11: 0
11 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 17 copy at page_size - 11: 0
11 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 18 copy at page_size - 11: 0
11 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 13 copy at page_size - 12: 12
Size 14 copy at page_size - 12: 12
Size 15 copy at page_size - 12: 12
Size 16 copy at page_size - 12: 0
12 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 17 copy at page_size - 12: 0
12 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 18 copy at page_size - 12: 0
12 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 19 copy at page_size - 12: 0
12 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 14 copy at page_size - 13: 12
1 bytes less than could have been written
Size 15 copy at page_size - 13: 12
1 bytes less than could have been written
Size 16 copy at page_size - 13: 0
13 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 17 copy at page_size - 13: 0
13 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 18 copy at page_size - 13: 0
13 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 19 copy at page_size - 13: 0
13 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 20 copy at page_size - 13: 0
13 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 15 copy at page_size - 14: 14
Size 16 copy at page_size - 14: 0
14 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 17 copy at page_size - 14: 0
14 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 18 copy at page_size - 14: 0
14 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 19 copy at page_size - 14: 0
14 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 20 copy at page_size - 14: 0
14 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 21 copy at page_size - 14: 0
14 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 16 copy at page_size - 15: 0
15 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 17 copy at page_size - 15: 0
15 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 18 copy at page_size - 15: 0
15 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 19 copy at page_size - 15: 0
15 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 20 copy at page_size - 15: 0
15 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 21 copy at page_size - 15: 0
15 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 22 copy at page_size - 15: 0
15 bytes less than could have been written
8 bytes more were written than the syscall indicated
Size 17 copy at page_size - 16: 16
Size 18 copy at page_size - 16: 16
Size 19 copy at page_size - 16: 16
Size 20 copy at page_size - 16: 16
Size 21 copy at page_size - 16: 16
Size 22 copy at page_size - 16: 16
Size 23 copy at page_size - 16: 16
Size 18 copy at page_size - 17: 16
1 bytes less than could have been written
Size 19 copy at page_size - 17: 16
1 bytes less than could have been written
Size 20 copy at page_size - 17: 16
1 bytes less than could have been written
Size 21 copy at page_size - 17: 16
1 bytes less than could have been written
Size 22 copy at page_size - 17: 16
1 bytes less than could have been written
Size 23 copy at page_size - 17: 16
1 bytes less than could have been written
Size 24 copy at page_size - 17: 16
1 bytes less than could have been written
Size 19 copy at page_size - 18: 18
Size 20 copy at page_size - 18: 16
2 bytes less than could have been written
Size 21 copy at page_size - 18: 16
2 bytes less than could have been written
Size 22 copy at page_size - 18: 16
2 bytes less than could have been written
Size 23 copy at page_size - 18: 16
2 bytes less than could have been written
Size 24 copy at page_size - 18: 16
2 bytes less than could have been written
Size 25 copy at page_size - 18: 16
2 bytes less than could have been written
Size 20 copy at page_size - 19: 16
3 bytes less than could have been written
Size 21 copy at page_size - 19: 16
3 bytes less than could have been written
Size 22 copy at page_size - 19: 16
3 bytes less than could have been written
Size 23 copy at page_size - 19: 16
3 bytes less than could have been written
Size 24 copy at page_size - 19: 16
3 bytes less than could have been written
Size 25 copy at page_size - 19: 16
3 bytes less than could have been written
Size 26 copy at page_size - 19: 16
3 bytes less than could have been written
Size 2 copy at page_size - 1: 0
1 bytes less than could have been written
Size 3 copy at page_size - 1: 0
1 bytes less than could have been written
Size 4 copy at page_size - 1: 0
1 bytes less than could have been written
Size 5 copy at page_size - 1: 0
1 bytes less than could have been written
Size 6 copy at page_size - 1: 0
1 bytes less than could have been written
Size 7 copy at page_size - 1: 0
1 bytes less than could have been written
Size 8 copy at page_size - 1: 0
1 bytes less than could have been written
Size 3 copy at page_size - 2: 2
Size 4 copy at page_size - 2: 0
2 bytes less than could have been written
Size 5 copy at page_size - 2: 0
2 bytes less than could have been written
Size 6 copy at page_size - 2: 0
2 bytes less than could have been written
Size 7 copy at page_size - 2: 0
2 bytes less than could have been written
Size 8 copy at page_size - 2: 0
2 bytes less than could have been written
Size 9 copy at page_size - 2: 0
2 bytes less than could have been written
Size 4 copy at page_size - 3: 0
3 bytes less than could have been written
Size 5 copy at page_size - 3: 0
3 bytes less than could have been written
Size 6 copy at page_size - 3: 0
3 bytes less than could have been written
Size 7 copy at page_size - 3: 0
3 bytes less than could have been written
Size 8 copy at page_size - 3: 0
3 bytes less than could have been written
Size 9 copy at page_size - 3: 0
3 bytes less than could have been written
Size 10 copy at page_size - 3: 0
3 bytes less than could have been written
Size 5 copy at page_size - 4: 4
Size 6 copy at page_size - 4: 4
Size 7 copy at page_size - 4: 4
Size 8 copy at page_size - 4: 4
Size 9 copy at page_size - 4: 4
Size 10 copy at page_size - 4: 4
Size 11 copy at page_size - 4: 4
Size 6 copy at page_size - 5: 4
1 bytes less than could have been written
Size 7 copy at page_size - 5: 4
1 bytes less than could have been written
Size 8 copy at page_size - 5: 4
1 bytes less than could have been written
Size 9 copy at page_size - 5: 4
1 bytes less than could have been written
Size 10 copy at page_size - 5: 4
1 bytes less than could have been written
Size 11 copy at page_size - 5: 4
1 bytes less than could have been written
Size 12 copy at page_size - 5: 4
1 bytes less than could have been written
Size 7 copy at page_size - 6: 6
Size 8 copy at page_size - 6: 4
2 bytes less than could have been written
Size 9 copy at page_size - 6: 4
2 bytes less than could have been written
Size 10 copy at page_size - 6: 4
2 bytes less than could have been written
Size 11 copy at page_size - 6: 4
2 bytes less than could have been written
Size 12 copy at page_size - 6: 4
2 bytes less than could have been written
Size 13 copy at page_size - 6: 4
2 bytes less than could have been written
Size 8 copy at page_size - 7: 4
3 bytes less than could have been written
Size 9 copy at page_size - 7: 4
3 bytes less than could have been written
Size 10 copy at page_size - 7: 4
3 bytes less than could have been written
Size 11 copy at page_size - 7: 4
3 bytes less than could have been written
Size 12 copy at page_size - 7: 4
3 bytes less than could have been written
Size 13 copy at page_size - 7: 4
3 bytes less than could have been written
Size 14 copy at page_size - 7: 4
3 bytes less than could have been written
Size 9 copy at page_size - 8: 8
Size 10 copy at page_size - 8: 8
Size 11 copy at page_size - 8: 8
Size 12 copy at page_size - 8: 8
Size 13 copy at page_size - 8: 8
Size 14 copy at page_size - 8: 8
Size 15 copy at page_size - 8: 8
Size 10 copy at page_size - 9: 8
1 bytes less than could have been written
Size 11 copy at page_size - 9: 8
1 bytes less than could have been written
Size 12 copy at page_size - 9: 8
1 bytes less than could have been written
Size 13 copy at page_size - 9: 8
1 bytes less than could have been written
Size 14 copy at page_size - 9: 8
1 bytes less than could have been written
Size 15 copy at page_size - 9: 8
1 bytes less than could have been written
Size 16 copy at page_size - 9: 9
Size 11 copy at page_size - 10: 10
Size 12 copy at page_size - 10: 8
2 bytes less than could have been written
Size 13 copy at page_size - 10: 8
2 bytes less than could have been written
Size 14 copy at page_size - 10: 8
2 bytes less than could have been written
Size 15 copy at page_size - 10: 8
2 bytes less than could have been written
Size 16 copy at page_size - 10: 10
Size 17 copy at page_size - 10: 10
Size 12 copy at page_size - 11: 8
3 bytes less than could have been written
Size 13 copy at page_size - 11: 8
3 bytes less than could have been written
Size 14 copy at page_size - 11: 8
3 bytes less than could have been written
Size 15 copy at page_size - 11: 8
3 bytes less than could have been written
Size 16 copy at page_size - 11: 11
Size 17 copy at page_size - 11: 11
Size 18 copy at page_size - 11: 11
Size 13 copy at page_size - 12: 12
Size 14 copy at page_size - 12: 12
Size 15 copy at page_size - 12: 12
Size 16 copy at page_size - 12: 12
Size 17 copy at page_size - 12: 12
Size 18 copy at page_size - 12: 12
Size 19 copy at page_size - 12: 12
Size 14 copy at page_size - 13: 12
1 bytes less than could have been written
Size 15 copy at page_size - 13: 12
1 bytes less than could have been written
Size 16 copy at page_size - 13: 13
Size 17 copy at page_size - 13: 13
Size 18 copy at page_size - 13: 13
Size 19 copy at page_size - 13: 13
Size 20 copy at page_size - 13: 13
Size 15 copy at page_size - 14: 14
Size 16 copy at page_size - 14: 14
Size 17 copy at page_size - 14: 14
Size 18 copy at page_size - 14: 14
Size 19 copy at page_size - 14: 14
Size 20 copy at page_size - 14: 14
Size 21 copy at page_size - 14: 14
Size 16 copy at page_size - 15: 15
Size 17 copy at page_size - 15: 15
Size 18 copy at page_size - 15: 15
Size 19 copy at page_size - 15: 15
Size 20 copy at page_size - 15: 15
Size 21 copy at page_size - 15: 15
Size 22 copy at page_size - 15: 15
Size 17 copy at page_size - 16: 16
Size 18 copy at page_size - 16: 16
Size 19 copy at page_size - 16: 16
Size 20 copy at page_size - 16: 16
Size 21 copy at page_size - 16: 16
Size 22 copy at page_size - 16: 16
Size 23 copy at page_size - 16: 16
Size 18 copy at page_size - 17: 17
Size 19 copy at page_size - 17: 17
Size 20 copy at page_size - 17: 17
Size 21 copy at page_size - 17: 17
Size 22 copy at page_size - 17: 17
Size 23 copy at page_size - 17: 17
Size 24 copy at page_size - 17: 17
Size 19 copy at page_size - 18: 18
Size 20 copy at page_size - 18: 18
Size 21 copy at page_size - 18: 18
Size 22 copy at page_size - 18: 18
Size 23 copy at page_size - 18: 18
Size 24 copy at page_size - 18: 18
Size 25 copy at page_size - 18: 18
Size 20 copy at page_size - 19: 19
Size 21 copy at page_size - 19: 19
Size 22 copy at page_size - 19: 19
Size 23 copy at page_size - 19: 19
Size 24 copy at page_size - 19: 19
Size 25 copy at page_size - 19: 19
Size 26 copy at page_size - 19: 19
Size 2 copy at page_size - 1: 1
Size 3 copy at page_size - 1: 1
Size 4 copy at page_size - 1: 1
Size 5 copy at page_size - 1: 1
Size 6 copy at page_size - 1: 1
Size 7 copy at page_size - 1: 1
Size 8 copy at page_size - 1: 1
Size 3 copy at page_size - 2: 2
Size 4 copy at page_size - 2: 2
Size 5 copy at page_size - 2: 2
Size 6 copy at page_size - 2: 2
Size 7 copy at page_size - 2: 2
Size 8 copy at page_size - 2: 2
Size 9 copy at page_size - 2: 2
Size 4 copy at page_size - 3: 3
Size 5 copy at page_size - 3: 3
Size 6 copy at page_size - 3: 3
Size 7 copy at page_size - 3: 3
Size 8 copy at page_size - 3: 3
Size 9 copy at page_size - 3: 3
Size 10 copy at page_size - 3: 3
Size 5 copy at page_size - 4: 4
Size 6 copy at page_size - 4: 4
Size 7 copy at page_size - 4: 4
Size 8 copy at page_size - 4: 4
Size 9 copy at page_size - 4: 4
Size 10 copy at page_size - 4: 4
Size 11 copy at page_size - 4: 4
Size 6 copy at page_size - 5: 5
Size 7 copy at page_size - 5: 5
Size 8 copy at page_size - 5: 5
Size 9 copy at page_size - 5: 5
Size 10 copy at page_size - 5: 5
Size 11 copy at page_size - 5: 5
Size 12 copy at page_size - 5: 5
Size 7 copy at page_size - 6: 6
Size 8 copy at page_size - 6: 6
Size 9 copy at page_size - 6: 6
Size 10 copy at page_size - 6: 6
Size 11 copy at page_size - 6: 6
Size 12 copy at page_size - 6: 6
Size 13 copy at page_size - 6: 6
Size 8 copy at page_size - 7: 7
Size 9 copy at page_size - 7: 7
Size 10 copy at page_size - 7: 7
Size 11 copy at page_size - 7: 7
Size 12 copy at page_size - 7: 7
Size 13 copy at page_size - 7: 7
Size 14 copy at page_size - 7: 7
Size 9 copy at page_size - 8: 8
Size 10 copy at page_size - 8: 8
Size 11 copy at page_size - 8: 8
Size 12 copy at page_size - 8: 8
Size 13 copy at page_size - 8: 8
Size 14 copy at page_size - 8: 8
Size 15 copy at page_size - 8: 8
Size 10 copy at page_size - 9: 9
Size 11 copy at page_size - 9: 9
Size 12 copy at page_size - 9: 9
Size 13 copy at page_size - 9: 9
Size 14 copy at page_size - 9: 9
Size 15 copy at page_size - 9: 9
Size 16 copy at page_size - 9: 9
Size 11 copy at page_size - 10: 10
Size 12 copy at page_size - 10: 10
Size 13 copy at page_size - 10: 10
Size 14 copy at page_size - 10: 10
Size 15 copy at page_size - 10: 10
Size 16 copy at page_size - 10: 10
Size 17 copy at page_size - 10: 10
Size 12 copy at page_size - 11: 11
Size 13 copy at page_size - 11: 11
Size 14 copy at page_size - 11: 11
Size 15 copy at page_size - 11: 11
Size 16 copy at page_size - 11: 11
Size 17 copy at page_size - 11: 11
Size 18 copy at page_size - 11: 11
Size 13 copy at page_size - 12: 12
Size 14 copy at page_size - 12: 12
Size 15 copy at page_size - 12: 12
Size 16 copy at page_size - 12: 12
Size 17 copy at page_size - 12: 12
Size 18 copy at page_size - 12: 12
Size 19 copy at page_size - 12: 12
Size 14 copy at page_size - 13: 13
Size 15 copy at page_size - 13: 13
Size 16 copy at page_size - 13: 13
Size 17 copy at page_size - 13: 13
Size 18 copy at page_size - 13: 13
Size 19 copy at page_size - 13: 13
Size 20 copy at page_size - 13: 13
Size 15 copy at page_size - 14: 14
Size 16 copy at page_size - 14: 14
Size 17 copy at page_size - 14: 14
Size 18 copy at page_size - 14: 14
Size 19 copy at page_size - 14: 14
Size 20 copy at page_size - 14: 14
Size 21 copy at page_size - 14: 14
Size 16 copy at page_size - 15: 15
Size 17 copy at page_size - 15: 15
Size 18 copy at page_size - 15: 15
Size 19 copy at page_size - 15: 15
Size 20 copy at page_size - 15: 15
Size 21 copy at page_size - 15: 15
Size 22 copy at page_size - 15: 15
Size 17 copy at page_size - 16: 16
Size 18 copy at page_size - 16: 16
Size 19 copy at page_size - 16: 16
Size 20 copy at page_size - 16: 16
Size 21 copy at page_size - 16: 16
Size 22 copy at page_size - 16: 16
Size 23 copy at page_size - 16: 16
Size 18 copy at page_size - 17: 17
Size 19 copy at page_size - 17: 17
Size 20 copy at page_size - 17: 17
Size 21 copy at page_size - 17: 17
Size 22 copy at page_size - 17: 17
Size 23 copy at page_size - 17: 17
Size 24 copy at page_size - 17: 17
Size 19 copy at page_size - 18: 18
Size 20 copy at page_size - 18: 18
Size 21 copy at page_size - 18: 18
Size 22 copy at page_size - 18: 18
Size 23 copy at page_size - 18: 18
Size 24 copy at page_size - 18: 18
Size 25 copy at page_size - 18: 18
Size 20 copy at page_size - 19: 19
Size 21 copy at page_size - 19: 19
Size 22 copy at page_size - 19: 19
Size 23 copy at page_size - 19: 19
Size 24 copy at page_size - 19: 19
Size 25 copy at page_size - 19: 19
Size 26 copy at page_size - 19: 19
#define _GNU_SOURCE
#include <assert.h>
#include <stdio.h>
#include <sys/mman.h>
#include <sys/uio.h>
#include <unistd.h>
#include <string.h>
#include <stdint.h>
int main(void) {
size_t page_size = sysconf(_SC_PAGESIZE);
void* p = mmap(NULL, page_size, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
size_t first_half_size = page_size / 2;
assert(p != MAP_FAILED);
struct iovec in_iov[2];
struct iovec out_iov[2];
out_iov[0].iov_base = in_iov[0].iov_base = in_iov[1].iov_base = p;
out_iov[0].iov_len = in_iov[0].iov_len = 1;
for (int i = 1; i < 20; ++i) {
for (int j = 1; j < 8; ++j) {
// initialize the page
memset(p, 0x11, first_half_size);
memset(p+first_half_size, 0x22, page_size-first_half_size);
int len = i+j;
in_iov[1].iov_len = len;
out_iov[1].iov_len = len;
out_iov[1].iov_base = p + page_size - i;
int nbytes = process_vm_readv(getpid(), out_iov, 2, in_iov, 2, 0)-1;
// Check what actually happened
int correct = 1;
int more = 0;
int torn = 0;
for (int k = 0; k < i; ++k) {
uint8_t *ptr = p + page_size - i + k;
if (k < nbytes) {
if (*ptr != 0x11)
correct = 0;
} else {
if (*ptr == 0x22)
;
else if (*ptr == 0x11)
++more;
else
torn = 1;
}
}
printf("Size %d copy at page_size - %d: %d\n", len, i, nbytes);
if (nbytes < i) {
printf("\t%d bytes less than could have been written\n", i-nbytes);
}
if (more) {
printf("\t%d bytes more were written than the syscall indicated\n", more);
}
if (torn) {
printf("\tThe kernel did something strange\n");
}
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.