y2038: ipc: Report long times to user space
The shmid64_ds/semid64_ds/msqid64_ds data structures have been extended to contain extra fields for storing the upper bits of the time stamps, this patch does the other half of the job and and fills the new fields on 32-bit architectures as well as 32-bit tasks running on a 64-bit kernel in compat mode. There should be no change for native 64-bit tasks. Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
14
ipc/sem.c
14
ipc/sem.c
@@ -1214,6 +1214,7 @@ static int semctl_stat(struct ipc_namespace *ns, int semid,
|
||||
int cmd, struct semid64_ds *semid64)
|
||||
{
|
||||
struct sem_array *sma;
|
||||
time64_t semotime;
|
||||
int id = 0;
|
||||
int err;
|
||||
|
||||
@@ -1257,8 +1258,13 @@ static int semctl_stat(struct ipc_namespace *ns, int semid,
|
||||
}
|
||||
|
||||
kernel_to_ipc64_perm(&sma->sem_perm, &semid64->sem_perm);
|
||||
semid64->sem_otime = get_semotime(sma);
|
||||
semotime = get_semotime(sma);
|
||||
semid64->sem_otime = semotime;
|
||||
semid64->sem_ctime = sma->sem_ctime;
|
||||
#ifndef CONFIG_64BIT
|
||||
semid64->sem_otime_high = semotime >> 32;
|
||||
semid64->sem_ctime_high = sma->sem_ctime >> 32;
|
||||
#endif
|
||||
semid64->sem_nsems = sma->sem_nsems;
|
||||
|
||||
ipc_unlock_object(&sma->sem_perm);
|
||||
@@ -1704,8 +1710,10 @@ static int copy_compat_semid_to_user(void __user *buf, struct semid64_ds *in,
|
||||
struct compat_semid64_ds v;
|
||||
memset(&v, 0, sizeof(v));
|
||||
to_compat_ipc64_perm(&v.sem_perm, &in->sem_perm);
|
||||
v.sem_otime = in->sem_otime;
|
||||
v.sem_ctime = in->sem_ctime;
|
||||
v.sem_otime = lower_32_bits(in->sem_otime);
|
||||
v.sem_otime_high = upper_32_bits(in->sem_otime);
|
||||
v.sem_ctime = lower_32_bits(in->sem_ctime);
|
||||
v.sem_ctime_high = upper_32_bits(in->sem_ctime);
|
||||
v.sem_nsems = in->sem_nsems;
|
||||
return copy_to_user(buf, &v, sizeof(v));
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user