Reverse Engineering Armv8-A Systems - Austin Kim - E-Book

Reverse Engineering Armv8-A Systems E-Book

Austin Kim

0,0
35,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Unlock the secrets hidden in binary code without needing the source! Written by a Linux kernel engineer and author with over 14 years of industry experience, this book lays a solid foundation in reverse engineering and takes you from curious analyst to expert. You’ll master advanced techniques to dissect kernel binaries, including kernel module files, vmlinux, and vmcore, giving you the power to analyze systems at their core.
This practical, three-part journey starts with the essentials of reverse engineering, introducing the key features of Armv8-A processors and the ELF file format. The second part walks you through the reverse-engineering process, from Arm environment setup to using static and dynamic analysis tools, including innovative methods for analyzing kernel binaries and the powerful debugging tool uftrace. The final part covers security, exploring TrustZone and the latest security techniques to safeguard Arm devices at the hardware level.
By the end of this reverse engineering book, you'll have comprehensive Armv8-A expertise and the practical skills to analyze any binary with confidence while leveraging advanced security features to harden your systems.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 531

Veröffentlichungsjahr: 2025

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Reverse Engineering Armv8-A Systems

First Edition

A practical guide to kernel, firmware, and TrustZone analysis

Austin Kim

Reverse Engineering Armv8-A Systems

First Edition

Copyright © 2025 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Portfolio Director: Rohit Rajkumar

Relationship Lead: Tanisha Mehrotra

Project Manager: Sandip Tadge

Content Engineer: Anuradha Vishwas Joglekar

Technical Editor: Tejas Mhasvekar

Copy Editor: Safis Editing

Indexer: Pratik Shirodkar

Proofreader: Anuradha Vishwas Joglekar

Production Designer: Pranit Padwal

Growth Lead: Namita Velgekar

Marketing Owner: Nivedita Pandey

First published: August 2025

Production reference: 1170725

Published by Packt Publishing Ltd.

Grosvenor House

11 St Paul’s Square

Birmingham

B3 1RB, UK.

ISBN 978-1-83508-892-0

www.packtpub.com

To my wife, Helen, for encouraging me when I needed it and for standing by my side throughout my life.

– Austin Kim

Foreword

The era of artificial intelligence (AI) is here, capturing the attention of tech enthusiasts, innovators, and students everywhere. With AI at the center of tech discussions, many people, from new developers to experienced professionals, are eager to learn its complexities. But is this the right path? Is AI really the ultimate answer – the “super-hero” of technology? Should every new developer and even those already established focus only on AI? These questions remain as we move through this exciting time.

Alongside the AI excitement, another important topic is emerging: protecting personal information. In our connected world, people highly value their privacy. Yet, everyone knows that once personal data goes to the cloud, it’s no longer fully secure. The best way to keep personal data safe is to store it locally, on embedded devices rather than sending it to the cloud.

This reality shows the growing importance of embedded systems, where Arm processors are already the most widely used technology. As the need for secure, local computing grows, Arm processors will become even more common, and the demand for Arm experts will rise. Moreover, while AI is strong in many areas, system software engineering, especially in reverse engineering, where AI often struggles, remains a vital and expanding field. Skills in this area will become even more essential as industries focus on secure, efficient, and reliable embedded solutions.

Here enters Austin Kim, a well-known writer in South Korea’s tech community, famous for their insightful books on Arm architecture and the Linux kernel. Having read all of his books, I can say their greatest strength is how easy they are to read. Many technical books, even if full of great information, sit unread because they’re hard to follow. But Kim’s books are engaging and simple to understand. This ease doesn’t mean they lack depth; it helps readers grasp complex ideas effortlessly. When I heard Austin Kim was writing a book in English, I wondered if their clear style would carry over. After reading this new book, I’m happy to say that he has a special talent for writing clearly and engagingly, no matter the language.

