diff --git a/sys/vfs/procfs/procfs_fpregs.c b/sys/vfs/procfs/procfs_fpregs.c --- a/sys/vfs/procfs/procfs_fpregs.c +++ b/sys/vfs/procfs/procfs_fpregs.c @@ -37,6 +37,7 @@ */ #include +#include #include #include #include @@ -53,6 +54,14 @@ int error; struct fpreg r; + /* + * Zero-initialize so that the regions of struct fpreg not populated + * by fill_fpregs (sv_pad0/sv_pad in the save87 overlay, plus the + * entire fpr_xacc+fpr_spare tail on the cpu_fxsr path) cannot leak + * stale kernel-stack bytes to userspace via uiomove_frombuf below. + */ + bzero(&r, sizeof(r)); + /* Can't trace a process that's currently exec'ing. */ if ((p->p_flags & P_INEXEC) != 0) return EAGAIN;