Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Testing kmemleak tool with kmemleak-test module in rpi3:

Note: kmemleak-test.ko ko  test module for memory leaks ,by default in rpi3 this module not compiled , there is no kmemleak-test.ko module , so enable to build as a module and generated module file.
path of kmemleak-test module source : feature-securestorage-rpi-2Mar/build-raspberrypi-rdk-mc/tmp/work-shared/raspberrypi-rdk-mc/kernel-source/samples/kmemleak/kmemleak-test.c
kmemleak-test.ko

Note: Need to generate kmemleak-test.ko module file from corresponding platform specific kernel source code.

Step 1 : Copy kmemleak-test.ko module to this path /lib/modules/5.10.52-v7/  in box .
Step 2 : load the module to kernel space with insmod command.
Ex:

...


View file
namekmemleak_report_for_kmeleak_test_module.txt
height250
View file
namekmemleak-test.ko
height250

Testing kmemleak tool with testapp in rpi3:

Note :  Here testapp is  FSCRYPT application program, when we run this test app with all functionalities, The corresponding kernel driver will invoke, if any memory leaks present in the kernel driver code will report kernel memory leaks in /sys/kernel/debug/kmemleak

Ex: testapp will support below operations  need to to run all operations to get kmemleaks.
root@raspberrypi-rdk-mc:~# testapp



Note :
In  kmemleak-test module ( kmemleak-test.c) the  kernel memory leaks functionality present in the  kmemleak_test_init function and kmemleak_test_exit function, so memory leaks will be detect when module loaded into kernel space and removed from kernel space, if the memory leaks functionality present in other functions need to run all test functionalities.        FSCRYPT DEMO APP
------------------------------
1:Open session
2:Read data
3:Write data
4:close session
5:Print session info
6:Delete data
7:Exit
------------------------------
Ex: Here memory leaks reported when we run testapp.
From below report we could see kmemleak happened from fscrypt_ioctl_write_data and fscrypt_ioctl_read_data while file_open.
View filenamekmemleak_report_for_testapp.txtheight250

Limitations and Drawbacks

...