I strongly recommend this book to anyone wanting to learn more about Arm processors, system software engineering, or embedded systems in today’s AI-driven world. Whether you’re a new developer exploring this field, an experienced engineer shifting to embedded systems, or a professional aiming to stay ahead in a fast-changing industry, this book offers valuable knowledge. This book is a must-read for those eager to master a field that will only grow in importance, delivered with the clarity and engagement that only Kim can provide.

Bojun Seo

Software Engineer, LG Electronics

Contributors

About the author

Austin Kim has more than 14 years of experience in embedded Linux BSP development. He has worked on many tasks, such as board bring-up, crash and performance troubleshooting, and bootloader development for Arm-based devices. He has strong skills in binary analysis and has analyzed many memory dumps using TRACE32, Crash Utility, and ftrace. He has solved various kernel issues, including crashes, system lockups, and watchdog resets. Currently, he works as a Linux kernel BSP engineer and technical lecturer at LG Electronics. He enjoys sharing practical debugging skills, especially in areas such as Armv8-A architecture and kernel crash analysis.

I sincerely thank my wife, Helen Song, for her patience and support. Her dedication gave me the strength to complete this work. I’m also grateful for the guidance from mentors and leaders: Mike Seo, Dr. Reddy, Dr. Namseok Kim, and Dr. Gunho Lee. I also sincerely thank the technical reviewers: Bojun Seo, Rafiuddin Syed, Namhyung Kim, and Youngmin Nam. Lastly, I thank the Packt team, who supported me with great patience and professionalism.

About the reviewers

Bojun Seo is an open source developer at LG Electronics, developing advanced developer tools leveraging eBPF (extended Berkeley Packet Filter). He has an interest and experience in various fields related to computer science engineering, which include computer architecture, software architecture, parallel computing, General-Purpose Computing on Graphics Processing Units (GPGPU), memory management, algorithms, security, open source culture, and so on. He actively engages with other developers, enjoying presentations on his current tools at C++ Now, LG Software Developer Conference, and the Korean Linux Kernel Developers Meetup. He lives in Seoul and enjoys traveling around the world.

Rafiuddin Syed is an embedded systems engineer with expertise in real-time computing, virtualization, and low-level software development. He has held various roles at Texas Instruments, Intel, NVIDIA, Harman, and Drako Motors. His work spans hypervisors, Linux kernel development, PCIe, USB, and secure IPC, with contributions to both industry and open source projects.

Namhyung Kim is a staff software engineer at Google. He’s been working on the Linux kernel and other open source projects for more than 15 years. His main interests are low-level infrastructure such as operating systems, toolchains, performance monitoring, tracing, and binary instrumentation. Now he co-maintains the Linux perf tools and uftrace project, and also enjoys traveling all over the world.

Youngmin Nam is a seasoned software engineer with over 15 years of experience in embedded systems and low-level software development. At Samsung Electronics, he has led Linux kernel and Android BSP development for ARM-based SoCs, including the Exynos2400 platform used in Galaxy flagship devices. He played a key role in the Google Pixel project, collaborating directly with Google’s Pixel team to bring up essential system drivers and ensure platform stability. More recently, he has been working closely with Google’s kernel team and upstream maintainers to apply Generic Kernel Image (GKI) support to the Exynos kernel. His expertise spans kernel bring-up, memory management, platform integration, and upstream contributions to both Linux and Android kernels. Youngmin is passionate about reverse engineering, debugging complex system-level issues, and contributing to the open source community.

I would like to thank my family for their continued support and encouragement throughout my professional journey.

Join our community on Discord

Join our community’s Discord space for discussions with the authors and other readers: https://packt.link/embeddedsystems

Contents

Preface

Part I: Fundamentals of Armv8-A Architecture

Learning Fundamentals of Arm Architecture

Technical requirements

Introduction to the Arm architecture

What is the Arm architecture?

Cortex® processor and architecture

Armv8 profiles

Registers

General-purpose registers

Special registers

SP_ELx

ELR_ELx

PC

Program status registers

PSTATE

SPSR_ELx

System registers

Lowest exception levels

How to access the system register

Key registers related to reverse engineering

Procedure Call Standard for the Arm Architecture (AAPCS)

Background

Introduction to AAPCS

Register used for AAPCS

BL instruction

Exception levels

Exception levels and privilege levels

EL0 with PL0

EL1 with PL1

EL2 with PL2

EL3 with PL3

Instructions to switch exception levels

How to determine the current exception level

Example routine to read CurrentEL

Exceptions

Key principles of exceptions

Types of exception

Exception vector table

Details of exception vector table

EL1 with SP_EL0

EL1 (current EL with SPx)

EL0 (AArch64)

EL0 (AArch32)

How an exception is generated with the big picture

Step 1: Indicating the cause of exception

Step 2: Updating registers

Step 3: Switching the exception level

Step 4: Branching to exception vector address

Step 5: Exception handling

How an exception handler works

Synchronous exception handler

IRQ and FIQ exception handler

SError exception handler

Summary

Understanding the ELF Binary Format

Technical requirements

Introduction to ELF

Why do we need to learn about ELF?

What is ELF?

Layout of an ELF file

ELF header

How to identify an ELF header

How to view the ELF header

Exploring the ELF header

The e_ident field

The e_type field

The e_machine field

The e_entry field

The e_phoff and e_shoff fields

The e_shstrndx field

Section headers

Layout of section headers

Exploring section headers

The sh_name field

The sh_type field

The sh_flags field

The sh_addr field

The sh_offset and sh_size fields

Sections

The .text section

The .bss, .data, and .rodata sections

The dynamic section

The .init section

The GOT section

The PLT section

Program headers

Layout of the program header

Exploring program headers

The p_type field

The p_flags field

The p_offset, p_vaddr, and p_paddr fields

Summary

Manipulating Data with Arm Data Processing Instructions

Technical requirements

Move operations

The MOV instruction

Examples of the MOV instruction

The MVN instruction

Examples of the MVN instruction

Arithmetic operations

The ADD instruction

Examples of the ADD instruction

The ADC instruction

Example of the ADC instruction

The SUB instruction

Examples of the SUB instruction

SBC instruction

Examples of the SBC instruction

Bit-shift operations

The LSL instruction

Examples of the LSL instruction

The LSR instruction

Examples of the LSR instruction

The ASR instruction

The ROR instruction

Case study – bit-shift operations in assembly code

Logical operations

The AND instruction

Example of the AND instruction

The ORR instruction

Example of the ORR instruction

The ORN instruction

Example of the ORN instruction

The BIC instruction

Examples of the BIC instruction

The EOR instruction

Examples of the EOR instruction

Practicing logical operations

The AND operation

The OR operation

The XOR operation

Practicing data processing instructions

Initializing variables

Checking the state

Clearing a bit

Handling the else part

Summary

Reading and Writing with Memory Access Instructions

Technical requirements

The LDR instruction

Syntax: LDR instruction in basic form

LDR instruction with offset addressing mode

The STR instruction

Syntax: STR instruction in its basic form

STR instruction with offset addressing mode

Extension: Memory access operation

Various load operations

Various store operations

The secret behind load operations

Practicing memory access instructions

Introducing example code

Analyzing assembly routine: STR and LDR

Summary

Controlling Execution with Flow Control Instructions

Technical requirements

Branch instructions

The B instruction

The BL instruction

The BR instruction

The BLR instruction

Analyzing an example routine

Comparison operations

The condition flags in PSTATE

The CMP instruction

CMP instruction example

The CMN instruction

CMN instruction example

The TST instruction

TST instruction example

Conditional codes

Introducing conditional codes

Analyzing an example routine with conditional codes

Conditional branch operations

The CBZ instruction

The CBNZ instruction

The TBZ instruction

The TBNZ instruction

