Skip to content

Commit

Permalink
Emulate getpgrp if it's blocked by SECCOMP
Browse files Browse the repository at this point in the history
Fixes #14
  • Loading branch information
michalbednarski committed May 1, 2018
1 parent 88b915e commit 793b096
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/tracee/seccomp.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <errno.h> /* E*, */
#include <signal.h> /* SIGSYS, */
#include <unistd.h> /* getpgid, */

#include "cli/note.h"
#include "syscall/chain.h"
Expand Down Expand Up @@ -40,6 +41,15 @@ int handle_seccomp_event(Tracee* tracee) {
signal = 0;
break;

case PR_getpgrp:
/* Query value with getpgid and set it as result. */
poke_reg(tracee, SYSARG_RESULT, getpgid(tracee->pid));
push_specific_regs(tracee, false);

/* Swallow signal */
signal = 0;
break;

case PR_set_robust_list:
default:
/* Set errno to -ENOSYS */
Expand Down

0 comments on commit 793b096

Please sign in to comment.