Skip to content

Commit

Permalink
Add -execve argument pass to qemu
Browse files Browse the repository at this point in the history
  • Loading branch information
forumi0721 authored and petrosagg committed Aug 13, 2018
1 parent f11ec19 commit 552e483
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions linux-user/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -8076,6 +8076,9 @@ static abi_long qemu_execve(char *filename, char *argv[],
}
}

/* Need to store execve argument */
offset++;

new_argp = alloca((argc + offset + 1) * sizeof(void *));

/* Copy the original arguments with offset */
Expand All @@ -8084,19 +8087,20 @@ static abi_long qemu_execve(char *filename, char *argv[],
}

new_argp[0] = strdup(qemu_execve_path);
new_argp[1] = strdup("-0");
new_argp[1] = strdup("-execve"); /* Add execve argument */
new_argp[2] = strdup("-0");
new_argp[offset] = filename;
new_argp[argc + offset] = NULL;

if (i_name) {
new_argp[2] = i_name;
new_argp[3] = i_name;
new_argp[4] = i_name;

if (i_arg) {
new_argp[4] = i_arg;
new_argp[5] = i_arg;
}
} else {
new_argp[2] = argv[0];
new_argp[3] = argv[0];
}
}

Expand Down

0 comments on commit 552e483

Please sign in to comment.