Analyzing assembly routines for reverse engineering

The CBZ instruction

The CBNZ instruction

The TBZ instruction

System control operations

The SVC instruction

The HVC instruction

The SMC instruction

Summary

Part II: Background Knowledge for Binary Analysis

Introducing Reverse Engineering

Technical requirements

Why reverse engineering is necessary

Library and firmware debugging

Legacy systems

Improving debugging skills

Case study – how reverse engineering skills enhance debugging abilities

Methods of reverse engineering

Static analysis

Dynamic analysis

Dump analysis

Introducing binary for dump analysis

Advantage of dump analysis

Compilation process

What the compiler does

The breakdown of compilation

The compiler option – optimization level

Assembly instructions and machine code

Opcode and instruction

Background knowledge of reverse engineering

Assembly instructions

Linux kernel

ELF format

Summary

Setting Up a Practice Environment with an Arm Device

Technical requirements

Raspberry Pi

Introducing Raspberry Pi

Arm processor profile in each Raspberry Pi

QEMU

User-mode emulation

Full system emulation

Summary

Unpacking the Kernel with Linux Fundamentals

Technical requirements

Architecture overview

What is the Linux kernel?

Resource manager

Supporting the execution environment

Understanding system calls

User space and kernel space

How the system call works

System call number and system call handler

Monitoring system call operations

Process management

Introducing processes

The data structure of the process

Understanding the call stack of the process

Multiprocess management

Introducing threads

Memory management

Key memory features in the Linux system

Introducing the virtual memory system

Virtual addresses in user space and kernel space

Understanding the virtual memory area

Key security hardening features

LSM

Address sanitizer

Why the Address Sanitizer was introduced

Understanding the KASLR feature

Summary

Part III: Unlocking Key Binary Analysis Skills for Reverse Engineering

Understanding Basic Static Analysis

Technical requirements

Introducing static analysis

What is static analysis?

Programs used for static analysis

Identifying binaries

Introducing binary utilities to check binary files

The file utility

The readelf utility

The xxd utility

Identifying the raw data of binary file

Identifying the raw data of a text file

Case study of the corrupted binary file

Analyzing the control flow with if statements

Basic if statement

The if-else statement

The else-if statement

The if with return statement

Analyzing the control flow with for loops

Basic for loop

A for loop with a break statement

A for loop with a continue statement

A for loop with a return 0 statement

Identifying log output patterns

Why do we need to understand log output routines?

Analyzing the call to the printf function

When printf becomes puts

Summary

Going Deeper with Advanced Static Analysis

Technical requirements

Methodology for static analysis

Setting clear and flexible goals

Techniques for analyzing instructions

Line-by-line analysis

Control flow analysis using function calls

Understanding the limitations of static analysis

Comparing static analysis and dynamic analysis

Introducing advanced static analysis

Key features of kernel binaries

Selecting kernel binaries for analysis

Debugging program for kernel binaries

Structure of kernel binaries

Exploring vmlinux

How to generate vmlinux

Inspecting header sections in vmlinux

Understanding *.ko files (kernel modules)

Types of device drivers

Why is it important to analyze *.ko files?

Checking header information in a *.ko file

Inspecting metadata in the .modinfo section

Key features of kernel binaries

Accessing system registers

Handling exceptions in the kernel

Managing sp_el0 and current macro

Instructions to identify exception levels

Understanding the pattern of struct data structures

Understanding the offset of fields in struct

Instructions for accessing fields in a struct

Summary

Analyzing Program Behavior with Basic Dynamic Analysis

Technical requirements

Introducing dynamic analysis

What is dynamic analysis?

Limitations of dynamic analysis

Introducing basic dynamic analysis

Exploring the GDB program

Introducing GDB

Using GDB

Running the GDB program

Launching GDB

Setting breakpoints

Debugging information commands

Inspecting memory contents

Introducing GEF

Understanding the virtual address range

