Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

why my hash functions doesnt work or freez in the /sys/kernel/tracing/per_cpu/cpu45 folder?

Im having issue with my script that calulates intergity on this version of ubunutu :

cyber@ubuntu:/$ hostnamectl
   Static hostname: ubuntu
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 48d13c046d74421781e6c6f771f6ac31
           Boot ID: 847b838897ac47eb932f6427361232d1
    Virtualization: vmware
  Operating System: Ubuntu 20.04.4 LTS
            Kernel: Linux 5.13.0-51-generic
      Architecture: x86-64

Im wondering if /sys/kernel/tracing/per_cpu/cpu45 is not by any chance an alive file ?
because calculating the hash of the files inside takes ifinite time.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

If you want to check filesystem integrity, skip the whole /sys folder – it is an interface to the kernel.

Also it would be better if you also skip /proc (also kernel interface) and /dev (special or device files) folders. F.e – you can read from /dev/zero or /dev/urandom forever.

Also your script can freeze on reading pipes – it there is enough permissions it can read from a pipe forever.

If I was building such a script, I’ll start from the mounts, checked their filesystems and scanned only needed ones. For example if a mount is tmpfs – it’s contents is located in RAM and will be wiped after reboot.

And you totally should check it out –
https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading