media: v4l2-core: fix v4l2_buffer handling for time64 ABI
authorArnd Bergmann <arnd@arndb.de>
Mon, 16 Dec 2019 14:15:04 +0000 (15:15 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 3 Jan 2020 14:50:21 +0000 (15:50 +0100)
commit577c89b0ce726e44c08c396d14f84a00070a57b7
treeae15a1dab7f41ba14d3893e23869fc245fe2cee2
parent1a6c0b36dd19c51cdd76895d009c5deba2286ebb
media: v4l2-core: fix v4l2_buffer handling for time64 ABI

The v4l2_buffer structure contains a 'struct timeval' member that is
defined by the user space C library, creating an ABI incompatibility
when that gets updated to a 64-bit time_t.

As in v4l2_event, handle this with a special case in video_put_user()
and video_get_user() to replace the memcpy there.

Since the structure also contains a pointer, there are now two
native versions (on 32-bit systems) as well as two compat versions
(on 64-bit systems), which unfortunately complicates the compat
handler quite a bit.

Duplicating the existing handlers for the new types is a safe
conversion for now, but unfortunately this may turn into a
maintenance burden later. A larger-scale rework of the
compat code might be a better alternative, but is out of scope
of the y2038 work.

Sparc64 needs a special case because of their special suseconds_t
definition.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/v4l2-core/v4l2-ioctl.c
include/media/v4l2-ioctl.h
include/uapi/linux/videodev2.h