Virtual memory system

Examples of the virtual address pattern

Analyzing stack memory content

Understanding the call stack

Debugging a corrupted stack

Exploiting stack corruption

How to identify stack corruption

Introducing the debugging patch

How to use the stack debugging code

Mitigation method

Return-oriented programming analysis

Key concept of ROP

Using compiler options to prevent this symptom

Memory corruption: buffer overflow case study

Introducing the example code

Debugging with a patch

Buffer overflow over multiple layers: case study

Buffer overflow from another software layer

Buffer overflow in a struct

The mitigation method

Summary

Expert Techniques in Advanced Dynamic Analysis

Technical requirements

Introducing advanced dynamic analysis

What is advanced dynamic analysis?

Debugging program for kernel debugging

vmcore and the Crash utility

Debugging approaches for the kernel binary

Understanding the KDUMP feature

Analyzing vmcore files using the binary utility

Understanding the layout of the vmcore file

NOTE section of the program header

Understanding the Crash utility

Stack area of the process

Background on the stack of a process

The overall layout of the process stack

Analyzing the memory contents of the process stack

User process stack versus kernel process stack

Code review on the stack magic value

Summary of the magic value inside the binary

Tracking the start address for a struct using the address

Understanding the task_struct structure

How to find the address of the task_struct structure

Reviewing the thread field in the task_struct structure

Identifying a structure using a function pointer

Data structures that store function addresses

Finding the address of bcm2835_mmc_irq

Understanding the irqaction structure

Finding the address in the irq_desc structure

Summary of the analysis

Summary

Tracing Execution with uftrace

Technical requirements

Introducing log-based debugging

Why do we need logs or tracing?

The importance of logs in real-world projects

Introducing uftrace

Why was uftrace designed?

Key features of uftrace

How to install uftrace

Basic features of uftrace

Simple “Hello, World!” project

Why -pg is added when compiling the code

Format of uftrace output

Practical features of uftrace

Library debugging

Argument tracing

Return value tracing

Summary

Part IV: Security Features in Armv8-A Systems

Securing Execution with Armv8-A TrustZone

Technical requirements

Introducing TrustZone

Why was TrustZone introduced?

What are the primary features of TrustZone?

Why we need to learn about TrustZone

Key concepts of TrustZone

Understanding the Non-secure world

Software scenario of the Secure world

Secure monitor call

Non-secure world to Secure world

Secure world to Non-secure world

Exception handlers for TrustZone

Implementation of TrustZone in real systems

How does a trusted OS run in the Secure world?

Examples of security implementations using TrustZone

Analyzing Arm Trusted Firmware

Analyzing the exception handler at EL3

Exception handler for the SMC instruction

Hardware features related to TrustZone

AWPROT and ARPROT signals

Hardware features supporting TrustZone

Summary

Building Defenses with Key Security Features of Armv8-A

Technical requirements

Privileged Access Never (PAN)

The motivation behind PAN

Registers for configuring PAN

The PAN system register

The SCTLR_EL1.SPAN field

Code review of PAN initialization in the Linux Kernel

Implementation considerations in the Linux system

Pointer Authentication Code (PAC)

Introducing PAC

Understanding the PAC authentication code

The layout of the virtual address for storing PAC

How the PAC feature is applied

A common use case for PAC

The execution flow when using the branch operation

Assembly instructions on PAC

The components of the PACIASP and AUTIASP instructions

More PAC instructions

Compiler support

How to use PAC in Linux using the GCC compiler

PAC exception: Fault on FPAC

Key system registers for PAC

Branch Target Identification (BTI)

Why was BTI introduced?

Understanding BTI

The workflow of BTI

The guarded page

The BTI instruction and PSTATE.BTYTE

The BTI instruction

PSTATE.BTYPE: A new processor state

Using the BTI option via a compiler

BTI exceptions

Code review of BTI

Memory Tagging Extension (MTE)

Introducing MTE

