Skip to content

Commit

Permalink
Change TCSAFLUSH flag to TCSANOW
Browse files Browse the repository at this point in the history
  • Loading branch information
michalbednarski committed Dec 28, 2019
1 parent 8950c03 commit 1f4ec1c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/syscall/enter.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <limits.h> /* PATH_MAX, */
#include <string.h> /* strcpy */
#include <sys/prctl.h> /* PR_SET_DUMPABLE */
#include <termios.h> /* TCSETS, TCSANOW */

#include "syscall/syscall.h"
#include "syscall/sysnum.h"
Expand Down Expand Up @@ -576,6 +577,15 @@ int translate_syscall_enter(Tracee *tracee)
status = 0;
}
break;

#ifdef __ANDROID__
case PR_ioctl:
/* Using literal value because Termux build system patches TCSAFLUSH */
if (peek_reg(tracee, CURRENT, SYSARG_2) == TCSETS + 2 /* + TCSAFLUSH */) {
poke_reg(tracee, SYSARG_2, TCSETS + TCSANOW);
}
break;
#endif
}

end:
Expand Down
3 changes: 3 additions & 0 deletions src/syscall/seccomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ static FilteredSysnum proot_sysnums[] = {
{ PR_getsockname, FILTER_SYSEXIT },
{ PR_getxattr, 0 },
{ PR_inotify_add_watch, 0 },
#ifdef __ANDROID__
{ PR_ioctl, 0 },
#endif
{ PR_lchown, 0 },
{ PR_lchown32, 0 },
{ PR_lgetxattr, 0 },
Expand Down

0 comments on commit 1f4ec1c

Please sign in to comment.