summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeilin Ye <yepeilin.cs@gmail.com>2020-08-01 11:20:44 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-12-21 13:27:03 +0100
commit8b4f08f280154147b20437d14644804223bfbdcb (patch)
treeec7f60431c04cfa04a2c68a3bb51e935e7011314
parent8a866bdbbac227a99b0b37e03679908642f58aec (diff)
downloadlinux-stable-8b4f08f280154147b20437d14644804223bfbdcb.tar.gz
linux-stable-8b4f08f280154147b20437d14644804223bfbdcb.tar.bz2
linux-stable-8b4f08f280154147b20437d14644804223bfbdcb.zip
ptrace: Prevent kernel-infoleak in ptrace_get_syscall_info()
commit 0032ce0f85a269a006e91277be5fdbc05fad8426 upstream. ptrace_get_syscall_info() is potentially copying uninitialized stack memory to userspace, since the compiler may leave a 3-byte hole near the beginning of `info`. Fix it by adding a padding field to `struct ptrace_syscall_info`. Fixes: 201766a20e30 ("ptrace: add PTRACE_GET_SYSCALL_INFO request") Suggested-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com> Reviewed-by: Dmitry V. Levin <ldv@altlinux.org> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20200801152044.230416-1-yepeilin.cs@gmail.com Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--include/uapi/linux/ptrace.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/uapi/linux/ptrace.h b/include/uapi/linux/ptrace.h
index a71b6e3b03eb..83ee45fa634b 100644
--- a/include/uapi/linux/ptrace.h
+++ b/include/uapi/linux/ptrace.h
@@ -81,7 +81,8 @@ struct seccomp_metadata {
struct ptrace_syscall_info {
__u8 op; /* PTRACE_SYSCALL_INFO_* */
- __u32 arch __attribute__((__aligned__(sizeof(__u32))));
+ __u8 pad[3];
+ __u32 arch;
__u64 instruction_pointer;
__u64 stack_pointer;
union {