Re: [Y2038] [PATCH 1/2] fs:hpfs:Remove internal using time_t
> On Nov 17, 2015, at 1:07 AM, Arnd Bergmannwrote: > >> On Tuesday 17 November 2015 17:04:42 deng.ch...@zte.com.cn wrote: >> Many time_t issues in filesystems is involved with VFS i_mtime/i_ctime. >> for example: >> >> static void hpfs_update_directory_times(struct inode *dir) >> { >> - time_t t = get_seconds(); >> + time64_t t = ktime_get_real_seconds(); >> - if (t == dir->i_mtime.tv_sec && >> - t == dir->i_ctime.tv_sec) >> + if ((time_t)t == dir->i_mtime.tv_sec && >> + (time_t)t == dir->i_ctime.tv_sec) >> return; >> Can I replace get_seconds with ktime_get_real_seconds first, and do a >> 64_to_32 cast so as to be compatible with VFS i_mtime/i_ctime like above? >> Or just leave all the stuff which is involved with VFS i_mtime/i_ctime until >> then change of generic VFS code. > > Better just leave it alone for now. Deepa is looking into the > VFS changes, and I think it will make her work easier that way. > Yes, I'm looking at vfs. I haven't decided what to do with this yet. Let's leave it as is for now. -Deepa ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038
[Y2038] [PATCH] net: dns_resolver: convert time_t to time64_t
Changes the defintion of the pointer _expiry from time_t to time64_t. This is to handle the Y2038 problem where time_t will overflow in 2038. The change is safe because the kernel subsystems that call dns_query pass NULL. Signed-off-by: Arnd BergmannSigned-off-by: Aya Mahfouz --- Changelog: v1: The changes were originally made by Arnd Bergmann in relation to time_t. I've broken down a patch sent to me to two independent patches. include/linux/dns_resolver.h | 2 +- net/dns_resolver/dns_query.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/dns_resolver.h b/include/linux/dns_resolver.h index cc92268..6ac3cad 100644 --- a/include/linux/dns_resolver.h +++ b/include/linux/dns_resolver.h @@ -27,7 +27,7 @@ #ifdef __KERNEL__ extern int dns_query(const char *type, const char *name, size_t namelen, -const char *options, char **_result, time_t *_expiry); +const char *options, char **_result, time64_t *_expiry); #endif /* KERNEL */ diff --git a/net/dns_resolver/dns_query.c b/net/dns_resolver/dns_query.c index 4677b6f..ecc28cf 100644 --- a/net/dns_resolver/dns_query.c +++ b/net/dns_resolver/dns_query.c @@ -67,7 +67,7 @@ * Returns the size of the result on success, -ve error code otherwise. */ int dns_query(const char *type, const char *name, size_t namelen, - const char *options, char **_result, time_t *_expiry) + const char *options, char **_result, time64_t *_expiry) { struct key *rkey; const struct user_key_payload *upayload; -- 2.4.3 -- Kind Regards, Aya Saif El-yazal Mahfouz ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038
[Y2038] You have 1 new fax, document 0000619186
You have received a new fax. Please, download fax document attached to this email. Scanned at:Tue, 17 Nov 2015 19:33:14 +0300 Scanned by:Reginald Fritz Resolution:600 DPI Pages sent:4 Document name: scanned-619186.doc Filesize: 184 Kb Scanned in:35 seconds Thanks for using Interfax service! ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038
Re: [Y2038] [PATCH 1/2] fs:hpfs:Remove internal using time_t
On Tuesday 17 November 2015 17:04:42 deng.ch...@zte.com.cn wrote: > Many time_t issues in filesystems is involved with VFS i_mtime/i_ctime. > for example: > > static void hpfs_update_directory_times(struct inode *dir) > { > - time_t t = get_seconds(); > + time64_t t = ktime_get_real_seconds(); > - if (t == dir->i_mtime.tv_sec && > - t == dir->i_ctime.tv_sec) > + if ((time_t)t == dir->i_mtime.tv_sec && > + (time_t)t == dir->i_ctime.tv_sec) > return; > Can I replace get_seconds with ktime_get_real_seconds first, and do a > 64_to_32 cast so as to be compatible with VFS i_mtime/i_ctime like above? > Or just leave all the stuff which is involved with VFS i_mtime/i_ctime until > then change of generic VFS code. > Better just leave it alone for now. Deepa is looking into the VFS changes, and I think it will make her work easier that way. Arnd ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038
Re: [Y2038] [PATCH 1/2] fs:hpfs:Remove internal using time_t
Many time_t issues in filesystems is involved with VFS i_mtime/i_ctime. for example: static void hpfs_update_directory_times(struct inode *dir) { - time_t t = get_seconds(); + time64_t t = ktime_get_real_seconds(); - if (t == dir->i_mtime.tv_sec && - t == dir->i_ctime.tv_sec) + if ((time_t)t == dir->i_mtime.tv_sec && + (time_t)t == dir->i_ctime.tv_sec) return; Can I replace get_seconds with ktime_get_real_seconds first, and do a 64_to_32 cast so as to be compatible with VFS i_mtime/i_ctime like above? Or just leave all the stuff which is involved with VFS i_mtime/i_ctime until then change of generic VFS code. Arnd Bergmann2015-11-12 21:29 To y2038@lists.linaro.org,
[Y2038] [PATCH] security: keys: convert uses of time_t to time64_t
Changes all the uses of time_t for the structs key and key_preparsed_payload to time64_t. This also involves the functions that use them in security/keys. This is to handle the y2038 problem where time_t will overflow in 2038. Also since time_t was a long int and time64_t is long long, uses of LONG_MAX and TIME_T_MAX were replaced by S64_MAX. Signed-off-by: Arnd BergmannSigned-off-by: Aya Mahfouz --- Changelog: v1: The changes were originally made by Arnd Bergmann in relation to time_t. I've broken down a patch sent to me into two independent patches. include/linux/key-type.h | 2 +- include/linux/key.h | 6 +++--- security/keys/gc.c | 23 --- security/keys/internal.h | 8 security/keys/key.c | 24 +--- security/keys/keyring.c | 18 +- security/keys/permission.c | 3 +-- security/keys/proc.c | 8 security/keys/process_keys.c | 2 +- 9 files changed, 44 insertions(+), 50 deletions(-) diff --git a/include/linux/key-type.h b/include/linux/key-type.h index 7463355..2c844ae 100644 --- a/include/linux/key-type.h +++ b/include/linux/key-type.h @@ -44,7 +44,7 @@ struct key_preparsed_payload { const void *data; /* Raw data */ size_t datalen;/* Raw datalen */ size_t quotalen; /* Quota length for proposed payload */ - time_t expiry; /* Expiry time of key */ + time64_texpiry; /* Expiry time of key */ booltrusted;/* True if key is trusted */ }; diff --git a/include/linux/key.h b/include/linux/key.h index 66f7052..6f69a25 100644 --- a/include/linux/key.h +++ b/include/linux/key.h @@ -145,10 +145,10 @@ struct key { struct key_user *user; /* owner of this key */ void*security; /* security data for this key */ union { - time_t expiry; /* time at which key expires (or 0) */ - time_t revoked_at; /* time at which key was revoked */ + time64_texpiry; /* time at which key expires (or 0) */ + time64_trevoked_at; /* time at which key was revoked */ }; - time_t last_used_at; /* last time used for LRU keyring discard */ + time64_tlast_used_at; /* last time used for LRU keyring discard */ kuid_t uid; kgid_t gid; key_perm_t perm; /* access permissions */ diff --git a/security/keys/gc.c b/security/keys/gc.c index addf060..a467a61 100644 --- a/security/keys/gc.c +++ b/security/keys/gc.c @@ -32,7 +32,7 @@ DECLARE_WORK(key_gc_work, key_garbage_collector); static void key_gc_timer_func(unsigned long); static DEFINE_TIMER(key_gc_timer, key_gc_timer_func, 0, 0); -static time_t key_gc_next_run = LONG_MAX; +static time64_t key_gc_next_run = S64_MAX; static struct key_type *key_gc_dead_keytype; static unsigned long key_gc_flags; @@ -53,12 +53,12 @@ struct key_type key_type_dead = { * Schedule a garbage collection run. * - time precision isn't particularly important */ -void key_schedule_gc(time_t gc_at) +void key_schedule_gc(time64_t gc_at) { unsigned long expires; - time_t now = current_kernel_time().tv_sec; + time64_t now = ktime_get_real_seconds(); - kenter("%ld", gc_at - now); + kenter("%ld", (long)(gc_at - now)); if (gc_at <= now || test_bit(KEY_GC_REAP_KEYTYPE, _gc_flags)) { kdebug("IMMEDIATE"); @@ -87,7 +87,7 @@ void key_schedule_gc_links(void) static void key_gc_timer_func(unsigned long data) { kenter(""); - key_gc_next_run = LONG_MAX; + key_gc_next_run = S64_MAX; key_schedule_gc_links(); } @@ -186,11 +186,11 @@ static void key_garbage_collector(struct work_struct *work) struct rb_node *cursor; struct key *key; - time_t new_timer, limit; + time64_t new_timer, limit; kenter("[%lx,%x]", key_gc_flags, gc_state); - limit = current_kernel_time().tv_sec; + limit = ktime_get_real_seconds(); if (limit > key_gc_delay) limit -= key_gc_delay; else @@ -206,7 +206,7 @@ static void key_garbage_collector(struct work_struct *work) gc_state |= KEY_GC_REAPING_DEAD_1; kdebug("new pass %x", gc_state); - new_timer = LONG_MAX; + new_timer = S64_MAX; /* As only this function is permitted to remove things from the key * serial tree, if cursor is non-NULL then it will always point to a @@ -234,8 +234,9 @@ continue_scanning: if (gc_state & KEY_GC_SET_TIMER) { if (key->expiry > limit && key->expiry < new_timer) { -
Re: [Y2038] [PATCH] net: dns_resolver: convert time_t to time64_t
On Tuesday 17 November 2015 22:56:48 Aya Mahfouz wrote: > Changes the defintion of the pointer _expiry from time_t to > time64_t. This is to handle the Y2038 problem where time_t > will overflow in 2038. The change is safe because the kernel > subsystems that call dns_query pass NULL. > > Signed-off-by: Arnd Bergmann> Signed-off-by: Aya Mahfouz Looks good. Arnd ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038
Re: [Y2038] [PATCH] net: dns_resolver: convert time_t to time64_t
On Tue, Nov 17, 2015 at 11:18:36PM +0100, Arnd Bergmann wrote: > On Tuesday 17 November 2015 22:56:48 Aya Mahfouz wrote: > > Changes the defintion of the pointer _expiry from time_t to > > time64_t. This is to handle the Y2038 problem where time_t > > will overflow in 2038. The change is safe because the kernel > > subsystems that call dns_query pass NULL. > > > > Signed-off-by: Arnd Bergmann> > Signed-off-by: Aya Mahfouz > > Looks good. > > Arnd ok. I will send it. Let me know your concerns for the other patch too. Thank you, -- Kind Regards, Aya Saif El-yazal Mahfouz ___ Y2038 mailing list Y2038@lists.linaro.org https://lists.linaro.org/mailman/listinfo/y2038