VirusTotal / yara

The pattern matching swiss knife
https://virustotal.github.io/yara/
BSD 3-Clause "New" or "Revised" License
7.95k stars 1.42k forks source link

fix process scanning on linux 32bits without LFS #2005

Closed vthib closed 7 months ago

vthib commented 7 months ago

The commit dfd6f7b5f brought large file detection in the autoconf file to fix process scanning on linux in x86 architecture. This is however a bit flaky, because:

This breaks process scanning because without it, the pread function on the mem file will fail if provided with an offset bigger than INT32_MAX, which will always happen for processes.

A better fix is to use the pread64 syscall, which always takes a 64-bits value for the offset. This is the actual linux syscall, so it is completely safe.

See for example the exact same fix on chromium:

https://groups.google.com/a/chromium.org/g/crashpad-dev/c/IJLo8M2AQs0/m/Edyyau2LAwAJ