Created
March 20, 2019 19:30
-
-
Save lattera/e639ef8160a86ab8fd50b03bae516d9c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
int | |
main(int argc, char *argv[]) | |
{ | |
while (printf("%d\n", getpid())) | |
sleep(15); | |
return (1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./pid: file format ELF64-x86-64 | |
Disassembly of section .text: | |
0000000000001300 register_classes: | |
0000000000001330 main: | |
1330: 55 pushq %rbp | |
1331: 48 89 e5 movq %rsp, %rbp | |
1334: 48 83 ec 20 subq $32, %rsp | |
1338: c7 45 fc 00 00 00 00 movl $0, -4(%rbp) | |
133f: 89 7d f8 movl %edi, -8(%rbp) | |
1342: 48 89 75 f0 movq %rsi, -16(%rbp) | |
1346: e8 f5 00 00 00 callq 245 <getpid@plt> | |
134b: 48 8d 3d 36 f3 ff ff leaq -3274(%rip), %rdi | |
1352: 89 c6 movl %eax, %esi | |
1354: b0 00 movb $0, %al | |
1356: e8 f5 00 00 00 callq 245 <printf@plt> | |
135b: 83 f8 00 cmpl $0, %eax | |
135e: 0f 84 12 00 00 00 je 18 <main+0x46> | |
1364: bf 0f 00 00 00 movl $15, %edi | |
1369: e8 f2 00 00 00 callq 242 <sleep@plt> | |
136e: 89 45 ec movl %eax, -20(%rbp) | |
1371: e9 d0 ff ff ff jmp -48 <main+0x16> | |
1376: b8 01 00 00 00 movl $1, %eax | |
137b: 48 83 c4 20 addq $32, %rsp | |
137f: 5d popq %rbp | |
1380: c3 retq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
__attribute__((speculative_load_hardening)) int | |
main(int argc, char *argv[]) | |
{ | |
while (printf("%d\n", getpid())) | |
sleep(15); | |
return (1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./pid_hardened: file format ELF64-x86-64 | |
Disassembly of section .text: | |
0000000000001300 register_classes: | |
0000000000001330 main: | |
1330: 55 pushq %rbp | |
1331: 48 89 e5 movq %rsp, %rbp | |
1334: 48 83 ec 50 subq $80, %rsp | |
1338: 48 c7 c0 ff ff ff ff movq $-1, %rax | |
133f: 48 89 e1 movq %rsp, %rcx | |
1342: 48 c1 f9 3f sarq $63, %rcx | |
1346: c7 45 fc 00 00 00 00 movl $0, -4(%rbp) | |
134d: 89 7d f8 movl %edi, -8(%rbp) | |
1350: 48 89 75 f0 movq %rsi, -16(%rbp) | |
1354: 48 89 45 e8 movq %rax, -24(%rbp) | |
1358: 48 89 4d e0 movq %rcx, -32(%rbp) | |
135c: 48 8b 45 e0 movq -32(%rbp), %rax | |
1360: 48 c1 e0 2f shlq $47, %rax | |
1364: 48 09 c4 orq %rax, %rsp | |
1367: e8 94 01 00 00 callq 404 <getpid@plt> | |
136c: 48 8b 4c 24 f8 movq -8(%rsp), %rcx | |
1371: 48 89 e2 movq %rsp, %rdx | |
1374: 48 c1 fa 3f sarq $63, %rdx | |
1378: 48 8d 35 ed ff ff ff leaq -19(%rip), %rsi | |
137f: 48 39 f1 cmpq %rsi, %rcx | |
1382: 48 8b 4d e8 movq -24(%rbp), %rcx | |
1386: 48 0f 45 d1 cmovneq %rcx, %rdx | |
138a: 48 8d 3d f7 f2 ff ff leaq -3337(%rip), %rdi | |
1391: 89 c6 movl %eax, %esi | |
1393: b0 00 movb $0, %al | |
1395: 48 c1 e2 2f shlq $47, %rdx | |
1399: 48 09 d4 orq %rdx, %rsp | |
139c: e8 6f 01 00 00 callq 367 <printf@plt> | |
13a1: 48 8b 4c 24 f8 movq -8(%rsp), %rcx | |
13a6: 48 89 e2 movq %rsp, %rdx | |
13a9: 48 c1 fa 3f sarq $63, %rdx | |
13ad: 48 8d 3d ed ff ff ff leaq -19(%rip), %rdi | |
13b4: 48 39 f9 cmpq %rdi, %rcx | |
13b7: 48 8b 4d e8 movq -24(%rbp), %rcx | |
13bb: 48 0f 45 d1 cmovneq %rcx, %rdx | |
13bf: 83 f8 00 cmpl $0, %eax | |
13c2: 48 89 55 d8 movq %rdx, -40(%rbp) | |
13c6: 0f 84 56 00 00 00 je 86 <main+0xf2> | |
13cc: 48 8b 45 d8 movq -40(%rbp), %rax | |
13d0: 48 8b 4d e8 movq -24(%rbp), %rcx | |
13d4: 48 0f 44 c1 cmoveq %rcx, %rax | |
13d8: bf 0f 00 00 00 movl $15, %edi | |
13dd: 48 89 c2 movq %rax, %rdx | |
13e0: 48 c1 e2 2f shlq $47, %rdx | |
13e4: 48 09 d4 orq %rdx, %rsp | |
13e7: 48 89 45 d0 movq %rax, -48(%rbp) | |
13eb: e8 30 01 00 00 callq 304 <sleep@plt> | |
13f0: 48 8b 4c 24 f8 movq -8(%rsp), %rcx | |
13f5: 48 89 e2 movq %rsp, %rdx | |
13f8: 48 c1 fa 3f sarq $63, %rdx | |
13fc: 48 8d 35 ed ff ff ff leaq -19(%rip), %rsi | |
1403: 48 39 f1 cmpq %rsi, %rcx | |
1406: 48 8b 4d e8 movq -24(%rbp), %rcx | |
140a: 48 0f 45 d1 cmovneq %rcx, %rdx | |
140e: 48 8b 75 d0 movq -48(%rbp), %rsi | |
1412: 48 89 55 c8 movq %rdx, -56(%rbp) | |
1416: 89 45 c4 movl %eax, -60(%rbp) | |
1419: 48 89 75 e0 movq %rsi, -32(%rbp) | |
141d: e9 3a ff ff ff jmp -198 <main+0x2c> | |
1422: 48 8b 45 d8 movq -40(%rbp), %rax | |
1426: 48 8b 4d e8 movq -24(%rbp), %rcx | |
142a: 48 0f 45 c1 cmovneq %rcx, %rax | |
142e: ba 01 00 00 00 movl $1, %edx | |
1433: 48 89 45 b8 movq %rax, -72(%rbp) | |
1437: 89 d0 movl %edx, %eax | |
1439: 48 8b 75 b8 movq -72(%rbp), %rsi | |
143d: 48 c1 e6 2f shlq $47, %rsi | |
1441: 48 09 f4 orq %rsi, %rsp | |
1444: 48 83 c4 50 addq $80, %rsp | |
1448: 5d popq %rbp | |
1449: c3 retq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment