EC521 Lec13 (Software Security)

0.0(0)
studied byStudied by 6 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/18

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

19 Terms

1
New cards

In what form do most files come in

binary files

2
New cards

What happens when developers write code

The code compiler converts them into binary code that the CPU later executes

3
New cards

What are the stages of compilation

  1. Your file is created

  2. Preprocessor deals with #includes and macros

  3. compiler deals with optimizations and makes assembly code

  4. assembler takes assembly code and produces object file (machine code that can be directly executed by CPU)

  5. linker produces executable for cpu and merges together all your source files into single executable

4
New cards

What is Assembly

A low level language that maps the operations performed by the CPU

One ___ instruction = one CPU instruction

5
New cards

How are Assembly instructions identified

They are identified by mnemonics (what the instruction does) followed by a variable number of arguments

6
New cards

How many syntaxes can you see with Assembly

  1. Intel — <mnemonic> <dst>,<src>

  2. AT&T — <mnemonic><src>,<dst>

7
New cards

What size are the registers of an x86 32bit CPU

32bits

8
New cards

How many general purpose registers are in a x86 CPU and what do they do?

4 Registers and they store data/operands/pointers

eax, ebx, ecx, edx

Assembly instructions can access smaller portions of these registers for backwards compatibility

9
New cards

What are the special registers in a CPU

  1. PC (Program Counter) → contains the address of the next instruction to be executed

  2. Stack pointer → Keeps track of your current local variables and control information for the current function

    1. Frame pointer → points at the stop of the stack

10
New cards

What is a Flag in a CPU

Special registers that contain information about operands, for example an overflow flag

11
New cards

What are some examples of instructions

  • Nop - do nothing (good for preventing hazards/synchronization)

  • add

  • sub

  • jmp - jump (je,jle,jg — conditional jumps)

  • and, or, xor

    • int - interrupts (execute system calls)

12
New cards

What endian architecture is x86

little endian — least significant byte stored first

13
New cards

What is the executable file format

Executable code gets encapsulated in an “envelope” that contains all the information required to run it.

14
New cards

What is the most common file format in Linux

The executable linkable format (ELF)

15
New cards

What does ELF format contain

a header specifying the type of file (executable, library), the architecture, and offset of segments

various segments containing the programs code (.text) and data (.data)

Debug information

16
New cards

What does a debugger allow you to do

Start, stop, program execution

17
New cards

What are some useful gdb commands

r — runs the program

b — sets the breakpoint
set" allows you to modify the value of a register

"c" continues the execution

"si" steps to the next instruction

18
New cards

What is memory layout

when a program is executed, the operating system loads it into virtual memory and assigns a memory region to it — program can access this regions and nothing else

19
New cards

What does a memory region of a program store?

  1. Executable code — program’s code and libs

  2. global data — this is what we had in the assembly program

  3. temporary (function) data — stack

  4. dynamic (malloc) data — heap