This is a series I worked on with Baolin in 2017 and 2018, but we
never quite managed to finish up the last pieces. During the
ALSA developer meetup at ELC-E 2018 in Edinburgh, a decision was
made to go with this approach for keeping best compatibility
with existing source code, and then I failed to follow up by
resending the patches.
Now I have patches for all remaining time_t uses in the kernel,
so it's absolutely time to revisit them. I have done more
review of the patches myself and found a couple of minor issues
that I have fixed up, otherwise the series is still the same as
before.
Conceptually, the idea of these patches is:
- 64-bit applications should see no changes at all, neither
compile-time nor run-time.
- 32-bit code compiled with a 64-bit time_t currently
does not work with ALSA, and requires kernel changes and/or
sound/asound.h changes
- Most 32-bit code using these interfaces will work correctly
on a modified kernel, with or without the uapi header changes.
- 32-bit code using SNDRV_TIMER_IOCTL_TREAD requires the
updated header file for 64-bit time_t support
- 32-bit i386 user space with 64-bit time_t is broken for
SNDRV_PCM_IOCTL_STATUS, SNDRV_RAWMIDI_IOCTL_STATUS and
SNDRV_PCM_IOCTL_SYNC_PTR because of i386 alignment. This is also
addressed by the updated uapi header.
- PCM mmap is currently supported on native x86 kernels
(both 32-bit and 64-bit) but not for compat mode. This series breaks
the 32-bit native mmap support for 32-bit time_t, but instead allows
it for 64-bit time_t on both native and compat kernels. This seems to
be the best trade-off, as mmap support is optional already, and most
32-bit code runs in compat mode anyway.
- I've tried to avoid breaking compilation of 32-bit code
as much as possible. Anything that does break however is likely code
that is already broken on 64-bit time_t and needs source changes to
fix them.
I hope I addressed all review comments by now, so please pull this
for linux-5.6.
A git branch with the same contents is available for testing at [1].
Arnd
[1] https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git y2038-alsa-v7
[2] https://lore.kernel.org/lkml/CAK8P3a2Os66+iwQYf97qh05W2JP8rmWao8zmKoHiXqVHv…
Changes since v6: (Arnd):
- Add a patch to update the API versions
- Hide a timespec reference in #ifndef __KERNEL__ to remove the
last reference to time_t
- Use a more readable way to do padding and describe it in the
changelog
- Rebase to linux-5.5-rc1, changing include/sound/soc-component.h
and sound/drivers/aloop.c as needed.
Changes since v5 (Arnd):
- Rebased to linux-5.4-rc4
- Updated to completely remove timespec and time_t references from alsa
- found and fixed a few bugs
Changes since v4 (Baolin):
- Add patch 5 to change trigger_tstamp member of struct snd_pcm_runtime.
- Add patch 8 to change internal timespec.
- Add more explanation in commit message.
- Use ktime_get_real_ts64() in patch 6.
- Split common code out into a separate function in patch 6.
- Fix tu->tread bug in patch 6 and remove #if __BITS_PER_LONG == 64 macro.
Changes since v3:
- Move struct snd_pcm_status32 to pcm.h file.
- Modify comments and commit message.
- Add new patch2 ~ patch6.
Changes since v2:
- Renamed all structures to make clear.
- Remove CONFIG_X86_X32 macro and introduced new compat_snd_pcm_status64_x86_32.
Changes since v1:
- Add one macro for struct snd_pcm_status_32 which only active in 32bits kernel.
- Convert pcm_compat.c to use struct snd_pcm_status_64.
- Convert pcm_native.c to use struct snd_pcm_status_64.
---
Arnd Bergmann (3):
ALSA: move snd_pcm_ioctl_sync_ptr_compat into pcm_native.c
ALSA: add new 32-bit layout for snd_pcm_mmap_status/control
ALSA: bump uapi version numbers
Baolin Wang (6):
ALSA: Replace timespec with timespec64
ALSA: Avoid using timespec for struct snd_timer_status
ALSA: Avoid using timespec for struct snd_ctl_elem_value
ALSA: Avoid using timespec for struct snd_pcm_status
ALSA: Avoid using timespec for struct snd_rawmidi_status
ALSA: Avoid using timespec for struct snd_timer_tread
include/sound/pcm.h | 74 ++++++--
include/sound/soc-component.h | 4 +-
include/sound/timer.h | 4 +-
include/uapi/sound/asound.h | 145 +++++++++++++--
sound/core/pcm.c | 12 +-
sound/core/pcm_compat.c | 282 ++++++++----------------------
sound/core/pcm_lib.c | 38 ++--
sound/core/pcm_native.c | 226 +++++++++++++++++++++---
sound/core/rawmidi.c | 132 +++++++++++---
sound/core/rawmidi_compat.c | 87 +++------
sound/core/timer.c | 229 ++++++++++++++++++------
sound/core/timer_compat.c | 62 +------
sound/drivers/aloop.c | 2 +-
sound/pci/hda/hda_controller.c | 10 +-
sound/soc/intel/skylake/skl-pcm.c | 4 +-
15 files changed, 817 insertions(+), 494 deletions(-)
--
2.20.0
Good luck, try to answer immediately, you have good news
.................................................................................................
Boa sorte, tente responder imediatamente, você tem boas notícias
Hi Bruce, Chuck,
NFSd is one of the last areas of the kernel that is not y2038 safe
yet, this series addresses the remaining issues here.
I did not get any comments for the first version I posted [1], and
I hope this just means that everything was fine and you plan to
merge this soon ;-)
I uploaded a git branch to [2] for testing.
Please review and merge for linux-5.6 so we can remove the 32-bit
time handling from that release.
Arnd
Changes from v1:
- separate nfs and nfsd, as most of the nfs changes are merged now
- rebase to v5.5
[1] https://lore.kernel.org/lkml/20191111201639.2240623-1-arnd@arndb.de/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=…
Arnd Bergmann (12):
nfsd: use ktime_get_seconds() for timestamps
nfsd: print 64-bit timestamps in client_info_show
nfsd: handle nfs3 timestamps as unsigned
nfsd: use timespec64 in encode_time_delta
nfsd: make 'boot_time' 64-bit wide
nfsd: pass a 64-bit guardtime to nfsd_setattr()
nfsd: use time64_t in nfsd_proc_setattr() check
nfsd: fix delay timer on 32-bit architectures
nfsd: fix jiffies/time_t mixup in LRU list
nfsd: use boottime for lease expiry alculation
nfsd: use ktime_get_real_seconds() in nfs4_verifier
nfsd: remove nfs4_reset_lease() declarations
fs/nfsd/netns.h | 6 ++--
fs/nfsd/nfs3xdr.c | 20 +++++--------
fs/nfsd/nfs4callback.c | 7 ++++-
fs/nfsd/nfs4layouts.c | 2 +-
fs/nfsd/nfs4proc.c | 2 +-
fs/nfsd/nfs4recover.c | 8 ++---
fs/nfsd/nfs4state.c | 68 ++++++++++++++++++++----------------------
fs/nfsd/nfs4xdr.c | 4 +--
fs/nfsd/nfsctl.c | 6 ++--
fs/nfsd/nfsd.h | 2 --
fs/nfsd/nfsfh.h | 4 +--
fs/nfsd/nfsproc.c | 6 ++--
fs/nfsd/state.h | 10 +++----
fs/nfsd/vfs.c | 4 +--
fs/nfsd/vfs.h | 2 +-
fs/nfsd/xdr3.h | 2 +-
16 files changed, 74 insertions(+), 79 deletions(-)
--
2.20.0
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.
I uploaded git branch on top of the v4l2/dvb branch to [2].
Arnd
Changes since v4:
- Move non-public contents out of uapi header
- split out __kernel_v4l2_timeval into separate struct
- use compound initializers for v4l2_event_time32 and
v4l2_buffer_time32 conversion
- add comment for v4l2_buffer_get_timestamp()
Changes since v3:
- 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.
[1] https://lwn.net/Articles/657754/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=…
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 | 209 ++++++--
drivers/media/v4l2-core/v4l2-subdev.c | 26 +-
drivers/media/v4l2-core/videobuf-core.c | 5 +-
include/media/v4l2-common.h | 21 +
include/media/v4l2-ioctl.h | 55 ++
include/trace/events/v4l2.h | 2 +-
include/uapi/linux/videodev2.h | 29 ++
16 files changed, 709 insertions(+), 135 deletions(-)
--
2.20.0
The following changes since commit e42617b825f8073569da76dc4510bfa019b1c35a:
Linux 5.5-rc1 (2019-12-08 14:57:55 -0800)
are available in the Git repository at:
git://git.kernel.org:/pub/scm/linux/kernel/git/arnd/playground.git tags/block-ioctl-cleanup-5.6
for you to fetch changes up to 3462d5c19dac7c062c5a2db727775116e6d2b28e:
Documentation: document ioctl interfaces better (2019-12-17 22:45:18 +0100)
----------------------------------------------------------------
block, scsi: final compat_ioctl cleanup
This series concludes the work I did for linux-5.5 on the compat_ioctl()
cleanup, killing off fs/compat_ioctl.c and block/compat_ioctl.c by moving
everything into drivers.
Overall this would be a reduction both in complexity and line count, but
as I'm also adding documentation the overall number of lines increases
in the end.
My plan was originally to keep the SCSI and block parts separate.
This did not work easily because of interdependencies: I cannot
do the final SCSI cleanup in a good way without first addressing the
CDROM ioctls, so this is one series that I hope could be merged through
either the block or the scsi git trees, or possibly both if you can
pull in the same branch.
The series comes in these steps:
1. clean up the sg v3 interface as suggested by Linus. I have
talked about this with Doug Gilbert as well, and he would
rebase his sg v4 patches on top of "compat: scsi: sg: fix v3
compat read/write interface"
2. Actually moving handlers out of block/compat_ioctl.c and
block/scsi_ioctl.c into drivers, mixed in with cleanup
patches
3. Document how to do this right. I keep getting asked about this,
and it helps to point to some documentation file.
The branch is based on another one that fixes a couple of bugs found
during the creation of this series.
Changes since the original version [1]:
- move out the bugfixes into a branch for itself
- clean up scsi sg driver further as suggested by Christoph Hellwig
- avoid some ifdefs by moving compat_ptr() out of asm/compat.h
- split out the blkdev_compat_ptr_ioctl function; bug spotted by
Ben Hutchings
- Improve formatting of documentation
[1] https://lore.kernel.org/linux-block/20191211204306.1207817-1-arnd@arndb.de/…
----------------------------------------------------------------
Arnd Bergmann (22): (plus five from the first pull request)
compat: ARM64: always include asm-generic/compat.h
compat: provide compat_ptr() on all architectures
compat: scsi: sg: fix v3 compat read/write interface
compat_ioctl: block: add blkdev_compat_ptr_ioctl
compat_ioctl: ubd, aoe: use blkdev_compat_ptr_ioctl
compat_ioctl: move CDROM_SEND_PACKET handling into scsi
compat_ioctl: move CDROMREADADIO to cdrom.c
compat_ioctl: cdrom: handle CDROM_LAST_WRITTEN
compat_ioctl: block: handle cdrom compat ioctl in non-cdrom drivers
compat_ioctl: add scsi_compat_ioctl
compat_ioctl: bsg: add handler
compat_ioctl: ide: floppy: add handler
compat_ioctl: scsi: move ioctl handling into drivers
compat_ioctl: move sys_compat_ioctl() to ioctl.c
compat_ioctl: simplify the implementation
compat_ioctl: move cdrom commands into cdrom.c
compat_ioctl: scsi: handle HDIO commands from drivers
compat_ioctl: move HDIO ioctl handling into drivers/ide
compat_ioctl: block: move blkdev_compat_ioctl() into ioctl.c
compat_ioctl: block: simplify compat_blkpg_ioctl()
compat_ioctl: simplify up block/ioctl.c
Documentation: document ioctl interfaces better
Documentation/core-api/index.rst | 1 +
Documentation/core-api/ioctl.rst | 248 +++++++++++++++
arch/arm64/include/asm/compat.h | 22 +-
arch/mips/include/asm/compat.h | 18 --
arch/parisc/include/asm/compat.h | 17 -
arch/powerpc/include/asm/compat.h | 17 -
arch/powerpc/oprofile/backtrace.c | 2 +-
arch/s390/include/asm/compat.h | 6 +-
arch/sparc/include/asm/compat.h | 17 -
arch/um/drivers/ubd_kern.c | 1 +
arch/x86/include/asm/compat.h | 17 -
block/Makefile | 1 -
block/bsg.c | 1 +
block/compat_ioctl.c | 411 -------------------------
block/ioctl.c | 319 +++++++++++++++----
block/scsi_ioctl.c | 214 ++++++++-----
drivers/ata/libata-scsi.c | 9 +
drivers/block/aoe/aoeblk.c | 1 +
drivers/block/floppy.c | 3 +
drivers/block/paride/pcd.c | 3 +
drivers/block/paride/pd.c | 1 +
drivers/block/paride/pf.c | 1 +
drivers/block/pktcdvd.c | 26 +-
drivers/block/sunvdc.c | 1 +
drivers/block/virtio_blk.c | 3 +
drivers/block/xen-blkfront.c | 1 +
drivers/cdrom/cdrom.c | 35 ++-
drivers/cdrom/gdrom.c | 3 +
drivers/ide/ide-cd.c | 37 +++
drivers/ide/ide-disk.c | 1 +
drivers/ide/ide-floppy.c | 4 +
drivers/ide/ide-floppy.h | 2 +
drivers/ide/ide-floppy_ioctl.c | 35 +++
drivers/ide/ide-gd.c | 14 +
drivers/ide/ide-ioctls.c | 44 ++-
drivers/ide/ide-tape.c | 11 +
drivers/scsi/aic94xx/aic94xx_init.c | 3 +
drivers/scsi/ch.c | 9 +-
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 3 +
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 3 +
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +
drivers/scsi/ipr.c | 3 +
drivers/scsi/isci/init.c | 3 +
drivers/scsi/mvsas/mv_init.c | 3 +
drivers/scsi/pm8001/pm8001_init.c | 3 +
drivers/scsi/scsi_ioctl.c | 54 +++-
drivers/scsi/sd.c | 50 ++-
drivers/scsi/sg.c | 170 +++++-----
drivers/scsi/sr.c | 53 +++-
drivers/scsi/st.c | 51 +--
fs/Makefile | 2 +-
fs/compat_ioctl.c | 261 ----------------
fs/internal.h | 6 -
fs/ioctl.c | 131 +++++---
include/linux/blkdev.h | 7 +
include/linux/compat.h | 18 ++
include/linux/falloc.h | 2 -
include/linux/fs.h | 4 -
include/linux/ide.h | 2 +
include/linux/libata.h | 6 +
include/scsi/scsi_ioctl.h | 1 +
include/scsi/sg.h | 30 ++
62 files changed, 1257 insertions(+), 1171 deletions(-)
create mode 100644 Documentation/core-api/ioctl.rst
delete mode 100644 block/compat_ioctl.c
delete mode 100644 fs/compat_ioctl.c
--
2.20.0
Hi Jens, James and Martin,
This series concludes the work I did for linux-5.5 on the compat_ioctl()
cleanup, killing off fs/compat_ioctl.c and block/compat_ioctl.c by moving
everything into drivers.
Overall this would be a reduction both in complexity and line count, but
as I'm also adding documentation the overall number of lines increases
in the end.
My plan was originally to keep the SCSI and block parts separate.
This did not work easily because of interdependencies: I cannot
do the final SCSI cleanup in a good way without first addressing the
CDROM ioctls, so this is one series that I hope could be merged through
either the block or the scsi git trees, or possibly both if you can
pull in the same branch.
The series comes in these steps:
1. clean up the sg v3 interface as suggested by Linus. I have
talked about this with Doug Gilbert as well, and he would
rebase his sg v4 patches on top of "compat: scsi: sg: fix v3
compat read/write interface"
2. Four patches for missing block compat_ioctl handlers, to be
backported into stable kernels. Separate patches because they
are needed in different stable versions.
3. Actually moving handlers out of block/compat_ioctl.c and
block/scsi_ioctl.c into drivers, mixed in with cleanup
patches
4. Document how to do this right. I keep getting asked about this,
and it helps to point to some documentation file.
The series is avaialable for testing at [1].
Arnd
[1] https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=…
Arnd Bergmann (24):
compat: ARM64: always include asm-generic/compat.h
compat: scsi: sg: fix v3 compat read/write interface
compat_ioctl: block: handle BLKREPORTZONE/BLKRESETZONE
compat_ioctl: block: handle BLKGETZONESZ/BLKGETNRZONES
compat_ioctl: block: handle add zone open, close and finish ioctl
compat_ioctl: block: handle Persistent Reservations
compaT_ioctl: ubd, aoe: use blkdev_compat_ptr_ioctl
compat_ioctl: move CDROM_SEND_PACKET handling into scsi
compat_ioctl: move CDROMREADADIO to cdrom.c
compat_ioctl: cdrom: handle CDROM_LAST_WRITTEN
compat_ioctl: block: handle cdrom compat ioctl in non-cdrom drivers
compat_ioctl: add scsi_compat_ioctl
compat_ioctl: bsg: add handler
compat_ioctl: ide: floppy: add handler
compat_ioctl: scsi: move ioctl handling into drivers
compat_ioctl: move sys_compat_ioctl() to ioctl.c
compat_ioctl: simplify the implementation
compat_ioctl: move cdrom commands into cdrom.c
compat_ioctl: scsi: handle HDIO commands from drivers
compat_ioctl: move HDIO ioctl handling into drivers/ide
compat_ioctl: block: move blkdev_compat_ioctl() into ioctl.c
compat_ioctl: block: simplify compat_blkpg_ioctl()
compat_ioctl: simplify up block/ioctl.c
Documentation: document ioctl interfaces better
Documentation/core-api/index.rst | 1 +
Documentation/core-api/ioctl.rst | 250 +++++++++++++++
arch/arm64/include/asm/compat.h | 5 +-
arch/um/drivers/ubd_kern.c | 1 +
block/Makefile | 1 -
block/bsg.c | 1 +
block/compat_ioctl.c | 411 -------------------------
block/ioctl.c | 319 +++++++++++++++----
block/scsi_ioctl.c | 214 ++++++++-----
drivers/ata/libata-scsi.c | 9 +
drivers/block/aoe/aoeblk.c | 1 +
drivers/block/floppy.c | 3 +
drivers/block/paride/pcd.c | 3 +
drivers/block/paride/pd.c | 1 +
drivers/block/paride/pf.c | 1 +
drivers/block/pktcdvd.c | 26 +-
drivers/block/sunvdc.c | 1 +
drivers/block/virtio_blk.c | 3 +
drivers/block/xen-blkfront.c | 1 +
drivers/cdrom/cdrom.c | 35 ++-
drivers/cdrom/gdrom.c | 3 +
drivers/ide/ide-cd.c | 40 +++
drivers/ide/ide-disk.c | 3 +
drivers/ide/ide-floppy.c | 4 +
drivers/ide/ide-floppy.h | 2 +
drivers/ide/ide-floppy_ioctl.c | 35 +++
drivers/ide/ide-gd.c | 14 +
drivers/ide/ide-ioctls.c | 47 ++-
drivers/ide/ide-tape.c | 14 +
drivers/scsi/aic94xx/aic94xx_init.c | 3 +
drivers/scsi/ch.c | 9 +-
drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 3 +
drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 3 +
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 3 +
drivers/scsi/ipr.c | 3 +
drivers/scsi/isci/init.c | 3 +
drivers/scsi/mvsas/mv_init.c | 3 +
drivers/scsi/pm8001/pm8001_init.c | 3 +
drivers/scsi/scsi_ioctl.c | 54 +++-
drivers/scsi/sd.c | 50 ++-
drivers/scsi/sg.c | 169 +++++-----
drivers/scsi/sr.c | 53 +++-
drivers/scsi/st.c | 51 +--
fs/Makefile | 2 +-
fs/compat_ioctl.c | 261 ----------------
fs/internal.h | 6 -
fs/ioctl.c | 131 +++++---
include/linux/blkdev.h | 7 +
include/linux/falloc.h | 2 -
include/linux/fs.h | 4 -
include/linux/ide.h | 2 +
include/linux/libata.h | 6 +
include/scsi/scsi_ioctl.h | 1 +
include/scsi/sg.h | 30 ++
54 files changed, 1249 insertions(+), 1062 deletions(-)
create mode 100644 Documentation/core-api/ioctl.rst
delete mode 100644 block/compat_ioctl.c
delete mode 100644 fs/compat_ioctl.c
--
2.20.0
Cc: corbet(a)lwn.net
Cc: catalin.marinas(a)arm.com
Cc: will(a)kernel.org
Cc: jdike(a)addtoit.com
Cc: richard(a)nod.at
Cc: anton.ivanov(a)cambridgegreys.com
Cc: fujita.tomonori(a)lab.ntt.co.jp
Cc: justin(a)coraid.com
Cc: efremov(a)linux.com
Cc: tim(a)cyberelk.net
Cc: mst(a)redhat.com
Cc: jasowang(a)redhat.com
Cc: pbonzini(a)redhat.com
Cc: stefanha(a)redhat.com
Cc: boris.ostrovsky(a)oracle.com
Cc: jgross(a)suse.com
Cc: sstabellini(a)kernel.org
Cc: konrad.wilk(a)oracle.com
Cc: roger.pau(a)citrix.com
Cc: bp(a)alien8.de
Cc: davem(a)davemloft.net
Cc: john.garry(a)huawei.com
Cc: brking(a)us.ibm.com
Cc: intel-linux-scu(a)intel.com
Cc: artur.paszkiewicz(a)intel.com
Cc: jinpu.wang(a)cloud.ionos.com
Cc: dgilbert(a)interlog.com
Cc: Kai.Makisara(a)kolumbus.fi
Cc: arnd(a)arndb.de
Cc: damien.lemoal(a)hgst.com
Cc: hare(a)suse.com
Cc: linux-doc(a)vger.kernel.org
Cc: linux-kernel(a)vger.kernel.org
Cc: linux-block(a)vger.kernel.org
Cc: linux-arm-kernel(a)lists.infradead.org
Cc: linux-um(a)lists.infradead.org
Cc: linux-scsi(a)vger.kernel.org
Cc: linux-ide(a)vger.kernel.org
Cc: virtualization(a)lists.linux-foundation.org
Cc: xen-devel(a)lists.xenproject.org
Cc: linux-fsdevel(a)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.
I uploaded git branch on top of the v4l2/dvb branch to [2].
Arnd
Changes since v5:
- Fix all bugs that Hans found during testing
- Add a comment about x32 still being broken
Changes since v4:
- Move non-public contents out of uapi header
- split out __kernel_v4l2_timeval into separate struct
- use compound initializers for v4l2_event_time32 and
v4l2_buffer_time32 conversion
- add comment for v4l2_buffer_get_timestamp()
Changes since v3:
- 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.
[1] https://lwn.net/Articles/657754/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=…
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 | 477 +++++++++++++++---
drivers/media/v4l2-core/v4l2-event.c | 5 +-
drivers/media/v4l2-core/v4l2-ioctl.c | 211 ++++++--
drivers/media/v4l2-core/v4l2-subdev.c | 26 +-
drivers/media/v4l2-core/videobuf-core.c | 5 +-
include/media/v4l2-common.h | 21 +
include/media/v4l2-ioctl.h | 55 ++
include/trace/events/v4l2.h | 2 +-
include/uapi/linux/videodev2.h | 29 ++
16 files changed, 718 insertions(+), 135 deletions(-)
--
2.20.0