	.file	"728034.c"
	.intel_syntax noprefix
	.text
	.data
	.align 32
	.type	id, @object
	.size	id, 57
id:
	.string	"@(#)$Id: t_exclopen.c,v 8.7 2013-11-22 20:52:01 ca Exp $"
	.local	Attacker
	.comm	Attacker,128,32
	.local	Attackee
	.comm	Attackee,128,32
	.text
	.type	bail, @function
bail:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 16
	mov	DWORD PTR -4[rbp], edi
	lea	rdi, Attacker[rip]
	call	unlink@PLT
	lea	rdi, Attackee[rip]
	call	unlink@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	exit@PLT
	.cfi_endproc
.LFE6:
	.size	bail, .-bail
	.section	.rodata
.LC0:
	.string	"/tmp/attacker.%d.%ld"
.LC1:
	.string	"/tmp/attackee.%d.%ld"
	.align 8
.LC2:
	.string	"Could not create %s->%s symlink: %d\n"
	.align 8
.LC3:
	.string	"%s already exists -- remove and try again.\n"
	.align 8
.LC4:
	.string	"Weird.  Open failed but %s was created anyhow (errno = %d)\n"
	.align 8
.LC5:
	.string	"Good show!  Exclusive open works properly with symbolic links (errno = %d).\n"
	.align 8
.LC6:
	.string	"Weird.  Open succeeded but %s was not created\n"
	.align 8
.LC7:
	.string	"Bad news: you can do an exclusive open through a symbolic link"
	.align 8
