NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/58914: timerfd_settime(2) is missing itimespecfix
The following reply was made to PR kern/58914; it has been noted by GNATS.
From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: Thomas Klausner <wiz%NetBSD.org@localhost>
Cc: gnats-bugs%NetBSD.org@localhost, netbsd-bugs%NetBSD.org@localhost
Subject: Re: kern/58914: timerfd_settime(2) is missing itimespecfix
Date: Wed, 18 Dec 2024 07:23:08 +0000
This is a multi-part message in MIME format.
--=_doTlMKKkYbLBtme6fab/51tYZGWhbizH
Can you please try the attached patch?
--=_doTlMKKkYbLBtme6fab/51tYZGWhbizH
Content-Type: text/plain; charset="ISO-8859-1"; name="pr58914-timerfdfix"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="pr58914-timerfdfix.patch"
# HG changeset patch
# User Taylor R Campbell <riastradh%NetBSD.org@localhost>
# Date 1734506499 0
# Wed Dec 18 07:21:39 2024 +0000
# Branch trunk
# Node ID e050d078726dabe394b8accea318c2caf71ef290
# Parent fdd2a8b62ce7ef83fb5433dbfd053c271728d8a2
# EXP-Topic riastradh-pr58914-timerfdfix
timerfd_settime(2): Sanitize inputs like timer_settime(2).
PR kern/58914: timerfd_settime(2) is missing itimespecfix
diff -r fdd2a8b62ce7 -r e050d078726d sys/kern/sys_timerfd.c
--- a/sys/kern/sys_timerfd.c Tue Dec 17 12:44:33 2024 +0000
+++ b/sys/kern/sys_timerfd.c Wed Dec 18 07:21:39 2024 +0000
@@ -593,12 +593,16 @@ do_timerfd_settime(struct lwp *l, int fd
const struct itimerspec *new_value, struct itimerspec *old_value,
register_t *retval)
{
+ struct itimerspec value =3D *new_value;
file_t *fp;
int error;
=20
if (flags & ~(TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET)) {
return EINVAL;
}
+ if ((error =3D itimespecfix(&value.it_value)) !=3D 0 ||
+ (error =3D itimespecfix(&value.it_interval)) !=3D 0)
+ return error;
=20
if ((fp =3D fd_getfile(fd)) =3D=3D NULL) {
return EBADF;
@@ -618,7 +622,7 @@ do_timerfd_settime(struct lwp *l, int fd
if (old_value !=3D NULL) {
*old_value =3D it->it_time;
}
- it->it_time =3D *new_value;
+ it->it_time =3D value;
=20
/*
* If we've been passed a relative value, convert it to an
--=_doTlMKKkYbLBtme6fab/51tYZGWhbizH--
Home |
Main Index |
Thread Index |
Old Index