[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6c2151b5d9b07c7cc29cd484a80d0db213e5fa19.camel@codethink.co.uk>
Date: Wed, 08 Jan 2020 01:16:09 +0000
From: Ben Hutchings <ben.hutchings@...ethink.co.uk>
To: Arnd Bergmann <arnd@...db.de>, y2038@...ts.linaro.org,
linux-kernel@...r.kernel.org, Lucas Stach <l.stach@...gutronix.de>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>
Cc: Guido Günther <agx@...xcpu.org>,
etnaviv@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
Christian Gmeiner <christian.gmeiner@...il.com>,
Philipp Zabel <p.zabel@...gutronix.de>,
Russell King <linux+etnaviv@...linux.org.uk>,
Sam Ravnborg <sam@...nborg.org>,
Emil Velikov <emil.velikov@...labora.com>
Subject: Re: [Y2038] [PATCH v2 13/24] drm/etnaviv: reject timeouts with
tv_nsec >= NSEC_PER_SEC
On Fri, 2019-12-13 at 21:53 +0100, Arnd Bergmann wrote:
> Most kernel interfaces that take a timespec require normalized
> representation with tv_nsec between 0 and NSEC_PER_SEC.
>
> Passing values larger than 0x100000000ull further behaves differently
> on 32-bit and 64-bit kernels, and can cause the latter to spend a long
> time counting seconds in timespec64_sub()/set_normalized_timespec64().
>
> Reject those large values at the user interface to enforce sane and
> portable behavior.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> drivers/gpu/drm/etnaviv/etnaviv_drv.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> index 1f9c01be40d7..95d72dc00280 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -297,6 +297,9 @@ static int etnaviv_ioctl_gem_cpu_prep(struct drm_device *dev, void *data,
> if (args->op & ~(ETNA_PREP_READ | ETNA_PREP_WRITE | ETNA_PREP_NOSYNC))
> return -EINVAL;
>
> + if (args->timeout.tv_nsec > NSEC_PER_SEC)
[...]
There's an off-by-one error between the subject line and the actual
changes. The subject line seems to have the correct comparison.
Ben.
--
Ben Hutchings, Software Developer Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United Kingdom
Powered by blists - more mailing lists