提交 0a0b9873 编写于 作者: J Jann Horn 提交者: Linus Torvalds

compat: fix 4-byte infoleak via uninitialized struct field

Commit 3a4d44b6 ("ntp: Move adjtimex related compat syscalls to
native counterparts") removed the memset() in compat_get_timex().  Since
then, the compat adjtimex syscall can invoke do_adjtimex() with an
uninitialized ->tai.

If do_adjtimex() doesn't write to ->tai (e.g.  because the arguments are
invalid), compat_put_timex() then copies the uninitialized ->tai field
to userspace.

Fix it by adding the memset() back.

Fixes: 3a4d44b6 ("ntp: Move adjtimex related compat syscalls to native counterparts")
Signed-off-by: NJann Horn <jannh@google.com>
Acked-by: NKees Cook <keescook@chromium.org>
Acked-by: NAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 94d7dbf1
...@@ -34,6 +34,7 @@ int compat_get_timex(struct timex *txc, const struct compat_timex __user *utp) ...@@ -34,6 +34,7 @@ int compat_get_timex(struct timex *txc, const struct compat_timex __user *utp)
{ {
struct compat_timex tx32; struct compat_timex tx32;
memset(txc, 0, sizeof(struct timex));
if (copy_from_user(&tx32, utp, sizeof(struct compat_timex))) if (copy_from_user(&tx32, utp, sizeof(struct compat_timex)))
return -EFAULT; return -EFAULT;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册