Course details
Binary Code Analysis
IAN Acad. year 2024/2025 Summer semester 4 credits
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 the functionality of an operating system kernel. These concepts include, among others, 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.
Guarantor
Course coordinator
Language of instruction
Completion
Time span
- 14 hrs lectures
- 12 hrs pc labs
- 13 hrs projects
Assessment points
- 40 pts mid-term test
- 60 pts projects
Department
Lecturer
Instructor
Learning objectives
The goal is to acquaint students with the operation of modern Unix operating systems on a level close to the binary code and with available tools for observing the behaviour of such systems, including, in particular, their post-mortem analysis.
Practical experience with analysing the image of system memory after a system crash (crash dump analysis). Knowledge of the structure of binary files used in Unix systems (ELF). Understanding differences and relations between processors architectures, compilers, and ABI standards. Students who successfully pass the course will further be able to monitor the run of an operating system on a binary level during its runtime too. Improved knowledge in the areas of operating systems, machine languages, and debugging and analysis.
Recommended prerequisites
- Operating Systems (IOS)
- Machine Level Programming (ISU)
Prerequisite knowledge and skills
Proficiency in C language, x86 assembly code, understanding of operating system principles, practical experience with Unix systems.
Study literature
- Course slides: https://github.com/skozina/cda-slides
- Intel Corporation: Intel 64 and IA-32 Architectures Software Developer Manuals, 2015.
- Matz, M., Hubicka, J., Mitchell, M.: System V Application Binary Interface, AMD64 Architecture Processor Supplement, 2013.
Fundamental literature
- Ljubuncic, I.: Linux Kernel Crash Book, 2011.
-
Drake, C., Brown, K.: Panic! UNIX System Crash Dump Analysis, Prentice Hall, 1995.
-
Platforms, Crashdump Analysis, Operating System Internals, 2005.Hofmann, F.: The Solaris Operating System on x86
Syllabus of lectures
- Introduction. Code compilation and linking. Understanding the ELF file format.
- Dynamic linking and running code. Dynamic relocations and interpreter. PIC, ASLR, PIE, linker script. DWARF debug symbols.
- Computer architectures in general, registers, stack operations. Memory segmentation, paging.
- The x86 and x86_64 architectures. System V ABI. Compiler and stack optimizations. The ARM architecture.
- Live kernel tracing: strace, ltrace, SystemTap, ftrace, perf.
- BPF (Berkeley Packet Filter), eBPF and its usage in kernel tracing. BCC, bpftrace.
Syllabus of computer exercises
- Decomposition of an ELF binary file, decoding its sections, and code disassembling.
- Program execution tracing using strace, ltrace, gdb.
- Using the crash(1) tool on Linux.
- Crash dump analysis of a Linux system.
- System tracing using SystemTap and ftrace.
- Tracing and analysis of system deadlocks.
Syllabus - others, projects and individual work of students
- ELF file analysis.
- Analysis of a crash dump.
- Analysis of a crash dump.
- Monitoring of a running system using SystemTap.
Progress assessment
- Individual project assignments (4x 15 points)
- Final test (40 points)
The obtained knowledge of students is examined through four projects focused on low-level programming and on discovering the roots causing problems in an operating system from a provided crash dump (4x 15 points) and through a final written test (40 points).
Schedule
Day | Type | Weeks | Room | Start | End | Capacity | Lect.grp | Groups | Info |
---|---|---|---|---|---|---|---|---|---|
Wed | lecture | 1., 3., 6., 8., 9., 11. of lectures | A113 | 10:00 | 11:50 | 64 | 2BIA 2BIB 3BIT | xx | Malík |
Wed | lecture | 2., 4., 5., 7., 10., 12., 13. of lectures | A113 | 10:00 | 11:50 | 64 | 2BIA 2BIB 3BIT | xx |
Course inclusion in study plans
- Programme BIT, 2nd year of study, Elective
- Programme BIT (in English), 2nd year of study, Elective