How tags are handled

The virtual address layout used to store the address tag

Memory tag

MTE’s tag checking operation

Summary

Other Books You May Enjoy

Index

Landmarks

Cover

Index

Preface

Today, Arm processors are used in a wide range of systems, such as smartphones, AI SoCs, the automotive sector (for autonomous driving and infotainment), cloud servers, and MacBooks. These processors are mostly based on Armv8-A 64-bit architecture, including popular Arm processors, such as Cortex-A53, Cortex-A57, and Cortex-A78.

In system software development, Armv8-A architecture is now one of the most important topics that engineers should understand.

This book, Reverse Engineering Armv8-A Systems, was written to share practical ways to analyze binaries on Armv8-A systems. My goal is to help readers learn how Armv8-A architecture works and also build real skills through hands-on experience.

The book covers practical content that can be used directly in real-world projects. It is designed for readers who want to start learning binary analysis from the basics and move forward to a deeper understanding of low-level systems in Armv8-A systems.

Why I wrote this book

Reverse engineering means analyzing a system without access to the original source code. When you hear the term “reverse engineering,” you might think of binary analysis, security research, or exploit development. These are important skills and are often seen as core skills. Many blog posts and articles talk about using reverse engineering to create exploits from a security point of view.

However, for many system software developers, reverse engineering is usually used for a different purpose: to find bugs, analyze crashes, or investigate system failures, rather than to develop exploits. This book focuses on binary analysis skills that are useful for firmware developers and system software engineers. This book is not written for offensive security. Instead, it explains detailed binary analysis methods and practical debugging techniques.

I believe that the ability to analyze binaries is a core skill for becoming an advanced engineer in embedded systems. With this book, you will learn about the key concepts of the Armv8-A architecture and gain practical experience in analyzing binaries on Armv8-A systems.

Who this book is for

If you are interested in binary analysis, reverse engineering, or debugging on Armv8-A devices, this book is for you. It is especially helpful for system software engineers, security consultants, and ethical hackers who want to expand their binary analysis expertise. To get the most value, you should have a basic understanding of C programming. Familiarity with computer architecture, Linux systems, and security concepts will also help you follow the material in this book more effectively.

What this book covers

Chapter 1, Learning Fundamentals of Arm Architecture, introduces the basic concepts of the Armv8-A architecture, such as exception levels, register usage, AAPCS, and exception handling. These fundamentals will help you understand system behavior and prepare you for binary analysis.

Chapter 2, Understanding the ELF Binary Format, introduces you to the ELF binary format, including the file header, section header, and program header. You will learn how to use the readelf command to check binary structure and how each header helps during reverse engineering.

Chapter 3, Manipulating Data with Arm Data Processing Instructions, explains data processing instructions for arithmetic, logic, and bit shifts. You will learn how to reconstruct assembly instructions into C. These skills are key background knowledge for binary analysis.

Chapter 4, Reading and Writing with Memory Access Instructions, covers how memory access works in Armv8-A using LDR and STR. You will learn how they move data between registers and memory.

Chapter 5, Controlling Execution with Flow Control Instructions, explains flow control instructions that change how a program runs based on conditions with comparison and branch instructions.

Chapter 6, Introducing Reverse Engineering, introduces reverse engineering, a way to understand software without source code. You will learn about static and dynamic analysis, as well as the compilation process, which are important for binary analysis.

Chapter 7, Setting Up a Practice Environment with an Arm Device, covers how to set up a practice environment using an Arm device such as the Raspberry Pi or QEMU. With these tools, you will perform binary analysis.

Chapter 8, Unpacking the Kernel with Linux Fundamentals, focuses on Linux basics: user space, kernel space, system calls, and process management. You will also learn about memory management and security features such as LSM and KASLR.

Chapter 9, Understanding Basic Static Analysis, covers basic static analysis for reverse engineering by using binary utilities. You will learn how to check the type of a binary file and how to examine a corrupted object file. You will also learn how to read assembly code and understand how to convert it into C code.

