Skip to content

Commit

Permalink
Change test files for Fortify
Browse files Browse the repository at this point in the history
  • Loading branch information
teoberi committed May 13, 2024
1 parent fffec3a commit 042ea07
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 30 deletions.
2 changes: 2 additions & 0 deletions tests/binaries/helloworld.c → tests/binaries/fszero.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#include <stdio.h>
#include <unistd.h>

int main()
{
printf("Hello World\n");
sleep(2);
return 0;
}
18 changes: 0 additions & 18 deletions tests/binaries/hello.S

This file was deleted.

7 changes: 0 additions & 7 deletions tests/binaries/main.c

This file was deleted.

23 changes: 23 additions & 0 deletions tests/binaries/nolibc.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
section .data
msg db 'Hello, World!', 0ah ;note the newline (Line Feed-LF) at the end (hex:0ah; decimal:10)
len equ $ - msg ;calculate the length of the message
delay dq 2, 100000000 ;define delay with Timespec structure members tv_sec, tv_nsec (qwords, 64-bit integer values)

section .text
global _start ;must be declared for linker (ld)

_start: ;tells linker entry point
mov rax, 1 ;system call for write (sys_write 1)
mov rdi, 1 ;file descriptor (1 is stdout)
mov rsi, msg ;address of string to output
mov rdx, len ;message length
syscall ;invoke operating system to do the write

mov rax, 35 ;system call for nanosleep (sys_nanosleep 35)
mov rdi, delay ;load the pointer to our delay
mov rsi, 0 ;exit code 0
syscall ;invoke operating system to do the delay

mov rax, 60 ;system call for exit (sys_exit 60)
xor rdi, rdi ;exit code 0
syscall ;invoke operating system to exit
23 changes: 23 additions & 0 deletions tests/binaries/nolibc32.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
section .data
msg db "Hello, world!", 0xa ;note the newline (Line Feed-LF) at the end (hex:0ah; decimal:10)
len equ $ - msg ;calculate the length of the message
delay dd 2, 100000000 ;define delay with Timespec structure members tv_sec, tv_nsec (dwords, 32-bit integer values)

section .text
global _start ;must be declared for linker (ld)

_start: ;tells linker entry point
mov eax,4 ;system call for write (sys_write 4)
mov ebx,1 ;file descriptor (1 is stdout)
mov ecx,msg ;address of string to output
mov edx,len ;message length
int 0x80 ;invoke operating system to do the write

mov eax, 162 ;system call for nanosleep (sys_nanosleep 162)
mov ebx, delay ;load the pointer to our delay
mov ecx, 0 ;exit code 0
int 0x80 ;invoke operating system to do the delay

mov eax,1 ;system call for exit (sys_exit 1)
xor ebx, ebx ;exit code 0
int 0x80 ;invoke operating system to exit
5 changes: 0 additions & 5 deletions tests/binaries/start.S

This file was deleted.

0 comments on commit 042ea07

Please sign in to comment.