Skip to content

Commit 8325a08

Browse files
committed
feat: security: Add docs explaining Firewall Exceptions
Add a document to explain when a firewall exception occurs and how to trigger it on purpose, and how to interpret it. Signed-off-by: Suhaas Joshi <s-joshi@ti.com>
1 parent 90f8bce commit 8325a08

8 files changed

Lines changed: 124 additions & 0 deletions

File tree

configs/AM62AX/AM62AX_linux_toc.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ linux/Foundational_Components/Power_Management/pm_debug
9797
linux/Foundational_Components/System_Security/Security_overview
9898
linux/Foundational_Components/System_Security/SELinux
9999
linux/Foundational_Components/System_Security/Auth_boot
100+
linux/Foundational_Components/System_Security/Firewall_Exception
100101

101102
linux/Foundational_Components_Kernel_Users_Guide
102103
linux/Foundational_Components_Kernel_LTP-DDT_Validation

configs/AM62LX/AM62LX_linux_toc.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ linux/Foundational_Components/Power_Management/pm_am62lx_debug
8383
linux/Foundational_Components/System_Security/Security_overview
8484
#linux/Foundational_Components/System_Security/SELinux
8585
linux/Foundational_Components/System_Security/Auth_boot
86+
linux/Foundational_Components/System_Security/Firewall_Exception
8687

8788
linux/Foundational_Components_Kernel_Users_Guide
8889
linux/Foundational_Components_Kernel_LTP-DDT_Validation

configs/AM62PX/AM62PX_linux_toc.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ linux/Foundational_Components/Power_Management/pm_debug
102102
linux/Foundational_Components/System_Security/Security_overview
103103
linux/Foundational_Components/System_Security/SELinux
104104
linux/Foundational_Components/System_Security/Auth_boot
105+
linux/Foundational_Components/System_Security/Firewall_Exception
105106

106107
linux/Foundational_Components_Kernel_Users_Guide
107108
linux/Foundational_Components_Kernel_LTP-DDT_Validation

configs/AM62X/AM62X_linux_toc.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ linux/Foundational_Components/Power_Management/pm_debug
9999
linux/Foundational_Components/System_Security/Security_overview
100100
linux/Foundational_Components/System_Security/SELinux
101101
linux/Foundational_Components/System_Security/Auth_boot
102+
linux/Foundational_Components/System_Security/Firewall_Exception
102103

103104
linux/Foundational_Components_PRU_Subsystem
104105
linux/Foundational_Components/PRU-ICSS-Linux-Drivers