Chapter 10, Going Deeper with Advanced Static Analysis, covers advanced static analysis for kernel binaries such as *.ko and vmlinux. You will learn about the ELF structure, typical kernel binary patterns, and how to recognize elements such as the .modinfo section.

Chapter 11, Analyzing Program Behavior with Basic Dynamic Analysis, discusses basic dynamic analysis, including its benefits and limitations. You will use tools such as GDB and GEF to debug various user-space binaries. This chapter also provides case studies related to memory corruption issues.

Chapter 12, Expert Techniques in Advanced Dynamic Analysis, covers advanced dynamic analysis of kernel binaries using the Crash utility. You will learn how to identify kernel structures such as task_struct using stack patterns and memory addresses. These skills are a key feature of this book.

Chapter 13, Tracing Execution with uftrace, explores uftrace, a powerful open source tool to monitor process execution. You will learn how to install and use uftrace with a simple example that traces function calls and return values.

Chapter 14, Securing Execution with Armv8-A TrustZone, explores TrustZone in Armv8-A. You will also learn how software switches between the non-secure and secure worlds using the SMC instruction. It also explains hardware features that support TrustZone, such as the AxPROT signal.

Chapter 15, Building Defenses with Key Security Features of Armv8-A, explains the latest security features in Armv8-A, including PAN, PAC, BTI, and MTE. These features are used to protect systems by controlling memory access and verifying addresses.

To get the most out of this book

To get the most benefit from this book, we recommend the following:

You should be familiar with using Linux, especially with the command-line interface (shell).You should have basic knowledge of the C programming language.

We have tested all the example code in this book using the following platforms:

x86_64 Ubuntu 22.04 LTS as a guest OS (running on Oracle VirtualBox 7.0)Raspberry Pi 4 Model B (64-bit Arm), tested with both the standard distribution kernel and our custom 6.6 kernel (lightly tested)

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Everything will be explained step by step. Whether you are a beginner or an experienced developer, this book will guide you through the interesting and practical world of binary analysis for reverse engineering.

Download the example code files

The code bundle for the book is hosted on GitHub at https://github.com/PacktPublishing/Reverse-Engineering-Armv8-A-Systems. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://packt.link/gbp/9781835088920.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example: “The MOV instruction is used to copy the value of an operand into the destination register”:

A block of code is set as follows:

struct task_struct { int flags; int state; char task_name[15]; };

Any command-line input or output is written as follows:

crash> rd ffffff8040238018 ffffff8040238018: ffffffc008028000

Bold: Indicates a new term, an important word, or words that you see on the screen. For instance, words in menus or dialog boxes appear in the text like this. For example: “[3] Callstack shows how function calls are made by processes.

Warnings or important notes appear like this.

Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: Email [email protected] and mention the book’s title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you reported this to us. Please visit http://www.packtpub.com/submit-errata, click Submit Errata, and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit http://authors.packtpub.com/.

Share your thoughts

Once you’ve read Reverse Engineering Armv8-A Systems, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily.

Follow these simple steps to get the benefits:

Scan the QR code or visit the link below:

https://packt.link/free-ebook/9781835088920

Submit your proof of purchase.That’s it! We’ll send your free PDF and other benefits to your email directly.

Part 1

Fundamentals of Armv8-A Architecture

In this part, you will learn about the fundamentals of the Armv8-A architecture that are necessary to begin binary analysis. This part provides practical knowledge that you can use in real debugging or reverse engineering tasks in Armv8-A systems.

This part includes the following chapters:

Chapter 1, Learning Fundamentals of Arm ArchitectureChapter 2, Understanding the ELF Binary FormatChapter 3, Manipulating Data with Arm Data Processing InstructionsChapter 4, Reading and Writing with Memory Access InstructionsChapter 5, Controlling Execution with Flow Control Instructions