.LC8:
	.string	"\tBe sure you #define BOGUS_O_EXCL in conf.h"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	rbx
	sub	rsp, 200
	.cfi_offset 3, -24
	mov	DWORD PTR -196[rbp], edi
	mov	QWORD PTR -208[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -24[rbp], rax
	xor	eax, eax
	mov	edi, 0
	mov	eax, 0
	call	time@PLT
	mov	ebx, eax
	call	getpid@PLT
	mov	ecx, ebx
	mov	edx, eax
	lea	rsi, .LC0[rip]
	lea	rdi, Attacker[rip]
	mov	eax, 0
	call	sprintf@PLT
	mov	edi, 0
	mov	eax, 0
	call	time@PLT
	mov	ebx, eax
	call	getpid@PLT
	mov	ecx, ebx
	mov	edx, eax
	lea	rsi, .LC1[rip]
	lea	rdi, Attackee[rip]
	mov	eax, 0
	call	sprintf@PLT
	lea	rsi, Attacker[rip]
	lea	rdi, Attackee[rip]
	call	symlink@PLT
	test	eax, eax
	jns	.L3
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	ecx, eax
	lea	rdx, Attackee[rip]
	lea	rsi, Attacker[rip]
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	mov	eax, 0
	call	bail
.L3:
	lea	rdi, Attackee[rip]
	call	unlink@PLT
	lea	rax, -176[rbp]
	mov	rsi, rax
	lea	rdi, Attackee[rip]
	call	stat@PLT
	test	eax, eax
	js	.L4
	lea	rsi, Attackee[rip]
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	mov	eax, 0
	call	bail
.L4:
	mov	edx, 420
	mov	esi, 193
	lea	rdi, Attacker[rip]
	mov	eax, 0
	call	open@PLT
	test	eax, eax
	jns	.L5
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -180[rbp], eax
	lea	rax, -176[rbp]
	mov	rsi, rax
	lea	rdi, Attackee[rip]
	call	stat@PLT
	test	eax, eax
	js	.L6
	mov	eax, DWORD PTR -180[rbp]
	mov	edx, eax
	lea	rsi, Attackee[rip]
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	mov	eax, 0
	call	bail
.L6:
	mov	eax, DWORD PTR -180[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 0
	mov	eax, 0
	call	bail
.L5:
	lea	rax, -176[rbp]
	mov	rsi, rax
	lea	rdi, Attackee[rip]
	call	stat@PLT
	test	eax, eax
	jns	.L7
	lea	rsi, Attackee[rip]
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 2
	mov	eax, 0
	call	bail
.L7:
	lea	rdi, .LC7[rip]
	call	puts@PLT
	lea	rdi, .LC8[rip]
	call	puts@PLT
	mov	edi, 1
	mov	eax, 0
	call	bail
	mov	edi, 0
	call	exit@PLT
	.cfi_endproc
.LFE7:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 6
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"728034.c"
	.text
	.data
	.align	2
	.type	id, %object
	.size	id, 57
id:
	.ascii	"@(#)$Id: t_exclopen.c,v 8.7 2013-11-22 20:52:01 ca "
	.ascii	"Exp $\000"
	.local	Attacker
	.comm	Attacker,128,4
	.local	Attackee
	.comm	Attackee,128,4
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	bail, %function
bail:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	ldr	r0, .L2
	bl	unlink
	ldr	r0, .L2+4
	bl	unlink
	ldr	r0, [fp, #-8]
	bl	exit
.L3:
	.align	2
.L2:
	.word	Attacker
	.word	Attackee
	.size	bail, .-bail
	.section	.rodata
	.align	2
.LC0:
	.ascii	"/tmp/attacker.%d.%ld\000"
	.align	2
.LC1:
	.ascii	"/tmp/attackee.%d.%ld\000"
	.align	2
.LC2:
	.ascii	"Could not create %s->%s symlink: %d\012\000"
	.align	2
.LC3:
	.ascii	"%s already exists -- remove and try again.\012\000"
	.align	2
.LC4:
	.ascii	"Weird.  Open failed but %s was created anyhow (errn"
	.ascii	"o = %d)\012\000"
	.align	2
.LC5:
	.ascii	"Good show!  Exclusive open works properly with symb"
	.ascii	"olic links (errno = %d).\012\000"
	.align	2
.LC6:
	.ascii	"Weird.  Open succeeded but %s was not created\012\000"
	.align	2
.LC7:
	.ascii	"Bad news: you can do an exclusive open through a sy"
	.ascii	"mbolic link\000"
	.align	2
.LC8:
	.ascii	"\011Be sure you #define BOGUS_O_EXCL in conf.h\000"
	.align	2
.LC9:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 112
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #116
	str	r0, [fp, #-120]
	str	r1, [fp, #-124]
	ldr	r3, .L11
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	bl	getpid
	mov	r4, r0
	mov	r0, #0
	bl	time
	mov	r3, r0
	mov	r2, r4
	ldr	r1, .L11+4
	ldr	r0, .L11+8
	bl	sprintf
	bl	getpid
	mov	r4, r0
	mov	r0, #0
	bl	time
	mov	r3, r0
	mov	r2, r4
	ldr	r1, .L11+12
	ldr	r0, .L11+16
	bl	sprintf
	ldr	r1, .L11+8
	ldr	r0, .L11+16
	bl	symlink
	mov	r3, r0
	cmp	r3, #0
	bge	.L5
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	ldr	r2, .L11+16
	ldr	r1, .L11+8
	ldr	r0, .L11+20
	bl	printf
	mov	r0, #1
	bl	bail
.L5:
	ldr	r0, .L11+16
	bl	unlink
	sub	r3, fp, #108
	mov	r1, r3
	ldr	r0, .L11+16
	bl	stat
	mov	r3, r0
	cmp	r3, #0
	blt	.L6
	ldr	r1, .L11+16
	ldr	r0, .L11+24
	bl	printf
	mov	r0, #1
	bl	bail
.L6:
	mov	r2, #420
	mov	r1, #193
	ldr	r0, .L11+8
	bl	open
	mov	r3, r0
	cmp	r3, #0
	bge	.L7
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	str	r3, [fp, #-112]
	sub	r3, fp, #108
	mov	r1, r3
	ldr	r0, .L11+16
	bl	stat
	mov	r3, r0
	cmp	r3, #0
	blt	.L8
	ldr	r2, [fp, #-112]
	ldr	r1, .L11+16
	ldr	r0, .L11+28
	bl	printf
	mov	r0, #1
	bl	bail
.L8:
	ldr	r1, [fp, #-112]
	ldr	r0, .L11+32
	bl	printf
	mov	r0, #0
	bl	bail
.L7:
	sub	r3, fp, #108
	mov	r1, r3
	ldr	r0, .L11+16
	bl	stat
	mov	r3, r0
	cmp	r3, #0
	bge	.L9
	ldr	r1, .L11+16
	ldr	r0, .L11+36
	bl	printf
	mov	r0, #2
	bl	bail
.L9:
	ldr	r0, .L11+40
	bl	puts
	ldr	r0, .L11+44
	bl	puts
	mov	r0, #1
	bl	bail
	mov	r0, #0
	bl	exit
.L12:
	.align	2
.L11:
	.word	.LC9
	.word	.LC0
	.word	Attacker
	.word	.LC1
	.word	Attackee
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
