ARM uVisor Debug Refinement Project(debugging facility improvements)

家榮 張
家榮 張學生 - 國立交通大學 um National Chiao Tung University,Taiwan
ARM uVisor
Debug Refinement Project
STUDENTS’ INFORMATION TECHNOLOGY CONFERENCE
2016,TAIWAN
張家榮
Jared
jaredcjr.tw@gmail.com
National Cheng Kung University
Department of Engineering Science
• A university student wants to have a
representative work before graduating.
• I used to develop embedded
applications.
(Once won the championship in the
Realtek Semiconductor Ameba IOT
competition)
• Try to know more about system software.
• Then…I found jserv…
Who and Why?
Before knowing uVisor,
we need to know mbed OS
source:http://www.slideshare.net/FoolsDelight/resilient-iot-security-the-end-of-flat-security-models
The green block used for
controlling hardware for
security is where we will
discuss in this slide.
Security Issue
• mbed OS allows user to develop applications over web
• Developer may read or write memory over its address space
mindlessly.
• Some tricky bug is hard to find.
• IOT devices expose to Network/public
• Attack through I/O
• Cortex-M is Memory-mapped I/O
• All configurations , including read
and write through I/O are Memory issues.
• Ex. USART1_DR = 0x40011000 in STM32F429i
• All data go through USART1 need to
access this address.
photo source:http://www.slideshare.net/FoolsDelight/resilient-iot-security-the-end-of-flat-security-models
uVisor Design Philosophy
• Many IoT security problems can be solved with standarized building
blocks
• HARDWARE-ENFORCED COMPARTMENTS (SANDBOXES)
• For individual code blocks by limiting access to memories and
peripherals using the existing hardware security features of the Cortex-M
microcontrollers.
• ARM CORTEX-M MPU
• Sets up a hardware protected environment by using a Memory
Protection Unit
• ALLOWS INTERACTION FROM THE UNPRIVILEGED CODE BY EXPOSING SVCALL-
BASED APIS.
photo reference:http://www.idea-sandbox.com/assets/images/sandbox_graphic_baby_blue.png
SandBox v.s. MPU
• MPU IN ARM V7-CORTEX-M
• Set Memory regions
• Minimum size: 32 bytes
• Maximum size: 4GB
• Set as XN
• XN=Execute Never
• cause MemManage Fault
• Read/Write
• Privileged/Unprivileged
• Read Only
• Read/Write
• No access
• Denying access cause
MemManage Fault
• Accessing MPU relative registers in
unprivileged mode cause Bus Fault.
reference:https://github.com/ARMmbed/uvisor
HOW TO PROTECT?
reference: http://www.slideshare.net/vh21/introductiontombedosuvisor?related=1
uVisor
SPIUSARTFLASHRAM
BOX 2BOX 1
• ACCESS CONTROL LISTS(ACLS)
• Each color represents for one “user”
• Each of them can only access its “belonings”
• Otherwise,the MPU will cause it to get into “MemManage Fault”
SECURE GATEWAY
for communication between boxes
uVisor
BOX 1
secure_gateway(func,args)
BOX 2
func()
SVC SVC
return
unprivileged
privileged
reference: http://www.slideshare.net/vh21/introductiontombedosuvisor?related=1
Current debugging
• LED PATTERN
• Hard to know
what caused this issue.
• May difficult to reappear
the condition.
• SEMI-HOST
• Based on SVC
• Output/Input through GDB
• ON-CHIP DEBUGGER
• ST-LINK/J-Link
• wired
Error reason RED LED blinks
PERMISSION_DENIED 1
SANITY_CHECK_FAILED 2
NOT_IMPLEMENTED 3
NOT_ALLOWED 4
FAULT_MEMMANAGE 5
FAULT_BUS 6
FAULT_USAGE 7
FAULT_HARD 8
FAULT_DEBUG 9
(gdb) b main.cpp:44
Breakpoint 1 at 0x8000a5e: file main.cpp, line 44.
(gdb) where
#0 us_ticker_read () at ../../external/mbed/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4/us_ticker.c:50
#1 0x0800379e in wait_us (us=500000) at ../../external/mbed/libraries/mbed/common/wait_api.c:29
#2 0x08003766 in wait (s=0.5) at ../../external/mbed/libraries/mbed/common/wait_api.c:20
#3 0x08000a5e in main () at main.cpp:43
(gdb) c
Continuing.
Breakpoint 1, main () at main.cpp:44
44 myled = 0;
(gdb) p/x i
$1 = 0x1
GDB
• WITH GNU DEBUGGER,YOU CAN…
Look up
Memory
registers
…
Control execution
Singel Step
Single Instruction
Breakpoint
Watchpoint
…
How to improve it?
• CRASHDEBUG
• Tool to enable post-mortem debugging of Cortex-M crashes with GDB.
• CRASHCATCHER
• Catch Hard Faults on Cortex-M devices and save out a crash dump to
be used by CrashDebug.
• MRI(MONITOR FOR REMOTE INSPECTION)
• The gdb compatible debug monitor for Cortex-M devices.
• Running over any of the UART ports on the device.
• Get rid of On-Chip debugger.
• Wireless debug at any time and any where.
photo reference:http://shop.myavr.com/pic/articles/STM32F429-disco_g.png
Reference hardware:
STM32F429i-Discovery
CrashCatcher
• SAVE THE MEMORY CONTENT IN THE HARDFAULT_HANDLER
• Used by GDB+CrashDebug
• Send the content to remote host or save in the local flash memory.
• THE FORMAT MUST BE READABLE BY GDB WITH CRASHDEBUG
• Little-Edian
• registers content
• StartAddress-EndAddress
• Content
63430200
00000000
740200200000000000ED00E000000000
00000000000000000000000000000000
00000000000000000000000000000000
02000000
D0FF0220
950A0008A80B000800000021
03000020
0000002000C00120
00000320A15D0008ED5D0008FD0C0008
2B1F00082D1F00082F1F000800000000
000000000000000000000000ED5D0008
331F000800000000ED5D0008ED5D0008
ED5D0008ED5D0008ED5D0008ED5D0008
ED5D0008ED5D0008ED5D0008ED5D0008
ED5D0008ED5D0008ED5D0008ED5D0008
...
Original Project Developer : Adam Green(http://mbed.org/users/AdamGreen/) Reference hardware:
STM32F429i-Discovery
(gdb) c
Continuing.
Can't send signals to this remote system. SIGSEGV not sent.
**Hard Fault**
Status Register: 0x40000000
Forced
**Usage Fault**
Status Register: 0x08
Coprocessor Access
Program received signal SIGSEGV, Segmentation fault.
0x08000ba8 in dbg_vprintf (fmt=0x8000a3f <dbg_put_dec(uint32_t, int, char)+102> "", va=...)
at MyImplementationIO/usart:535
CrashDebug
• POST-MORTEM DEBUG
• With the crashed dump memory content,we can
• Let the GDB view it as an alive target.
• Use GDB commands.
• Seeing the critical variable value.
• View the location that causing the situation.
• backtrace
• HELP US TO KNOW WHAT HAPPENED.
Original Project Developer : Adam Green(http://mbed.org/users/AdamGreen/) Reference hardware:
STM32F429i-Discovery
Monitor for Remote Inspection
(MRI)
• ALLOWING TO USE GDB REMOTE DEBUGGING THROUGH ANY COMMUNICATION
METHOD(WIRELESS IS POSSIBLE)
• Replace On-Chip debugger
• Currently support USART in STM32F429i-Discovery Cortex-M4 devices.
• GDB REMOTE SERIAL PROTOCOL
• Communicating with host GDB.
• Get commands by modifying USART handler.
• According to the commands sent from host GDB
• MRI sets the debug monitor in Cortex-M devices.
• DEBUG MONITOR
• One of the two debugging methods in Cortex-M devices.
• Halt mode
• debug monitor
• Based on exception handler
photo reference:https://www.segger.com/cms/admin/uploads/imageBox/J-Link-PRO_left_shadow_350x.jpg
Original Project Developer : Adam Green(http://mbed.org/users/AdamGreen/) Reference hardware:
STM32F429i-Discovery
Ad-Hoc Debugging
future framework between debugger and debuggee
Reference hardware:
STM32F429i-Discovery
dashed line represents for any communication way,such as USART or Bluetooth.
Debug Box
CrashCatcher
MRI
System 1
remote GDB
System 2
Save
CrashCatcher
dump
GDB with
CrashDebug
uVisor
Application BOX(s)
with
access permission
in the ACLs of the
Debug Box
Q&A
THANKS FOR LISTENING!
Especially thanks for (The order does not represent for any significance)
jserv jserv.tw@gmail.com
George Kang georgekang03@gmail.com
Adam Green http://mbed.org/users/AdamGreen/
Milosch Meriac https://meriac.com/
1 von 17

Recomendados

Kernel Recipes 2014 - Testing Video4Linux Applications and Drivers von
Kernel Recipes 2014 - Testing Video4Linux Applications and DriversKernel Recipes 2014 - Testing Video4Linux Applications and Drivers
Kernel Recipes 2014 - Testing Video4Linux Applications and DriversAnne Nicolas
2.2K views11 Folien
Kernel Recipes 2013 - Overview display in the Linux kernel von
Kernel Recipes 2013 - Overview display in the Linux kernelKernel Recipes 2013 - Overview display in the Linux kernel
Kernel Recipes 2013 - Overview display in the Linux kernelAnne Nicolas
3K views79 Folien
Secure IoT Firmware for RISC-V von
Secure IoT Firmware for RISC-VSecure IoT Firmware for RISC-V
Secure IoT Firmware for RISC-VRISC-V International
182 views19 Folien
LAS16-300: Mini Conference 2 Cortex-M Software - Device Configuration von
LAS16-300: Mini Conference 2 Cortex-M Software - Device ConfigurationLAS16-300: Mini Conference 2 Cortex-M Software - Device Configuration
LAS16-300: Mini Conference 2 Cortex-M Software - Device ConfigurationLinaro
293 views15 Folien
LAS16-300K2: Geoff Thorpe - IoT Zephyr von
LAS16-300K2: Geoff Thorpe - IoT ZephyrLAS16-300K2: Geoff Thorpe - IoT Zephyr
LAS16-300K2: Geoff Thorpe - IoT ZephyrShovan Sargunam
1K views41 Folien
Scada Strangelove - 29c3 von
Scada Strangelove - 29c3Scada Strangelove - 29c3
Scada Strangelove - 29c3qqlan
7K views74 Folien

Más contenido relacionado

Was ist angesagt?

Morello Technology Demonstrator Hardware Overview - Mark Inskip, Arm von
Morello Technology Demonstrator Hardware Overview - Mark Inskip, ArmMorello Technology Demonstrator Hardware Overview - Mark Inskip, Arm
Morello Technology Demonstrator Hardware Overview - Mark Inskip, ArmKTN
687 views10 Folien
Project ACRN EtherCAT 101 von
Project ACRN EtherCAT 101Project ACRN EtherCAT 101
Project ACRN EtherCAT 101Project ACRN
133 views20 Folien
Project ACRN USB mediator introduction von
Project ACRN USB mediator introductionProject ACRN USB mediator introduction
Project ACRN USB mediator introductionProject ACRN
61 views15 Folien
Project ACRN GPIO mediator introduction von
Project ACRN GPIO mediator introductionProject ACRN GPIO mediator introduction
Project ACRN GPIO mediator introductionProject ACRN
37 views16 Folien
RISC-V 30906 hex five multi_zone iot firmware von
RISC-V 30906 hex five multi_zone iot firmwareRISC-V 30906 hex five multi_zone iot firmware
RISC-V 30906 hex five multi_zone iot firmwareRISC-V International
152 views19 Folien
HKG18-223 - Trusted FirmwareM: Trusted boot von
HKG18-223 - Trusted FirmwareM: Trusted bootHKG18-223 - Trusted FirmwareM: Trusted boot
HKG18-223 - Trusted FirmwareM: Trusted bootLinaro
1.4K views30 Folien

Was ist angesagt?(20)

Morello Technology Demonstrator Hardware Overview - Mark Inskip, Arm von KTN
Morello Technology Demonstrator Hardware Overview - Mark Inskip, ArmMorello Technology Demonstrator Hardware Overview - Mark Inskip, Arm
Morello Technology Demonstrator Hardware Overview - Mark Inskip, Arm
KTN687 views
Project ACRN EtherCAT 101 von Project ACRN
Project ACRN EtherCAT 101Project ACRN EtherCAT 101
Project ACRN EtherCAT 101
Project ACRN133 views
Project ACRN USB mediator introduction von Project ACRN
Project ACRN USB mediator introductionProject ACRN USB mediator introduction
Project ACRN USB mediator introduction
Project ACRN61 views
Project ACRN GPIO mediator introduction von Project ACRN
Project ACRN GPIO mediator introductionProject ACRN GPIO mediator introduction
Project ACRN GPIO mediator introduction
Project ACRN37 views
HKG18-223 - Trusted FirmwareM: Trusted boot von Linaro
HKG18-223 - Trusted FirmwareM: Trusted bootHKG18-223 - Trusted FirmwareM: Trusted boot
HKG18-223 - Trusted FirmwareM: Trusted boot
Linaro1.4K views
LCA14: LCA14-502: The way to a generic TrustZone® solution von Linaro
LCA14: LCA14-502: The way to a generic TrustZone® solutionLCA14: LCA14-502: The way to a generic TrustZone® solution
LCA14: LCA14-502: The way to a generic TrustZone® solution
Linaro6.4K views
Morello Software and Toolchain Work in Arm - Mark Nicholson, Arm von KTN
Morello Software and Toolchain Work in Arm - Mark Nicholson, ArmMorello Software and Toolchain Work in Arm - Mark Nicholson, Arm
Morello Software and Toolchain Work in Arm - Mark Nicholson, Arm
KTN335 views
HKG18-212 - Trusted Firmware M: Introduction von Linaro
HKG18-212 - Trusted Firmware M: IntroductionHKG18-212 - Trusted Firmware M: Introduction
HKG18-212 - Trusted Firmware M: Introduction
Linaro2.2K views
ICS/SCADA/PLC Google/Shodanhq Cheat Sheet v2 von qqlan
ICS/SCADA/PLC Google/Shodanhq Cheat Sheet v2ICS/SCADA/PLC Google/Shodanhq Cheat Sheet v2
ICS/SCADA/PLC Google/Shodanhq Cheat Sheet v2
qqlan5.5K views
XPDDS18: Design Session - SGX deep dive and SGX Virtualization Discussion, Ka... von The Linux Foundation
XPDDS18: Design Session - SGX deep dive and SGX Virtualization Discussion, Ka...XPDDS18: Design Session - SGX deep dive and SGX Virtualization Discussion, Ka...
XPDDS18: Design Session - SGX deep dive and SGX Virtualization Discussion, Ka...
Project ACRN I2C mediator introduction von Project ACRN
Project ACRN I2C mediator introductionProject ACRN I2C mediator introduction
Project ACRN I2C mediator introduction
Project ACRN43 views
LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3 von Linaro
LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3
LAS16-111: Easing Access to ARM TrustZone – OP-TEE and Raspberry Pi 3
Linaro9.2K views
BUD17-416: Benchmark and profiling in OP-TEE von Linaro
BUD17-416: Benchmark and profiling in OP-TEE BUD17-416: Benchmark and profiling in OP-TEE
BUD17-416: Benchmark and profiling in OP-TEE
Linaro6.4K views
ARMv8-M TrustZone: A New Security Feature for Embedded Systems (FFRI Monthly ... von FFRI, Inc.
ARMv8-M TrustZone: A New Security Feature for Embedded Systems (FFRI Monthly ...ARMv8-M TrustZone: A New Security Feature for Embedded Systems (FFRI Monthly ...
ARMv8-M TrustZone: A New Security Feature for Embedded Systems (FFRI Monthly ...
FFRI, Inc.1.5K views
Kaspersky SAS SCADA in the Cloud von qqlan
Kaspersky SAS SCADA in the CloudKaspersky SAS SCADA in the Cloud
Kaspersky SAS SCADA in the Cloud
qqlan3.1K views
A versatile PC/104 Power Supply with Power-over-Ethernet from Sundance von Flemming Christensen
A versatile PC/104 Power Supply with Power-over-Ethernet from SundanceA versatile PC/104 Power Supply with Power-over-Ethernet from Sundance
A versatile PC/104 Power Supply with Power-over-Ethernet from Sundance
BKK16-110 A Gentle Introduction to Trusted Execution and OP-TEE von Linaro
BKK16-110 A Gentle Introduction to Trusted Execution and OP-TEEBKK16-110 A Gentle Introduction to Trusted Execution and OP-TEE
BKK16-110 A Gentle Introduction to Trusted Execution and OP-TEE
Linaro10.6K views
What are TULIPP starter kits? von Tulipp. Eu
What are TULIPP starter kits?What are TULIPP starter kits?
What are TULIPP starter kits?
Tulipp. Eu314 views
Stm32 f4 first touch von Benux Wei
Stm32 f4 first touchStm32 f4 first touch
Stm32 f4 first touch
Benux Wei3.6K views

Similar a ARM uVisor Debug Refinement Project(debugging facility improvements)

WOver von
WOverWOver
WOverWO Community
853 views17 Folien
Practical reverse engineering and exploit development for AVR-based Embedded ... von
Practical reverse engineering and exploit development for AVR-based Embedded ...Practical reverse engineering and exploit development for AVR-based Embedded ...
Practical reverse engineering and exploit development for AVR-based Embedded ...Alexander Bolshev
13.9K views166 Folien
FRDM-KL46Z_Hands-On_Presentation_v02 von
FRDM-KL46Z_Hands-On_Presentation_v02FRDM-KL46Z_Hands-On_Presentation_v02
FRDM-KL46Z_Hands-On_Presentation_v02Libor GECNUK
1.8K views51 Folien
Tools Of The Hardware Hacking Trade Final von
Tools Of The Hardware Hacking Trade FinalTools Of The Hardware Hacking Trade Final
Tools Of The Hardware Hacking Trade FinalPriyanka Aash
2.1K views49 Folien
embedded-systems-for-beginners von
embedded-systems-for-beginnersembedded-systems-for-beginners
embedded-systems-for-beginnersmohamed gaber
7.3K views32 Folien
4 Introduction to Arduino.pdf von
4 Introduction to Arduino.pdf4 Introduction to Arduino.pdf
4 Introduction to Arduino.pdfRynefelElopre2
47 views27 Folien

Similar a ARM uVisor Debug Refinement Project(debugging facility improvements)(20)

Practical reverse engineering and exploit development for AVR-based Embedded ... von Alexander Bolshev
Practical reverse engineering and exploit development for AVR-based Embedded ...Practical reverse engineering and exploit development for AVR-based Embedded ...
Practical reverse engineering and exploit development for AVR-based Embedded ...
Alexander Bolshev13.9K views
FRDM-KL46Z_Hands-On_Presentation_v02 von Libor GECNUK
FRDM-KL46Z_Hands-On_Presentation_v02FRDM-KL46Z_Hands-On_Presentation_v02
FRDM-KL46Z_Hands-On_Presentation_v02
Libor GECNUK1.8K views
Tools Of The Hardware Hacking Trade Final von Priyanka Aash
Tools Of The Hardware Hacking Trade FinalTools Of The Hardware Hacking Trade Final
Tools Of The Hardware Hacking Trade Final
Priyanka Aash2.1K views
embedded-systems-for-beginners von mohamed gaber
embedded-systems-for-beginnersembedded-systems-for-beginners
embedded-systems-for-beginners
mohamed gaber7.3K views
Hands On Workshop on IoT: From Arduino to JRC Board von Redwan Ferdous
Hands On Workshop on IoT: From Arduino to JRC BoardHands On Workshop on IoT: From Arduino to JRC Board
Hands On Workshop on IoT: From Arduino to JRC Board
Redwan Ferdous63 views
Workshop on IoT and Basic Home Automation_BAIUST.pptx von Redwan Ferdous
Workshop on IoT and Basic Home Automation_BAIUST.pptxWorkshop on IoT and Basic Home Automation_BAIUST.pptx
Workshop on IoT and Basic Home Automation_BAIUST.pptx
Redwan Ferdous84 views
Feasibility of Security in Micro-Controllers von ardiri
Feasibility of Security in Micro-ControllersFeasibility of Security in Micro-Controllers
Feasibility of Security in Micro-Controllers
ardiri1.8K views
Digging for Android Kernel Bugs von Jiahong Fang
Digging for Android Kernel BugsDigging for Android Kernel Bugs
Digging for Android Kernel Bugs
Jiahong Fang4.6K views
Developing micro controller applications von Steve Mylroie
Developing micro controller applicationsDeveloping micro controller applications
Developing micro controller applications
Steve Mylroie106 views
快速創新的模組化設計 von MAKERPRO.cc
快速創新的模組化設計快速創新的模組化設計
快速創新的模組化設計
MAKERPRO.cc550 views
JavaScript all the things - JavaScript fwdays 2018 von Jan Jongboom
JavaScript all the things - JavaScript fwdays 2018JavaScript all the things - JavaScript fwdays 2018
JavaScript all the things - JavaScript fwdays 2018
Jan Jongboom316 views
OWASP Appsec USA 2014 Talk "Pwning the Pawns with Wihawk" Santhosh Kumar von Santhosh Kumar
OWASP Appsec USA 2014 Talk "Pwning the Pawns with Wihawk" Santhosh Kumar OWASP Appsec USA 2014 Talk "Pwning the Pawns with Wihawk" Santhosh Kumar
OWASP Appsec USA 2014 Talk "Pwning the Pawns with Wihawk" Santhosh Kumar
Santhosh Kumar1.1K views
Getting started with Intel IoT Developer Kit von Sulamita Garcia
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer Kit
Sulamita Garcia17.8K views
Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo... von ryancox
Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo...Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo...
Developing Applications for Beagle Bone Black, Raspberry Pi and SoC Single Bo...
ryancox7.6K views
S2C China ICCAD 2010 Presentation von srpollock
S2C China ICCAD 2010 PresentationS2C China ICCAD 2010 Presentation
S2C China ICCAD 2010 Presentation
srpollock343 views
Microcontroller from basic_to_advanced von Imran Sheikh
Microcontroller from basic_to_advancedMicrocontroller from basic_to_advanced
Microcontroller from basic_to_advanced
Imran Sheikh132 views

Último

Microsoft Power Platform.pptx von
Microsoft Power Platform.pptxMicrosoft Power Platform.pptx
Microsoft Power Platform.pptxUni Systems S.M.S.A.
47 views38 Folien
Piloting & Scaling Successfully With Microsoft Viva von
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft VivaRichard Harbridge
10 views160 Folien
Data-centric AI and the convergence of data and model engineering: opportunit... von
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...Paolo Missier
34 views40 Folien
The details of description: Techniques, tips, and tangents on alternative tex... von
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...BookNet Canada
121 views24 Folien
1st parposal presentation.pptx von
1st parposal presentation.pptx1st parposal presentation.pptx
1st parposal presentation.pptxi238212
9 views3 Folien
SAP Automation Using Bar Code and FIORI.pdf von
SAP Automation Using Bar Code and FIORI.pdfSAP Automation Using Bar Code and FIORI.pdf
SAP Automation Using Bar Code and FIORI.pdfVirendra Rai, PMP
19 views38 Folien

Último(20)

Piloting & Scaling Successfully With Microsoft Viva von Richard Harbridge
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft Viva
Data-centric AI and the convergence of data and model engineering: opportunit... von Paolo Missier
Data-centric AI and the convergence of data and model engineering:opportunit...Data-centric AI and the convergence of data and model engineering:opportunit...
Data-centric AI and the convergence of data and model engineering: opportunit...
Paolo Missier34 views
The details of description: Techniques, tips, and tangents on alternative tex... von BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada121 views
1st parposal presentation.pptx von i238212
1st parposal presentation.pptx1st parposal presentation.pptx
1st parposal presentation.pptx
i2382129 views
PharoJS - Zürich Smalltalk Group Meetup November 2023 von Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi120 views
Business Analyst Series 2023 - Week 3 Session 5 von DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10209 views
From chaos to control: Managing migrations and Microsoft 365 with ShareGate! von sammart93
From chaos to control: Managing migrations and Microsoft 365 with ShareGate!From chaos to control: Managing migrations and Microsoft 365 with ShareGate!
From chaos to control: Managing migrations and Microsoft 365 with ShareGate!
sammart939 views
Perth MeetUp November 2023 von Michael Price
Perth MeetUp November 2023 Perth MeetUp November 2023
Perth MeetUp November 2023
Michael Price15 views
DALI Basics Course 2023 von Ivory Egg
DALI Basics Course  2023DALI Basics Course  2023
DALI Basics Course 2023
Ivory Egg14 views
Unit 1_Lecture 2_Physical Design of IoT.pdf von StephenTec
Unit 1_Lecture 2_Physical Design of IoT.pdfUnit 1_Lecture 2_Physical Design of IoT.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdf
StephenTec11 views
Spesifikasi Lengkap ASUS Vivobook Go 14 von Dot Semarang
Spesifikasi Lengkap ASUS Vivobook Go 14Spesifikasi Lengkap ASUS Vivobook Go 14
Spesifikasi Lengkap ASUS Vivobook Go 14
Dot Semarang35 views
Attacking IoT Devices from a Web Perspective - Linux Day von Simone Onofri
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day
Simone Onofri15 views
Case Study Copenhagen Energy and Business Central.pdf von Aitana
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdf
Aitana12 views
HTTP headers that make your website go faster - devs.gent November 2023 von Thijs Feryn
HTTP headers that make your website go faster - devs.gent November 2023HTTP headers that make your website go faster - devs.gent November 2023
HTTP headers that make your website go faster - devs.gent November 2023
Thijs Feryn19 views

ARM uVisor Debug Refinement Project(debugging facility improvements)

  • 1. ARM uVisor Debug Refinement Project STUDENTS’ INFORMATION TECHNOLOGY CONFERENCE 2016,TAIWAN 張家榮 Jared jaredcjr.tw@gmail.com National Cheng Kung University Department of Engineering Science
  • 2. • A university student wants to have a representative work before graduating. • I used to develop embedded applications. (Once won the championship in the Realtek Semiconductor Ameba IOT competition) • Try to know more about system software. • Then…I found jserv… Who and Why?
  • 3. Before knowing uVisor, we need to know mbed OS source:http://www.slideshare.net/FoolsDelight/resilient-iot-security-the-end-of-flat-security-models The green block used for controlling hardware for security is where we will discuss in this slide.
  • 4. Security Issue • mbed OS allows user to develop applications over web • Developer may read or write memory over its address space mindlessly. • Some tricky bug is hard to find. • IOT devices expose to Network/public • Attack through I/O • Cortex-M is Memory-mapped I/O • All configurations , including read and write through I/O are Memory issues. • Ex. USART1_DR = 0x40011000 in STM32F429i • All data go through USART1 need to access this address. photo source:http://www.slideshare.net/FoolsDelight/resilient-iot-security-the-end-of-flat-security-models
  • 5. uVisor Design Philosophy • Many IoT security problems can be solved with standarized building blocks • HARDWARE-ENFORCED COMPARTMENTS (SANDBOXES) • For individual code blocks by limiting access to memories and peripherals using the existing hardware security features of the Cortex-M microcontrollers. • ARM CORTEX-M MPU • Sets up a hardware protected environment by using a Memory Protection Unit • ALLOWS INTERACTION FROM THE UNPRIVILEGED CODE BY EXPOSING SVCALL- BASED APIS. photo reference:http://www.idea-sandbox.com/assets/images/sandbox_graphic_baby_blue.png
  • 6. SandBox v.s. MPU • MPU IN ARM V7-CORTEX-M • Set Memory regions • Minimum size: 32 bytes • Maximum size: 4GB • Set as XN • XN=Execute Never • cause MemManage Fault • Read/Write • Privileged/Unprivileged • Read Only • Read/Write • No access • Denying access cause MemManage Fault • Accessing MPU relative registers in unprivileged mode cause Bus Fault. reference:https://github.com/ARMmbed/uvisor
  • 7. HOW TO PROTECT? reference: http://www.slideshare.net/vh21/introductiontombedosuvisor?related=1 uVisor SPIUSARTFLASHRAM BOX 2BOX 1 • ACCESS CONTROL LISTS(ACLS) • Each color represents for one “user” • Each of them can only access its “belonings” • Otherwise,the MPU will cause it to get into “MemManage Fault”
  • 8. SECURE GATEWAY for communication between boxes uVisor BOX 1 secure_gateway(func,args) BOX 2 func() SVC SVC return unprivileged privileged reference: http://www.slideshare.net/vh21/introductiontombedosuvisor?related=1
  • 9. Current debugging • LED PATTERN • Hard to know what caused this issue. • May difficult to reappear the condition. • SEMI-HOST • Based on SVC • Output/Input through GDB • ON-CHIP DEBUGGER • ST-LINK/J-Link • wired Error reason RED LED blinks PERMISSION_DENIED 1 SANITY_CHECK_FAILED 2 NOT_IMPLEMENTED 3 NOT_ALLOWED 4 FAULT_MEMMANAGE 5 FAULT_BUS 6 FAULT_USAGE 7 FAULT_HARD 8 FAULT_DEBUG 9
  • 10. (gdb) b main.cpp:44 Breakpoint 1 at 0x8000a5e: file main.cpp, line 44. (gdb) where #0 us_ticker_read () at ../../external/mbed/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4/us_ticker.c:50 #1 0x0800379e in wait_us (us=500000) at ../../external/mbed/libraries/mbed/common/wait_api.c:29 #2 0x08003766 in wait (s=0.5) at ../../external/mbed/libraries/mbed/common/wait_api.c:20 #3 0x08000a5e in main () at main.cpp:43 (gdb) c Continuing. Breakpoint 1, main () at main.cpp:44 44 myled = 0; (gdb) p/x i $1 = 0x1 GDB • WITH GNU DEBUGGER,YOU CAN… Look up Memory registers … Control execution Singel Step Single Instruction Breakpoint Watchpoint …
  • 11. How to improve it? • CRASHDEBUG • Tool to enable post-mortem debugging of Cortex-M crashes with GDB. • CRASHCATCHER • Catch Hard Faults on Cortex-M devices and save out a crash dump to be used by CrashDebug. • MRI(MONITOR FOR REMOTE INSPECTION) • The gdb compatible debug monitor for Cortex-M devices. • Running over any of the UART ports on the device. • Get rid of On-Chip debugger. • Wireless debug at any time and any where. photo reference:http://shop.myavr.com/pic/articles/STM32F429-disco_g.png Reference hardware: STM32F429i-Discovery
  • 12. CrashCatcher • SAVE THE MEMORY CONTENT IN THE HARDFAULT_HANDLER • Used by GDB+CrashDebug • Send the content to remote host or save in the local flash memory. • THE FORMAT MUST BE READABLE BY GDB WITH CRASHDEBUG • Little-Edian • registers content • StartAddress-EndAddress • Content 63430200 00000000 740200200000000000ED00E000000000 00000000000000000000000000000000 00000000000000000000000000000000 02000000 D0FF0220 950A0008A80B000800000021 03000020 0000002000C00120 00000320A15D0008ED5D0008FD0C0008 2B1F00082D1F00082F1F000800000000 000000000000000000000000ED5D0008 331F000800000000ED5D0008ED5D0008 ED5D0008ED5D0008ED5D0008ED5D0008 ED5D0008ED5D0008ED5D0008ED5D0008 ED5D0008ED5D0008ED5D0008ED5D0008 ... Original Project Developer : Adam Green(http://mbed.org/users/AdamGreen/) Reference hardware: STM32F429i-Discovery
  • 13. (gdb) c Continuing. Can't send signals to this remote system. SIGSEGV not sent. **Hard Fault** Status Register: 0x40000000 Forced **Usage Fault** Status Register: 0x08 Coprocessor Access Program received signal SIGSEGV, Segmentation fault. 0x08000ba8 in dbg_vprintf (fmt=0x8000a3f <dbg_put_dec(uint32_t, int, char)+102> "", va=...) at MyImplementationIO/usart:535 CrashDebug • POST-MORTEM DEBUG • With the crashed dump memory content,we can • Let the GDB view it as an alive target. • Use GDB commands. • Seeing the critical variable value. • View the location that causing the situation. • backtrace • HELP US TO KNOW WHAT HAPPENED. Original Project Developer : Adam Green(http://mbed.org/users/AdamGreen/) Reference hardware: STM32F429i-Discovery
  • 14. Monitor for Remote Inspection (MRI) • ALLOWING TO USE GDB REMOTE DEBUGGING THROUGH ANY COMMUNICATION METHOD(WIRELESS IS POSSIBLE) • Replace On-Chip debugger • Currently support USART in STM32F429i-Discovery Cortex-M4 devices. • GDB REMOTE SERIAL PROTOCOL • Communicating with host GDB. • Get commands by modifying USART handler. • According to the commands sent from host GDB • MRI sets the debug monitor in Cortex-M devices. • DEBUG MONITOR • One of the two debugging methods in Cortex-M devices. • Halt mode • debug monitor • Based on exception handler photo reference:https://www.segger.com/cms/admin/uploads/imageBox/J-Link-PRO_left_shadow_350x.jpg Original Project Developer : Adam Green(http://mbed.org/users/AdamGreen/) Reference hardware: STM32F429i-Discovery
  • 15. Ad-Hoc Debugging future framework between debugger and debuggee Reference hardware: STM32F429i-Discovery dashed line represents for any communication way,such as USART or Bluetooth. Debug Box CrashCatcher MRI System 1 remote GDB System 2 Save CrashCatcher dump GDB with CrashDebug uVisor Application BOX(s) with access permission in the ACLs of the Debug Box
  • 16. Q&A
  • 17. THANKS FOR LISTENING! Especially thanks for (The order does not represent for any significance) jserv jserv.tw@gmail.com George Kang georgekang03@gmail.com Adam Green http://mbed.org/users/AdamGreen/ Milosch Meriac https://meriac.com/