mirror of
https://github.com/engineer-man/piston.git
synced 2025-04-20 20:16:26 +02:00
fix forking exploits
This commit is contained in:
parent
6fe0da030d
commit
9a52e369f2
1 changed files with 11 additions and 0 deletions
|
@ -192,6 +192,17 @@ class Job {
|
|||
processes = processes.filter(proc => proc.uid == this.uid);
|
||||
|
||||
for(const proc of processes){
|
||||
// First stop the processes, but keep their resources allocated so they cant re-fork
|
||||
try{
|
||||
process.kill(proc.pid, 'SIGSTOP');
|
||||
}catch{
|
||||
// Could already be dead
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(const proc of processes){
|
||||
// Then clear them out of the process tree
|
||||
try{
|
||||
process.kill(proc.pid, 'SIGKILL');
|
||||
}catch{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue