Skip to content

Validate Memory leaks in Vulnerability Detector after disk errors fix #3977

@Deblintrake09

Description

@Deblintrake09
Target version Related issue Related PR
4.4.1 wazuh/wazuh#16265 wazuh/wazuh#16478

Description

This issue aims to test the fix to a Memory Leak related to VDT in version 4.4.0-1a The leak was detected that when disk errors are caused by some functions, like wm_vuldet_index_feed, the function would not complete and not free the memory that it is using, causing memory to build up until it crashes the wazuh-modulesd daemon.

The Issue was detected in the Stress tests pipeline, and is not easily reproduced manually.

image

Proposed checks

  • Memory leaks in Vulnerability Detector after disk errors

Steps to reproduce

To reproduce the error, disk or database error must be forced, for this, the cve.db file will be installed to a folder in a custom partiton, so that SQL error: 'database or disk is full' error appears

  • Create custom partiton
    $ touch 2gbarea
    $ truncate -s 2Mb 2mbarea
    $ mke2fs -t ext4 -F 2mbarea
    $ mkdir /targetfolder
    $ sudo mount 2gbarea /targetfolder    
    
  • Clone repository
  • Modify the line that configures the location of cve.db to the configured folder
  • Install manager from sources
  • Configure VDT with custom feeds for faster downloads.
  • Stop wazuh-modulesd
  • Execute Valgrind command
    valgrind --track-fds=yes --show-leak-kinds=all --leak-check=full /var/ossec/bin/wazuh-modulesd -ddf
    

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions