Course detail
Binary Code Analysis
FIT-IANAcad. year: 2018/2019
This course deepens the knowledge and skill obtained in the course of Machine level programming (ISU) and in the course of Operating systems (IOS) with the main goal of allowing the students to understand the image of a crashed system (the so-called crash dump). Knowledge of programming on the level of assembler and application binary interfaces (ABI) is applied on a real Unix operating system. Within the course, various binary files used in the system are discussed, including their structure and their disassembled contents. The course involves a detailed study of compiler output from the point of view of linkage and run of system code as well as a discussion of differences and relations among various processor architectures, compilers, and application binary interfaces. Next, the course presents selected concepts typical for kernel-level programming whose deep knowledge is necessary for analysing functionality of an operating system kernel. These concepts include, among other, details of interrupt processing, task queues, process/thread synchronisation and memory management inside the kernel, i.e., the so-called SLAB allocator. Knowledge obtained in this way is used as a basis for presenting possibilities of monitoring the behaviour of an operating system on the binary level during its run as well as analysis of images of system memory after a system crash (crash dump analysis). In both cases, usage of tools shipped within common Unix distributions is accented.
Language of instruction
Number of ECTS credits
Mode of study
Guarantor
Department
Learning outcomes of the course unit
Improved knowledge in the areas of operating systems, machine languages, and debugging and analysis.
Prerequisites
Co-requisites
Planned learning activities and teaching methods
Assesment methods and criteria linked to learning outcomes
Exam prerequisites:
To successfully pass the course, a student needs to get at least 50 points in total out of which at least 24 points must be obtained from the projects and at least 16 points from the final test.
Course curriculum
Work placements
Aims
Specification of controlled education, way of implementation and compensation for absences
Recommended optional programme components
Prerequisites and corequisites
- recommended prerequisite
Machine Level Programming - recommended prerequisite
Operating Systems
Basic literature
Recommended reading
Matz, M., Hubicka, J., Mitchell, M.: System V Application Binary Interface, AMD64 Architecture Processor Supplement, 2013.
Classification of course in study plans
Type of course unit
Lecture
Teacher / Lecturer
Syllabus
- Computer architectures in general, registers, implicit and explicit stack operations. The x86 and x86_64 computer architectures, common instructions. System V ABI on x86_64 architecture, red zone.
- Compilation, linking, and running code. Examples of compiler optimizations, stack optimizations (leaf and tail calls, function inlining), linker script, understanding of the Unix binary file (ELF, objdump).
- Linux crash dump analysis, DWARF debug symbols, using the crash(8) tool.
- Linux crash dump analysis, understanding kernel Oops, kernel flags, sysrq.
- Kernel process and memory management, task_struct, vmas, SLAB allocator.
- Interrupt processing, postponing work, bottom halves, softirqs and tasklets, work queues.
- Live kernel tracing (SystemTap, ftrace), locks, deadlocks and hangs and their analysis and reconstruction.
Exercise in computer lab
Teacher / Lecturer
Syllabus
- Decomposition of an ELF binary file, decoding its sections, and code disassembling.
- Using the crash(1) tool on Linux.
- Crash dump analysis of a Linux system on the IA-32 architecture.
- Crash dump analysis of a Linux system on the AMD64 architecture.
- System tracing using SystemTap and ftrace.
- Tracing and analysis of system deadlocks.
Project
Teacher / Lecturer
Syllabus
- Analysis of a crash dump on the IA-32 architecture.
- Analysis of a crash dump on the AMD64 architecture.
- Monitoring of a running system using SystemTap.