The Samba-Bugzilla – Attachment 17529 Details for
Bug 15151
vfs_gpfs silently garbles timestamps > year 2106
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 4.16 and 4.17
15151.txt (text/plain), 5.05 KB, created by
Volker Lendecke
on 2022-09-23 08:33:24 UTC
(
hide
)
Description:
Patch for 4.16 and 4.17
Filename:
MIME Type:
Creator:
Volker Lendecke
Created:
2022-09-23 08:33:24 UTC
Size:
5.05 KB
patch
obsolete
>From 2f44ece9e8dfc7b216171c8dfdb09713f0254cb9 Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Mon, 31 Aug 2020 16:14:14 +0200 >Subject: [PATCH 1/3] vfs_gpfs: Prevent mangling of GPFS timestamps after 2106 > >gpfs_set_times as of August 2020 stores 32-bit unsigned tv_sec. We >should not silently garble time stamps but reject the attempt to set >an out-of-range timestamp. > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=15151 >Signed-off-by: Volker Lendecke <vl@samba.org> >Reviewed-by: Christof Schmitt <cs@samba.org> >(cherry picked from commit b954d181cd25d9029d3c222e8d97fe7a3b0b2400) >--- > source3/modules/vfs_gpfs.c | 43 +++++++++++++++++++++++++++++--------- > 1 file changed, 33 insertions(+), 10 deletions(-) > >diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c >index 6b084fd79a5..e3dc7a6fd75 100644 >--- a/source3/modules/vfs_gpfs.c >+++ b/source3/modules/vfs_gpfs.c >@@ -1706,15 +1706,27 @@ static int vfs_gpfs_lstat(struct vfs_handle_struct *handle, > return ret; > } > >-static void timespec_to_gpfs_time(struct timespec ts, gpfs_timestruc_t *gt, >- int idx, int *flags) >+static int timespec_to_gpfs_time( >+ struct timespec ts, gpfs_timestruc_t *gt, int idx, int *flags) > { >- if (!is_omit_timespec(&ts)) { >- *flags |= 1 << idx; >- gt[idx].tv_sec = ts.tv_sec; >- gt[idx].tv_nsec = ts.tv_nsec; >- DEBUG(10, ("Setting GPFS time %d, flags 0x%x\n", idx, *flags)); >+ if (is_omit_timespec(&ts)) { >+ return 0; > } >+ >+ if (ts.tv_sec > UINT32_MAX) { >+ DBG_WARNING("GPFS uses 32-bit unsigned timestamps, " >+ "%ju is too large\n", >+ (uintmax_t)ts.tv_sec); >+ errno = ERANGE; >+ return -1; >+ } >+ >+ *flags |= 1 << idx; >+ gt[idx].tv_sec = ts.tv_sec; >+ gt[idx].tv_nsec = ts.tv_nsec; >+ DBG_DEBUG("Setting GPFS time %d, flags 0x%x\n", idx, *flags); >+ >+ return 0; > } > > static int smbd_gpfs_set_times(struct files_struct *fsp, >@@ -1725,10 +1737,21 @@ static int smbd_gpfs_set_times(struct files_struct *fsp, > int rc; > > ZERO_ARRAY(gpfs_times); >- timespec_to_gpfs_time(ft->atime, gpfs_times, 0, &flags); >- timespec_to_gpfs_time(ft->mtime, gpfs_times, 1, &flags); >+ rc = timespec_to_gpfs_time(ft->atime, gpfs_times, 0, &flags); >+ if (rc != 0) { >+ return rc; >+ } >+ >+ rc = timespec_to_gpfs_time(ft->mtime, gpfs_times, 1, &flags); >+ if (rc != 0) { >+ return rc; >+ } >+ > /* No good mapping from LastChangeTime to ctime, not storing */ >- timespec_to_gpfs_time(ft->create_time, gpfs_times, 3, &flags); >+ rc = timespec_to_gpfs_time(ft->create_time, gpfs_times, 3, &flags); >+ if (rc != 0) { >+ return rc; >+ } > > if (!flags) { > DBG_DEBUG("nothing to do, return to avoid EINVAL\n"); >-- >2.30.2 > > >From ca1e0310c5f4c8052794fed3e1b292a1eaeddf1c Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Tue, 1 Sep 2020 13:24:55 +0200 >Subject: [PATCH 2/3] lib: Map ERANGE to NT_STATUS_INTEGER_OVERFLOW > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=15151 >Signed-off-by: Volker Lendecke <vl@samba.org> >Reviewed-by: Christof Schmitt <cs@samba.org> > >Autobuild-User(master): Volker Lendecke <vl@samba.org> >Autobuild-Date(master): Fri Aug 19 12:43:06 UTC 2022 on sn-devel-184 > >(cherry picked from commit 06f35edaf129ce3195960905d38af73ec12fc716) >(cherry picked from commit e56c18d356bd3419abebd36e1fae39019cabbfaf) >--- > source3/lib/errmap_unix.c | 3 +++ > 1 file changed, 3 insertions(+) > >diff --git a/source3/lib/errmap_unix.c b/source3/lib/errmap_unix.c >index 73b2f532a06..029efae0f51 100644 >--- a/source3/lib/errmap_unix.c >+++ b/source3/lib/errmap_unix.c >@@ -119,6 +119,9 @@ static const struct { > { EOVERFLOW, NT_STATUS_ALLOTTED_SPACE_EXCEEDED }, > #endif > { EINPROGRESS, NT_STATUS_MORE_PROCESSING_REQUIRED }, >+#ifdef ERANGE >+ { ERANGE, NT_STATUS_INTEGER_OVERFLOW }, >+#endif > }; > > /********************************************************************* >-- >2.30.2 > > >From a7d24d58e1030e6e66fa944f3fc54a0e7164bfcd Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Mon, 22 Aug 2022 15:24:01 +0200 >Subject: [PATCH 3/3] vfs_gpfs: Protect against timestamps before the Unix > epoch > >In addition to b954d181cd2 we should also protect against timestamps >before the epoch. > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=15151 >Signed-off-by: Volker Lendecke <vl@samba.org> >Reviewed-by: Christof Schmitt <cs@samba.org> > >Autobuild-User(master): Volker Lendecke <vl@samba.org> >Autobuild-Date(master): Fri Sep 23 06:50:17 UTC 2022 on sn-devel-184 > >(cherry picked from commit f6b391e04a4d5974b908f4f375bd2876083aa7b2) >--- > source3/modules/vfs_gpfs.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > >diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c >index e3dc7a6fd75..fc6e7a65b27 100644 >--- a/source3/modules/vfs_gpfs.c >+++ b/source3/modules/vfs_gpfs.c >@@ -1713,10 +1713,10 @@ static int timespec_to_gpfs_time( > return 0; > } > >- if (ts.tv_sec > UINT32_MAX) { >- DBG_WARNING("GPFS uses 32-bit unsigned timestamps, " >- "%ju is too large\n", >- (uintmax_t)ts.tv_sec); >+ if (ts.tv_sec < 0 || ts.tv_sec > UINT32_MAX) { >+ DBG_NOTICE("GPFS uses 32-bit unsigned timestamps " >+ "and cannot handle %jd.\n", >+ (intmax_t)ts.tv_sec); > errno = ERANGE; > return -1; > } >-- >2.30.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
cs
:
review+
Actions:
View
Attachments on
bug 15151
:
17484
| 17529 |
18554