dump_collector example

This example demonstrates the mechanism for creating a crash dump in a KasperskyOS-based solution.

Example directory in the SDK

The code of the example and build scripts are available at the following path:

/opt/KasperskyOS-Community-Edition-<platform>-<version>/examples/dump_collector

List of programs

When you build an example for the target hardware platform, platform-specific drivers are automatically included in the solution:

Initialization description

The solution initialization description file named init.yaml is generated during the solution build process based on the ./einit/src/init.yaml.in template. Macros in @INIT_*@‌ ‌format contained in the template are automatically expanded in the resulting init.yaml file. For more details, refer to init.yaml.in template.

Security policy description

The security.psl file contains a description of a security policy for a KasperskyOS-based solution and is located in the ./einit/src directory. The declarations in the PSL file are provided with comments that explain the purpose of these declarations.

The solution security policy description in this example allows any interaction between different processes and between processes and the kernel. This policy can be used only as a stub during the early stages of a solution development so that the security module does not interfere with interactions. It would be unacceptable to apply such a policy in a real-world KasperskyOS-based solution.

Resources

The ./resources/xdl/application/Application.edl and ./resources/xdl/launcher/Launcher.edl files are EDL descriptions of programs.

Operating scenario

The Launcher program starts the process named application.Application by using the StartEntity() function from the IApplicationController interface of the Execution Manager component. Using the info input parameter, this function accepts process startup parameters in the StartEntityInfo structure. The mode field of the StartEntityInfo structure is set to Dump:

// Policy for handling abnormal termination of the process:

// CrashMode::None – do not perform any action;

// CrashMode::Dump – create a crash dump;

// CrashMode::Panic – shut down or restart the hardware platform.

info.mode = execution_manager::CrashMode::Dump;

The started process performs actions that lead to its abnormal termination. When the process terminates abnormally, a crash dump is generated automatically. This dump contains diagnostic data such as the stack trace, the state of processor registers, information about threads, and the memory map of the process. The generated crash dump is printed to the console using the LogRR component.

Building and running the example

The CMake system, which is included with KasperskyOS Community Edition, is used to build and run the example.

See Building and running examples section.

Page top