Skip to content

Commit

Permalink
Merge branch 'waitid-fix'
Browse files Browse the repository at this point in the history
Merge waitid() fix from Kees Cook.

I'd have hoped that the unsafe_{get|put}_user() naming would have
avoided these kinds of stupid bugs, but no such luck.

* waitid-fix:
  waitid(): Add missing access_ok() checks
  • Loading branch information
Linus Torvalds committed Oct 12, 2017
2 parents ff5abbe + 96ca579 commit 467251c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1610,6 +1610,9 @@ SYSCALL_DEFINE5(waitid, int, which, pid_t, upid, struct siginfo __user *,
if (!infop)
return err;

if (!access_ok(VERIFY_WRITE, infop, sizeof(*infop)))
goto Efault;

user_access_begin();
unsafe_put_user(signo, &infop->si_signo, Efault);
unsafe_put_user(0, &infop->si_errno, Efault);
Expand Down Expand Up @@ -1735,6 +1738,9 @@ COMPAT_SYSCALL_DEFINE5(waitid,
if (!infop)
return err;

if (!access_ok(VERIFY_WRITE, infop, sizeof(*infop)))
goto Efault;

user_access_begin();
unsafe_put_user(signo, &infop->si_signo, Efault);
unsafe_put_user(0, &infop->si_errno, Efault);
Expand Down

0 comments on commit 467251c

Please sign in to comment.