Installing KSL
This section describes how to install KSL using an RPM package and verify KSL after the installation.
Procedure
- Optional: To prevent buffer overflow attacks, you are advised to enable address space layout randomization (ASLR) before installing KSL.
ASLR randomizes the layout of linear areas such as the heap, stack, and shared library mapping to make it more difficult for attackers to predict target addresses and locate code. This technology can be applied to heaps, stacks, and memory mapping areas (mmap base addresses, shared libraries, and vDSO pages).
echo 2 >/proc/sys/kernel/randomize_va_space
- Obtain the KSL software package by referring to Obtaining the Software Package and decompress it to obtain the binary RPM package.
- Install KSL as the root user.
1rpm -ivh boostkit-ksl-xxxx.aarch64.rpm
After the installation, the system automatically adds the path to the lib folder, that is, /usr/local/ksl/lib, to the environment variable LD_LIBRARY_PATH.
In the preceding command, xxxx indicates the version number.
Verifying the Installation
- Run the source command or log in to the terminal again for the environment variables to take effect.
1source /etc/profile
- Check whether the environment variable LD_LIBRARY_PATH contains the KSL installation path /usr/local/ksl/lib.
1env | grep LD_LIBRARY_PATH
If the command output contains the installation path, the installation is successful.
1LD_LIBRARY_PATH=/usr/local/ksl/lib:
After the installation, the corresponding files are generated in the installation path (the default path is /usr/local/ksl). The include folder contains the header files of the sub-libraries, the lib folder contains the dynamic library files of KSL, and the bin folder contains the compilation tool of KSL_ASN1.
- Add the path of the dynamic library to the GCC compilation option to link the required dynamic library file. After compilation, run the ldd command to check that the dependency library of the program is correctly linked.
The AVX2KI, KQMalloc, HTL, KSL_ASN1, KHSEL, and kpglibc sub-libraries can be selected as required. Before using multiple sub-libraries together, enable each sub-library separately.
- To use AVX2KI, add the following option during compilation:
- For the version automatically adapted to the current server: -I /usr/local/ksl/include -L /usr/local/ksl/lib -lavx2ki
- For the
NEON instruction implemented version: -I /usr/local/ksl/include -L /usr/local/ksl/lib -lavx2neon - For the SVE instruction implemented version (256-bit): -I /usr/local/ksl/include -L /usr/local/ksl/lib -lavx2sve
- For the SVE instruction implemented version (512-bit): -I /usr/local/ksl/include -L /usr/local/ksl/lib -lavx2sve512
- To use KQMalloc, add -I /usr/local/ksl/include -L /usr/local/ksl/lib -lkqmalloc during compilation.
To use the KQMalloc library on openEuler 20.03, add the compilation option -ldl to the application layer.
- To use HTL, add -I /usr/local/ksl/include -L /usr/local/ksl/lib -lhtl during compilation.
- To use KSL_ASN1, add -I /usr/local/ksl/include -L /usr/local/ksl/lib -lhiasn1 during compilation.
The KSL_ASN1 compilation tool hiasn1cli is stored in /usr/local/ksl/bin. You can use it to parse ASN.1 scripts and convert ASN.1 scripts into C intermediate files (containing multiple source files and header files). For details, see Using the Compilation Tool.
- To use kpglibc, add -I /usr/local/ksl/include -L /usr/local/ksl/lib -lkpglibc during compilation.
- To use AVX2KI, add the following option during compilation: