Skip to content

Commit

Permalink
Set open() flags correctly in the loading process.
Browse files Browse the repository at this point in the history
  • Loading branch information
cedric-vincent committed Sep 29, 2014
1 parent 0217d19 commit 8d9816a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/execve/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@
#include <talloc.h> /* talloc*, */
#include <sys/mman.h> /* MAP_*, */
#include <assert.h> /* assert(3), */
#include <sys/types.h> /* kill(2), */
#include <sys/types.h> /* kill(2), O_*, */
#include <signal.h> /* kill(2), */
#include <string.h> /* strerror(3), */
#include <strings.h> /* bzero(3), */
#include <sys/stat.h> /* O_*, */
#include <fcntl.h> /* O_*, */

#include "execve/load.h"
#include "execve/auxv.h"
Expand Down Expand Up @@ -108,12 +110,17 @@ void translate_load_enter(Tracee *tracee)
switch (tracee->loading.step) {
case LOADING_STEP_OPEN:
set_sysnum(tracee, PR_open);

status = set_sysarg_path(tracee, tracee->loading.info->path, SYSARG_1);
if (status < 0) {
notice(tracee, ERROR, INTERNAL, "can't open '%s': %s",
tracee->loading.info->path, strerror(-status));
goto error;
}

poke_reg(tracee, SYSARG_2, O_RDONLY);
poke_reg(tracee, SYSARG_3, 0);

break;

case LOADING_STEP_MMAP:
Expand Down

0 comments on commit 8d9816a

Please sign in to comment.