Las "bombas fork" en Linux pueden ser limitadas con el fichero /etc/security/limits.conf
#Following will prevent a “fork bomb”:
alex hard nproc 300
@student hard nproc 50
@faculty soft nproc 100
@pusers hard nproc 200
De hecho puedes limitar muchas más cosas, procesos, memoria, ficheros abiertos,
<value> can be one of the following:
core – limits the core file size (KB)
data – max data size (KB)
fsize – maximum filesize (KB)
memlock – max locked-in-memory address space (KB)
nofile – max number of open files
rss – max resident set size (KB)
stack – max stack size (KB)
cpu – max CPU time (MIN)
nproc – max number of processes
as – address space limit
maxlogins – max number of logins for this user
maxsyslogins – max number of logins on the system
priority – the priority to run user process with
locks – max number of file locks the user can hold
sigpending – max number of pending signals
msgqueue – max memory used by POSIX message queues (bytes)
nice – max nice priority allowed to raise to
rtprio – max realtime priority
chroot – change root to directory (Debian-specific)
Warning: This will have no effect on the root user or any process with the CAP_SYS_ADMIN or CAP_SYS_RESOURCE capabilities are not affected by this kind of limitation on a Linux based system.
De hecho por ejemplo con MySQL (MariaDB) en la documentación oficial se recomienda en vez de reducir, aumentar varios valores
https://mariadb.com/kb/en/configuring-linux-for-mariadb//etc/security/limits.conf:
mysql soft nofile 65535
mysql hard nofile 65535
mysql soft core unlimited
mysql hard core unlimited
Pero lo que te comenta Buster_BSA es más sensato, si vas ejecutar un software que no sabe lo que hace y no sabes analizarlo previamente, mejor usar una máquina virtual o un entorno controlado como sandbox
Incluso Windows 10 trae por defecto un Windows 10 sandbox por defecto (Espacio aislado de Windows)
