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 0x1ull 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 > --- > 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 ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038
Re: [Y2038] [PATCH 2/3] xfs: disallow broken ioctls without compat-32-bit-time
On Tue, Jan 07, 2020 at 06:16:34AM -0800, Christoph Hellwig wrote: > On Thu, Jan 02, 2020 at 10:07:49AM -0800, Darrick J. Wong wrote: > > > Sorry I missed that comment earlier. I've had a fresh look now, but > > > I think we still need to deprecate XFS_IOC_SWAPEXT and add a > > > v5 version of it, since the comparison will fail as soon as the range > > > of the inode timestamps is extended beyond 2038, otherwise the > > > comparison will always be false, or require comparing the truncated > > > time values which would add yet another representation. > > > > I prefer we replace the old SWAPEXT with a new version to get rid of > > struct xfs_bstat. Though a SWAPEXT_V5 probably only needs to contain > > the *stat fields that swapext actually needs to check that the file > > hasn't been changed, which would be ino/gen/btime/ctime. > > > > (Maybe I'd add an offset/length too...) > > And most importantly we need to lift it to the VFS instead of all the > crazy fs specific interfaces at the moment. Yeah. Fixing that (and maybe adding an ioctl to set the FS UUID online) were on my list for 5.6 but clearly I have to defer everything until 5.7 because we've just run out of time. Uh... I started looking into unifying the ext4 and xfs defrag ioctl, but gagged when I realized that the ext4 ioctl also handles the data copy inside the kernel. I think that's the sort of behavior we should /not/ allow into the new ioctl, though that also means that the required changes for ext4/e4defrag will be non-trivial. The btrfs defrag ioctl also contains thresholding information and optional knobs to enable compression, which makes me wonder if we should focus narrowly on swapext being "swap these extents but only if the source file hasn't changed" and not necessarily defrag? ...in which case I wonder, can people (ab)use this interface for atomic file updates? Create an O_TMPFILE, reflink the source file into the temp file, make your updates to the tempfile, and then swapext the donor's file data back into the source file, but only if the source file hasn't changed? --D ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038
Re: [Y2038] [PATCH 2/3] xfs: disallow broken ioctls without compat-32-bit-time
On Thu, Jan 02, 2020 at 10:07:49AM -0800, Darrick J. Wong wrote: > > Sorry I missed that comment earlier. I've had a fresh look now, but > > I think we still need to deprecate XFS_IOC_SWAPEXT and add a > > v5 version of it, since the comparison will fail as soon as the range > > of the inode timestamps is extended beyond 2038, otherwise the > > comparison will always be false, or require comparing the truncated > > time values which would add yet another representation. > > I prefer we replace the old SWAPEXT with a new version to get rid of > struct xfs_bstat. Though a SWAPEXT_V5 probably only needs to contain > the *stat fields that swapext actually needs to check that the file > hasn't been changed, which would be ino/gen/btime/ctime. > > (Maybe I'd add an offset/length too...) And most importantly we need to lift it to the VFS instead of all the crazy fs specific interfaces at the moment. ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038
Re: [Y2038] [PATCH v3 2/2] xfs: quota: move to time64_t interfaces
Looks good, Reviewed-by: Christoph Hellwig ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038
Re: [Y2038] [PATCH 2/3] xfs: disallow broken ioctls without compat-32-bit-time
On Thu, Jan 02, 2020 at 09:34:48PM +0100, Arnd Bergmann wrote: > I tried adding the helper now but ran into a stupid problem: the best > place to put it would be linux/time32.h, but then I have to include > linux/compat.h from there, which in turn pulls in tons of other > headers in any file using linux/time.h. > > I considered making it a macro instead, but that's also really ugly. > > I now think we should just defer this change until after v5.6, once I > have separated linux/time.h from linux/time32.h. > In the meantime I'll resend the other two patches that I know we > need in v5.6 in order to get there, so Darrick can apply them to his > tree. Sounds good. ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038