aboutsummaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorDeepa Dinamani <deepa.kernel@gmail.com>2017-08-02 22:51:14 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2017-09-03 20:24:29 -0400
commit7ff2819e8dd5b528887dfbe4ff395f5d2142edff (patch)
tree5107f4eddf48f3ef4333aa5380096273b53d7580 /ipc
parente54d02b23c5eed3aa0ffe54e659dfe1c9084c262 (diff)
ipc: shm: Make shmid_kernel timestamps y2038 safe
time_t is not y2038 safe. Replace all uses of time_t by y2038 safe time64_t. Similarly, replace the calls to get_seconds() with y2038 safe ktime_get_real_seconds(). Note that this preserves fast access on 64 bit systems, but 32 bit systems need sequence counters. The syscall interfaces themselves are not changed as part of the patch. They will be part of a different series. Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/shm.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ipc/shm.c b/ipc/shm.c
index 342024de3b9d..f3d6408d6de1 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -200,7 +200,7 @@ static int __shm_open(struct vm_area_struct *vma)
200 if (IS_ERR(shp)) 200 if (IS_ERR(shp))
201 return PTR_ERR(shp); 201 return PTR_ERR(shp);
202 202
203 shp->shm_atim = get_seconds(); 203 shp->shm_atim = ktime_get_real_seconds();
204 shp->shm_lprid = task_tgid_vnr(current); 204 shp->shm_lprid = task_tgid_vnr(current);
205 shp->shm_nattch++; 205 shp->shm_nattch++;
206 shm_unlock(shp); 206 shm_unlock(shp);
@@ -287,7 +287,7 @@ static void shm_close(struct vm_area_struct *vma)
287 goto done; /* no-op */ 287 goto done; /* no-op */
288 288
289 shp->shm_lprid = task_tgid_vnr(current); 289 shp->shm_lprid = task_tgid_vnr(current);
290 shp->shm_dtim = get_seconds(); 290 shp->shm_dtim = ktime_get_real_seconds();
291 shp->shm_nattch--; 291 shp->shm_nattch--;
292 if (shm_may_destroy(ns, shp)) 292 if (shm_may_destroy(ns, shp))
293 shm_destroy(ns, shp); 293 shm_destroy(ns, shp);
@@ -592,7 +592,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
592 shp->shm_cprid = task_tgid_vnr(current); 592 shp->shm_cprid = task_tgid_vnr(current);
593 shp->shm_lprid = 0; 593 shp->shm_lprid = 0;
594 shp->shm_atim = shp->shm_dtim = 0; 594 shp->shm_atim = shp->shm_dtim = 0;
595 shp->shm_ctim = get_seconds(); 595 shp->shm_ctim = ktime_get_real_seconds();
596 shp->shm_segsz = size; 596 shp->shm_segsz = size;
597 shp->shm_nattch = 0; 597 shp->shm_nattch = 0;
598 shp->shm_file = file; 598 shp->shm_file = file;
@@ -846,7 +846,7 @@ static int shmctl_down(struct ipc_namespace *ns, int shmid, int cmd,
846 err = ipc_update_perm(&shmid64->shm_perm, ipcp); 846 err = ipc_update_perm(&shmid64->shm_perm, ipcp);
847 if (err) 847 if (err)
848 goto out_unlock0; 848 goto out_unlock0;
849 shp->shm_ctim = get_seconds(); 849 shp->shm_ctim = ktime_get_real_seconds();
850 break; 850 break;
851 default: 851 default:
852 err = -EINVAL; 852 err = -EINVAL;
@@ -1586,7 +1586,7 @@ static int sysvipc_shm_proc_show(struct seq_file *s, void *it)
1586 1586
1587 seq_printf(s, 1587 seq_printf(s,
1588 "%10d %10d %4o " SIZE_SPEC " %5u %5u " 1588 "%10d %10d %4o " SIZE_SPEC " %5u %5u "
1589 "%5lu %5u %5u %5u %5u %10lu %10lu %10lu " 1589 "%5lu %5u %5u %5u %5u %10llu %10llu %10llu "
1590 SIZE_SPEC " " SIZE_SPEC "\n", 1590 SIZE_SPEC " " SIZE_SPEC "\n",
1591 shp->shm_perm.key, 1591 shp->shm_perm.key,
1592 shp->shm_perm.id, 1592 shp->shm_perm.id,