DOCA App Shield Agent Application Guide
The App Shield Agent uses the DOCA App Shield library to monitor processes running on the host system. This security feature allows for the detection of core process corruption from a trusted, independent DPU, providing an intrusion detection system (IDS) that otherwise cannot be achieved from within the host itself.
The DOCA App Shield library enables the DPU to directly read, analyze, and verify the memory of the host, whether it's a bare metal system or a virtual machine. By using this library, the application calculates cryptographic hashes of non-writable memory pages, including those that are unloaded, for a specific process and its associated libraries. It then periodically re-verifies these pages to identify any unauthorized changes.
After each check, the application outputs a pass or fail attestation result, continuing the process until the first failure is detected. These results are logged to the console and also sent to the DOCA Telemetry Service (DTS) via inter-process communication (IPC).
This guide illustrates how to implement secure process monitoring using the DOCA App Shield library, taking advantage of the BlueField DPU's capabilities, such as hardware-accelerated DMA and root-of-trust integrity enforcement.
The App Shield agent is designed to operate independently on the DPU's Arm core without impacting the host system's performance.
The host's role is minimal and primarily involves configuring the monitoring of a new process when necessary. This configuration includes generating the required ZIP and JSON files, which are then passed to the DPU. This setup is performed at the initial stage, often referred to as "time 0," when the host is still in a "safe" state.
To generate these files, use the doca_apsh_config.py
tool provided by DOCA App Shield. For detailed information, refer to DOCA App Shield.

The user creates three mandatory files using the DOCA tool doca_apsh_config.py
and copies them to the DPU. The application can report attestation results to the:
File
Terminal
DTS