configs/AM64X/AM64X_linux_toc.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ linux/Foundational_Components_Kernel_LTP-DDT_Validation
8484
linux/Foundational_Components_Kernel_FAQs
8585
linux/Foundational_Components_Security
8686
linux/Foundational_Components/System_Security/Security_overview
87+
linux/Foundational_Components/System_Security/Firewall_Exception
8788
linux/Foundational_Components_Machine_Learning
8889
linux/Foundational_Components/Machine_Learning/arm_compute_library
8990
linux/Foundational_Components/Machine_Learning/armnn
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
.. _firewall-exception:
2+
3+
******************
4+
Firewall Exception
5+
******************
6+
7+
Overview
8+
========
9+
10+
TI MPUs use hardware-backed firewalls to enforce access control. TIFS
11+
configures these firewalls to restrict which components can access
12+
specific regions of device-mapped memory. Other components such as
13+
OP-TEE, ATF, Linux, U-Boot, and userspace programs can request TIFS to
14+
configure firewalls on their behalf.
15+
16+
Firewalls can restrict access based on:
17+
18+
* **Core**: A53, R5, M4, etc.
19+
* **Privilege level**: privileged or non-privileged
20+
* **Security state**: secure or non-secure
21+
22+
For example, TIFS might configure a firewall to prevent Linux (running
23+
on A53) from accessing a memory region reserved for the secure world.
24+
25+
For more information about firewalls, see the Technical Reference
26+
Manual (TRM) for the specific SoC, the
27+
`TISCI Firewall API <https://software-dl.ti.com/tisci/esd/latest/2_tisci_msgs/security/firewall_api.html>`__,
28+
and the
29+
`TIFS Firewall FAQ <https://software-dl.ti.com/tisci/esd/latest/6_topic_user_guides/firewall_faq.html>`__.
30+
31+
What Happens During a Firewall Violation
32+
========================================
33+
34+
When software attempts an unauthorized access to a memory region that
35+
a firewall protects, the firewall blocks the access and triggers an
36+
exception. The outcome depends on the type of access:
37+
38+
* **Read access**: The firewall blocks the read. The system continues
39+
running.
40+
* **Write access**: The firewall blocks the write and crashes the
41+
Linux kernel. The system halts.
42+
43+
The kernel crash on write violations stops the offending software
44+
immediately, preventing further unauthorized access attempts.
45+
46+
TIFS logs information about every firewall exception. The rest of this
47+
document explains how to trigger exceptions, enable TIFS logs, access
48+
them, and interpret them.
49+
50+
Triggering a Firewall Exception
51+
===============================
52+
53+
To test firewall behavior, use ``k3conf`` to read from or write to a
54+
protected memory region.
55+
56+
Triggering a read exception:
57+
58+
.. code-block:: console
59+
60+
k3conf read <addr> [<size>]
61+
62+
Triggering a write exception (this will crash the kernel):
63+
64+
.. code-block:: console
65+
66+
k3conf write <addr> <value>
67+
68+
Replace ``<addr>`` with the address of a firewall-protected region,
69+
``<size>`` with the number of bytes to read, and ``<value>`` with the
70+
value to write.
71+
72+
Enabling TIFS Logs
73+
==================
74+
75+
TIFS does not output logs by default. Enabling TIFS logging requires
76+
modifying U-Boot source code, recompiling it, and transferring the new
77+
binaries to the boot partition.
78+
79+
Modify U-Boot Configuration
80+
---------------------------
81+
82+
Open :file:`board/ti/<soc_name>/board-cfg.yaml` in the U-Boot source
83+
tree. Locate ``trace_dst_enables`` and ``trace_src_enables``, which
84+
U-Boot sets to ``0x0`` by default. Change these values as follows:
85+
86+
* ``trace_dst_enables``: change from ``0x0`` to ``0xD``
87+
* ``trace_src_enables``: change from ``0x0`` to ``0x3F``
88+
89+
Build and Deploy U-Boot
90+
-----------------------
91+
92+
After making these changes, compile U-Boot and transfer the resulting
93+
binaries to the board's boot partition. See
94+
:ref:`u-boot-build-guide-build-k3` for build instructions.
95+
96+
Accessing TIFS Logs
97+
===================
98+
99+
TIFS outputs logs to a separate serial port from the Linux console.
100+
If the Linux command line appears on :file:`/dev/ttyUSB0`, TIFS logs
101+
typically appear on :file:`/dev/ttyUSB1`. However, the exact device
102+
assignment depends on the hardware setup and the order in which the
103+
host enumerates USB devices.
104+
105+
Open the TIFS serial port with a terminal program such as minicom or
106+
PuTTY to view the logs.
107+
108+
Interpreting TIFS Logs
109+
======================
110+
111+
For information on interpreting firewall exception logs, see the
112+
`TIFS Firewall FAQ <https://software-dl.ti.com/tisci/esd/latest/6_topic_user_guides/firewall_faq.html#how-do-i-debug-firewall-issues>`__.

source/linux/Foundational_Components/System_Security/Security_overview.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ The following table lists some of the key Security Features:
6161
| | Trusted Execution Environment that enables isolated | :ref:`foundational-components-optee` |
6262
| | execution of security-sensitive applications and services | |
6363
+-------------------------+-----------------------------------------------------------+--------------------------------------+
64+
| **Firewall Exception** | Debugging hardware firewall violations | :ref:`firewall-exception` |
65+
+-------------------------+-----------------------------------------------------------+--------------------------------------+
6466

6567
.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62PX', 'AM62AX')
6668

@@ -83,6 +85,8 @@ The following table lists some of the key Security Features:
8385
| | Trusted Execution Environment that enables isolated | :ref:`foundational-components-optee` |
8486
| | execution of security-sensitive applications and services | |
8587
+-------------------------+-----------------------------------------------------------+--------------------------------------+
88+
| **Firewall Exception** | Debugging hardware firewall violations | :ref:`firewall-exception` |
89+
+-------------------------+-----------------------------------------------------------+--------------------------------------+
8690

8791
.. ifconfig:: CONFIG_part_variant not in ('AM62X', 'AM62PX', 'AM62AX', 'AM62LX')
8892

@@ -99,4 +103,6 @@ The following table lists some of the key Security Features:
99103
| | Trusted Execution Environment that enables isolated | :ref:`foundational-components-optee` |
100104
| | execution of security-sensitive applications and services | |
101105
+-------------------------+-----------------------------------------------------------+--------------------------------------+
106+
| **Firewall Exception** | Debugging hardware firewall violations | :ref:`firewall-exception` |
107+
+-------------------------+-----------------------------------------------------------+--------------------------------------+
102108

source/linux/Foundational_Components_Security.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ Security
1212
Foundational_Components_Secure_Boot
1313
Foundational_Components/System_Security/SELinux
1414
Foundational_Components/System_Security/Auth_boot
15+
Foundational_Components/System_Security/Firewall_Exception

0 commit comments

Comments
 (0)