layout: post title: "Software Security Notes 1 (Intro, Compilation)" date: 2021-2-23 07:00:00 +0800
<br />
<br />
program -> machine code
security gap
what high level program does VS what it really does
Focus on Linux binary (ELF) and x86 assembly.
Analysing without running it.
platform independent
Less precise. Generally udecidable.
Runs the binary as it executes
More precise. Access to entire system states
May miss some code. See particular runs. Not all possible.
No symbolic information
No type information
No high-level abstraction
Mixed code and data
Location dependent data and code
Representation in-memory may differ from on-disk representation
Setting up a new process, virtual address space.
Maps an interpreter into virtual memory
Transfer control to interpreter
In Linux, interpreter is a shared library called Id-linux.so
Loads binary into virtual address space.
Maps required dynamic libraried into virtual address space
Relocation if required
<br />
<br />
normal code -> machine code
GCC does all by default, but any of the steps can be stopped.
Input preprocessed source files
Output Assembly files
normal code -> assembly
Optimization
-S flag to stop after compiler
Default is AT&T syntax, use -masm=intel to change to Intel syntax
e.g. gcc -S -masm=Intel example.c