Skip to content

Commit 63cb1fd

Browse files
committed
Intercept "legacy" open syscall as well
1 parent bc0c754 commit 63cb1fd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pmd-scm/src/main/resources/net/sourceforge/pmd/scm/invariants/forksrv-preload.c

+11-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@
5959
#define MAX_INPUTS 1024
6060

6161
// Inspecting 6-args syscalls is not supported
62-
static int inspected_syscalls[] = { SYS_execve, SYS_execveat, SYS_fork, SYS_vfork, SYS_clone, SYS_openat, SYS_stat };
62+
static int inspected_syscalls[] = {
63+
SYS_open, SYS_openat, SYS_stat,
64+
SYS_execve, SYS_execveat,
65+
SYS_fork, SYS_vfork, SYS_clone,
66+
};
6367

6468
struct file_id {
6569
dev_t dev;
@@ -191,6 +195,12 @@ static void handle_sigsys(int num, siginfo_t *si, void *arg)
191195
greg_t *gregs = ctx->uc_mcontext.gregs;
192196
int sc_num = gregs[SC_NUM_REG];
193197
switch (sc_num) {
198+
case SYS_open:
199+
if (is_input_name((const char *) gregs[ARG_REG_1])) {
200+
fprintf(stderr, "Opening %s, starting fork server.\n", (const char *) gregs[ARG_REG_1]);
201+
start_forkserver();
202+
}
203+
break;
194204
case SYS_openat:
195205
if (is_input_name((const char *) gregs[ARG_REG_2])) {
196206
fprintf(stderr, "Opening %s, starting fork server.\n", (const char *) gregs[ARG_REG_2]);

0 commit comments

Comments
 (0)