Files
linux-stable-mirror/include/linux/restart_block.h
Thomas Weißschuh 0f166bf1d6 select: store end_time as timespec64 in restart block
Storing the end time seconds as 'unsigned long' can lead to truncation
on 32-bit architectures if assigned from the 64-bit timespec64::tv_sec.
As the select() core uses timespec64 consistently, also use that in the
restart block.

This also allows the simplification of the accessors.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Link: https://patch.msgid.link/20251223-restart-block-expiration-v2-1-8e33e5df7359@linutronix.de
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
2025-12-24 14:01:57 +01:00

62 lines
1.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* Common syscall restarting data
*/
#ifndef __LINUX_RESTART_BLOCK_H
#define __LINUX_RESTART_BLOCK_H
#include <linux/compiler.h>
#include <linux/time64.h>
#include <linux/types.h>
struct __kernel_timespec;
struct timespec;
struct old_timespec32;
struct pollfd;
enum timespec_type {
TT_NONE = 0,
TT_NATIVE = 1,
TT_COMPAT = 2,
};
/*
* System call restart block.
*/
struct restart_block {
unsigned long arch_data;
long (*fn)(struct restart_block *);
union {
/* For futex_wait() */
struct {
u32 __user *uaddr;
u32 val;
u32 flags;
u32 bitset;
ktime_t time;
u32 __user *uaddr2;
} futex;
/* For nanosleep */
struct {
clockid_t clockid;
enum timespec_type type;
union {
struct __kernel_timespec __user *rmtp;
struct old_timespec32 __user *compat_rmtp;
};
ktime_t expires;
} nanosleep;
/* For poll */
struct {
struct pollfd __user *ufds;
int nfds;
int has_timeout;
struct timespec64 end_time;
} poll;
};
};
extern long do_no_restart_syscall(struct restart_block *parm);
#endif /* __LINUX_RESTART_BLOCK_H */