From patchwork Mon Nov 11 20:38:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 11237707 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 60E17159A for ; Mon, 11 Nov 2019 20:39:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3FC28214E0 for ; Mon, 11 Nov 2019 20:39:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727791AbfKKUjR (ORCPT ); Mon, 11 Nov 2019 15:39:17 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:41731 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726985AbfKKUiq (ORCPT ); Mon, 11 Nov 2019 15:38:46 -0500 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1Ma0HM-1iQwX50ITc-00VvyS; Mon, 11 Nov 2019 21:38:39 +0100 From: Arnd Bergmann To: Mauro Carvalho Chehab , linux-media@vger.kernel.org Cc: Hans Verkuil , linux-kernel@vger.kernel.org, y2038@lists.linaro.org, Arnd Bergmann Subject: [PATCH v4 0/8] y2038 safety in v4l2 Date: Mon, 11 Nov 2019 21:38:27 +0100 Message-Id: <20191111203835.2260382-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:HK+vSU8MWbFmRCQzio+B0y0eS2MroBevtMRKkHYLNcgGMvKpVNP DjDxbV2OPIUSfUhWnJfpD/v7fu/coHW+IrnMd26BhN0crudppogBxqsuXy1tKVk9gHpoKVq uN3R/KHD3l6kLTORAY0Fgp5CxRQU2xF69aeWCZ1h0NopBQ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ailing-List: linux-media@vger.kernel.org I'm in the process of finishing up the last bits on y2038-unsafe code in the kernel, this series is for v4l2, which has no problem with overflow, but has multiple ioctls that break with user space built against a new 32-bit libc. I posted similar patches as part of a series back in 2015, the new version was rewritten from scratch and I double-checked with the old version to make sure I did not miss anything I had already taken care of before. Hans Verkuil worked on a different patch set in 2017, but this also did not get to the point of being merged. My new version contains compat-ioctl support, which the old one did not and should be complete, but given its size likely contains bugs. I did randconfig build tests, but no runtime test, so careful review as well as testing would be much appreciated. With this version, the newly added code takes care of the existing ABI, while the existing code got moved to the 64-bit time_t interface and is used internally. This means that testing with existing binaries should exercise most of the modifications and if that works and doesn't get shot down in review, we can probably live without testing the new ABI explicitly. I'm not entirely happy with the compat-ioctl implementation that adds quite a bit of code duplication, but I hope this is acceptable anyway, as a better implementation would likely require a larger refactoring of the compat-ioctl file, while my approach simply adds support for the additional data structure variants. This is a minor update compared to version 3 of this series, with bugfixes for small mistakes that I found or that were reported by automated build bots. I updated the tree at [2] to this version now. Arnd [1] https://lwn.net/Articles/657754/ [2] https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=y2038-v4l2 Arnd Bergmann (8): media: documentation: fix video_event description media: v4l2: abstract timeval handling in v4l2_buffer media: v4l2-core: compat: ignore native command codes media: v4l2-core: split out data copy from video_usercopy media: v4l2-core: fix VIDIOC_DQEVENT for time64 ABI media: v4l2-core: fix v4l2_buffer handling for time64 ABI media: v4l2-core: fix compat VIDIOC_DQEVENT for time64 ABI media: v4l2-core: fix compat v4l2_buffer handling for time64 ABI .../media/uapi/dvb/video-get-event.rst | 2 +- Documentation/media/uapi/dvb/video_types.rst | 2 +- .../media/common/videobuf2/videobuf2-v4l2.c | 4 +- drivers/media/pci/meye/meye.c | 4 +- drivers/media/usb/cpia2/cpia2_v4l.c | 4 +- drivers/media/usb/stkwebcam/stk-webcam.c | 2 +- drivers/media/usb/usbvision/usbvision-video.c | 4 +- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 470 +++++++++++++++--- drivers/media/v4l2-core/v4l2-event.c | 5 +- drivers/media/v4l2-core/v4l2-ioctl.c | 188 +++++-- drivers/media/v4l2-core/v4l2-subdev.c | 20 +- drivers/media/v4l2-core/videobuf-core.c | 4 +- include/linux/videodev2.h | 17 +- include/trace/events/v4l2.h | 2 +- include/uapi/linux/videodev2.h | 77 +++ 15 files changed, 669 insertions(+), 136 deletions(-)