mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 08:15:07 -04:00
timers/itimer: Zero-init old itimerval before copy to userspace
On native sparc64, struct __kernel_old_timeval contains a four-byte hole after tv_usec because tv_sec is 64-bit while __kernel_suseconds_t is 32-bit. put_itimerval() fills only the named fields in a stack-allocated __kernel_old_itimerval and copies the entire object to userspace, so getitimer() can expose the two padding holes. Zero-initialize the aggregate before assigning the fields so implicit padding is deterministic before it crosses the user/kernel boundary. Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Assisted-by: Codex:gpt-5 Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260809190428.1523014-1-Jeremy.Jean@oss.cyber.gouv.fr
This commit is contained in:
committed by
Thomas Gleixner
parent
b17006b452
commit
18c7d85864
@@ -100,7 +100,7 @@ static int do_getitimer(int which, struct itimerspec64 *value)
|
||||
static int put_itimerval(struct __kernel_old_itimerval __user *o,
|
||||
const struct itimerspec64 *i)
|
||||
{
|
||||
struct __kernel_old_itimerval v;
|
||||
struct __kernel_old_itimerval v = {};
|
||||
|
||||
v.it_interval.tv_sec = i->it_interval.tv_sec;
|
||||
v.it_interval.tv_usec = i->it_interval.tv_nsec / NSEC_PER_USEC;
|
||||
|
||||
Reference in New Issue
Block a user