clarify the purpose of this project
[nyanglibc.git] / elf / enbl-secure.s
blob445f0d8f07d3bf044771d77135933bf488a53dcd
1 .text
2 .p2align 4,,15
3 .globl __libc_init_secure
4 .hidden __libc_init_secure
5 .type __libc_init_secure, @function
6 __libc_init_secure:
7 movl __libc_enable_secure_decided(%rip), %eax
8 testl %eax, %eax
9 je .L10
10 rep ret
11 .p2align 4,,10
12 .p2align 3
13 .L10:
14 pushq %rbx
15 call __geteuid
16 movl %eax, %ebx
17 call __getuid
18 cmpl %ebx, %eax
19 movl $1, %edx
20 je .L11
21 .L3:
22 movl %edx, __libc_enable_secure(%rip)
23 popq %rbx
24 ret
25 .p2align 4,,10
26 .p2align 3
27 .L11:
28 call __getegid
29 movl %eax, %ebx
30 call __getgid
31 xorl %edx, %edx
32 cmpl %ebx, %eax
33 setne %dl
34 jmp .L3
35 .size __libc_init_secure, .-__libc_init_secure
36 .hidden __libc_enable_secure_decided
37 .comm __libc_enable_secure_decided,4,4
38 .hidden __libc_enable_secure
39 .globl __libc_enable_secure
40 .section .data.rel.ro,"aw",@progbits
41 .align 4
42 .type __libc_enable_secure, @object
43 .size __libc_enable_secure, 4
44 __libc_enable_secure:
45 .long 1
46 .hidden __getgid
47 .hidden __getegid
48 .hidden __getuid
49 .hidden __geteuid