The files are generated by running
doca_apsh_config.py
on the host against the process at time zero.NoteThe actions 2-5 recur at regular time intervals.
The App Shield agent requests new attestation from DOCA App Shield library.
The DOCA App Shield library creates a new attestation:
Scans and hashes process memory pages (that are currently in use).
Compares the hash to the original hash.
Creates attestation for each lib/exe involved in the process. Each of attestation includes the number of valid pages and the number of pages.
The App Shield agent searches each attestation for inconsistency between number of used pages and number of valid pages.
The App Shield agent reports results with a timestamp and scan count to:
Local telemetry files – a folder and files representing the data a real DTS would have received. These files are used for the purposes of this example only as normally this data is not exported into user-readable files.
DOCA log (without scan count).
DTS IPC interface (even if no DTS is active).
The App Shield agent exits on first attestation failure.
This application leverages the following DOCA libraries:
Refer to their respective programming guide for more information.
Please refer to the DOCA Installation Guide for Linux for details on how to install BlueField-related software.
The installation of DOCA's reference applications contains the sources of the applications, alongside the matching compilation instructions. This allows for compiling the applications "as-is" and provides the ability to modify the sources, then compile a new version of the application.
For more information about the applications as well as development and compilation tips, refer to the DOCA Reference Applications page.
The sources of the application can be found under the application's directory: /opt/mellanox/doca/applications/app_shield_agent/
.
Compiling All Applications
All DOCA applications are defined within a single meson project. Therefore, by default, the compilation process includes all of them.
To build all the applications together, run:
cd /opt/mellanox/doca/applications/
meson /tmp/build
ninja -C /tmp/build
doca_app_shield_agent
is created under /tmp/build/app_shield_agent/
.
Compiling Only the Current Application
To build only the App Shield Agent application:
cd /opt/mellanox/doca/applications/
meson /tmp/build -Denable_all_applications=false
-Denable_app_shield_agent=true
ninja -C /tmp/build
doca_app_shield_agent
is created under /tmp/build/app_shield_agent/
.
Alternatively, you can set the flags in the meson_options.txt
file instead of providing them in the compilation command line:
Edit the following flags in
/opt/mellanox/doca/applications/meson_options.txt
:Set
enable_all_applications
tofalse
Set
enable_app_shield_agent
totrue
Run the following compilation commands :
cd /opt/mellanox/doca/applications/ meson /tmp/build ninja -C /tmp/build
Infodoca_app_shield_agent
is created under/tmp/build/app_shield_agent/
.
Prerequisites
Configure the BlueField's firmware.
On the BlueField system, configure the PF base address register and NVMe emulation. Run:
dpu> mlxconfig -d /dev/mst/mt41686_pciconf0 s PF_BAR2_SIZE=
2
PF_BAR2_ENABLE=1
NVME_EMULATION_ENABLE=1
Perform a BlueField system reboot for the
mlxconfig
settings to take effect.You may verify these configurations using the following command:
dpu> mlxconfig -d /dev/mst/mt41686_pciconf0 q | grep -E
"NVME|BAR"
Download target system (host/VM) symbols.
For Ubuntu:
host> sudo tee /etc/apt/sources.list.d/ddebs.list << EOF deb http:
//ddebs.ubuntu.com/ $(lsb_release -cs) main restricted universe multiverse
deb http://ddebs.ubuntu.com/ $(lsb_release -cs)-updates main restricted universe multiverse
deb http://ddebs.ubuntu.com/ $(lsb_release -cs)-proposed main restricted universe multiverse
EOF host> sudo apt install ubuntu-dbgsym-keyring host> sudo apt-get update host> sudo apt-get install linux-image-$(uname -r)-dbgsymFor CentOS:
host> yum install --enablerepo=base-debuginfo kernel-devel-$(uname -r) kernel-debuginfo-$(uname -r) kernel-debuginfo-common-$(uname -m)-$(uname -r)
No action is needed for Windows
Perform IOMMU passthrough. This stage is only necessary if IOMMU is not enabled by default (for example, if the host is using an AMD CPU).
NoteSkip this step if you are not sure whether it is needed. Return to it only if DMA fails with a message similar to the following in
dmesg
:host> dmesg [ 3839.822897] mlx5_core 0000:81:00.0: AMD-Vi: Event logged [IO_PAGE_FAULT domain=0x0047 address=0x2a0aff8 flags=0x0000]
Locate your OS's grub file (most likely
/boot/grub/grub.conf
,/boot/grub2/grub.cfg
, or/etc/default/grub
) and open it for editing. Run:host> vim /etc/
default
/grubSearch for the line defining
GRUB_CMDLINE_LINUX_DEFAULT
and add the argumentiommu=pt
. For example:GRUB_CMDLINE_LINUX_DEFAULT=
"iommu=pt <intel/amd>_iommu=on"
Run:
NotePrior to performing a power cycle, make sure to do a graceful shutdown.
For Ubuntu:
host> sudo update-grub host> ipmitool power cycle
For CentOS:
host> grub2-mkconfig -o /boot/grub2/grub.cfg host> ipmitool power cycle
For Windows targets, turn off Hyper-V capability.
Prepare target:
Install DOCA on the target system.
Create the ZIP and JSON files. Run:
target-system> cd /opt/mellanox/doca/tools/ target-system> python3 doca_apsh_config.py --pid <pid-of-process-to-monitor> --os <windows/linux> --path <path to dwarf2json executable or pdbparse-to-json.py> target-system> cp /opt/mellanox/doca/tools/*.* <shared-folder-with-baremetal> dpu> scp <shared-folder-with-baremetal>/* <path-to-app-shield-binary>
If the target system does not have DOCA installed, the script can be copied from the BlueField.
The required
dwaf2json
andpdbparse-to-json.py
are not provided with DOCA.NoteIf the kernel and process
.exe
have not changed, there no need to redo this step.
Application Execution
The App Shield Agent application is provided in source form, so it needs to be compiled before it can be executed.
Application usage instructions:
Usage: doca_app_shield_agent [DOCA Flags] [Program Flags] DOCA Flags: -h, --help Print a help synopsis -v, --version Print program version information -l, --log-level Set the (numeric) log level
for
the program <10
=DISABLE,20
=CRITICAL,30
=ERROR,40
=WARNING,50
=INFO,60
=DEBUG,70
=TRACE> --sdk-log-level Set the SDK (numeric) log levelfor
the program <10
=DISABLE,20
=CRITICAL,30
=ERROR,40
=WARNING,50
=INFO,60
=DEBUG,70
=TRACE> -j, --json <path> Parse all command flags from an input json file Program Flags: -p, --pid Process ID of process to be attested -e, --ehm <path> Exec hash map path -m, --memr <path> System memory regions map -f, --vuid VUID of the System device -d, --dma DMA device name -o, --osym <path> System OS symbol map path -s, --osty <windows|linux> System OS type - windows/linux -t, --time <seconds> Scan time interval in secondsCLI example for running the application on the BlueField:
./doca_app_shield_agent -p
13577
-e hash.zip -m mem_regions.json -o symbols.json -f MT2125X03335MLNXS0D0F0VF1 -d mlx5_0 -t3
-s linuxNoteAll used identifiers (
-f
,-p
and-d
flags) should match the identifier of the desired devices and processes.
Command Line Flags
Flag Type | Short Flag | Long Flag | Description |
General flags |
|
| Print a help synopsis |
|
| Print program version information | |
|
| Set the log level for the application:
| |
N/A |
| Set the log level for the program:
| |
|
| Parse all command flags from an input JSON file | |
Program flags |
|
| PID of the process to be attested |
|
| Path to the pre-generated | |
|
| Path to the pre-generated | |
|
| System PCIe function vendor unique identifier (VUID) of the VF/PF exposed to the target system. Used for DMA operations. To obtain this argument, run:
Example output:
Two VUIDs are printed for each DPU connected to the target system. The first is of the DPU on pf0 and the second is of the DPU on port Note
Running this command on the DPU outputs VUIDs with an additional "EC" string in the middle. You must remove the "EC" to arrive at the correct VUID.
The VUID of a VF allocated on PF0/1 is the VUID of the PF with an additional suffix, For example, for the output in the example above:
VUIDs are persistent even on reset. | |
|
| DMA device name to use | |
|
| Path to the pre-generated | |
|
| OS type ( | |
|
| Number of seconds to sleep between scans |
Refer to DOCA Arg Parser for more information about supported flags and execution modes.
Troubleshooting
Refer to the DOCA Troubleshooting for any issue encountered with the installation or execution of the DOCA applications.
Parse application argument.
Initialize arg parser resources and register DOCA general parameters.
doca_argp_init();
Register application parameters.
register_apsh_params();
Parse the arguments.
doca_argp_start();
Initialize DOCA App Shield lib context.
Create lib context.
doca_apsh_create();
Set DMA device for lib.
doca_devinfo_list_create(); doca_dev_open(); doca_devinfo_list_destroy(); doca_apsh_dma_dev_set();
Start the context
doca_apsh_start(); apsh_system_init();
Initialize DOCA App Shield lib system context handler.
Get the representor of the remote PCIe function exposed to the system.
doca_devinfo_remote_list_create(); doca_dev_remote_open(); doca_devinfo_remote_list_destroy();
Create and start the system context handler.
doca_apsh_system_create(); doca_apsh_sys_os_symbol_map_set(); doca_apsh_sys_mem_region_set(); doca_apsh_sys_dev_set(); doca_apsh_sys_os_type_set(); doca_apsh_system_start();
Find target process by
pid
.doca_apsh_processes_get();
Telemetry initialization.
telemetry_start();
Initialize a new telemetry schema.
Register attestation type event.
Set up output to file (in addition to default IPC).
Start the telemetry schema.
Initialize and start a new DTS source with the
gethostname()
name as source ID.
Get initial attestation of the process.
doca_apsh_attestation_get();
Loop until attestation validation fail.
doca_apsh_attst_refresh();
/* validation logic */
doca_telemetry_exporter_source_report(); DOCA_LOG_INFO(); sleep();DOCA App Shield Agent destroy.
doca_apsh_attestation_free(); doca_apsh_processes_free(); doca_apsh_system_destroy(); doca_apsh_destroy(); doca_dev_close(); doca_dev_remote_close();
Telemetry destroy.
telemetry_destroy();
Arg parser destroy.
doca_argp_destroy();
/opt/mellanox/doca/applications/app_shield_agent/