linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: y2038@lists.linaro.org
Cc: baolin.wang@linaro.org, tglx@linutronix.de,
	albert.aribaud@3adev.fr, john.stultz@linaro.org,
	bamvor.zhangjian@linaro.org, ruchandani.tina@gmail.com,
	linux-api@vger.kernel.org, linux-kernel@vger.kernel.org,
	libc-alpha@sourceware.org, Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH 14/19] y2038: use __kernel_timespec for sys_mq_timed{send,receive}
Date: Wed,  6 May 2015 18:30:21 +0200	[thread overview]
Message-ID: <1430929826-318934-15-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1430929826-318934-1-git-send-email-arnd@arndb.de>

This performs a complete conversion of the ipc/mqueue code to
use 64-bit time_t both internally and on the user-facing side
of 32-bit architectures that use CONFIG_COMPAT_TIME. For
compatibility with existing user space, these now use
compat_sys_mq_timed{send,receive}.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/audit.h    |  4 ++--
 include/linux/syscalls.h |  4 ++--
 ipc/mqueue.c             | 16 ++++++++--------
 kernel/audit.h           |  2 +-
 kernel/auditsc.c         | 14 +++++++-------
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/include/linux/audit.h b/include/linux/audit.h
index c2e7e3a83965..ab696322bb72 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -242,7 +242,7 @@ extern int __audit_socketcall(int nargs, unsigned long *args);
 extern int __audit_sockaddr(int len, void *addr);
 extern void __audit_fd_pair(int fd1, int fd2);
 extern void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr);
-extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout);
+extern void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec64 *abs_timeout);
 extern void __audit_mq_notify(mqd_t mqdes, const struct sigevent *notification);
 extern void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
 extern int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
@@ -288,7 +288,7 @@ static inline void audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
 	if (unlikely(!audit_dummy_context()))
 		__audit_mq_open(oflag, mode, attr);
 }
-static inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout)
+static inline void audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec64 *abs_timeout)
 {
 	if (unlikely(!audit_dummy_context()))
 		__audit_mq_sendrecv(mqdes, msg_len, msg_prio, abs_timeout);
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index c2a70a8f907d..c3f15b5a9b79 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -675,8 +675,8 @@ asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second,
 
 asmlinkage long sys_mq_open(const char __user *name, int oflag, umode_t mode, struct mq_attr __user *attr);
 asmlinkage long sys_mq_unlink(const char __user *name);
-asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout);
-asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout);
+asmlinkage long sys_mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct __kernel_timespec __user *abs_timeout);
+asmlinkage long sys_mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct __kernel_timespec __user *abs_timeout);
 asmlinkage long sys_mq_notify(mqd_t mqdes, const struct sigevent __user *notification);
 asmlinkage long sys_mq_getsetattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat);
 
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 3aaea7ffd077..f3f27ad1ca44 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -672,15 +672,15 @@ static void __do_notify(struct mqueue_inode_info *info)
 	wake_up(&info->wait_q);
 }
 
-static int prepare_timeout(const struct timespec __user *u_abs_timeout,
-			   ktime_t *expires, struct timespec *ts)
+static int prepare_timeout(const struct __kernel_timespec __user *u_abs_timeout,
+			   ktime_t *expires, struct timespec64 *ts)
 {
-	if (copy_from_user(ts, u_abs_timeout, sizeof(struct timespec)))
+	if (get_timespec64(ts, u_abs_timeout))
 		return -EFAULT;
 	if (!timespec_valid(ts))
 		return -EINVAL;
 
-	*expires = timespec_to_ktime(*ts);
+	*expires = timespec64_to_ktime(*ts);
 	return 0;
 }
 
@@ -953,7 +953,7 @@ static inline void pipelined_receive(struct mqueue_inode_info *info)
 
 SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr,
 		size_t, msg_len, unsigned int, msg_prio,
-		const struct timespec __user *, u_abs_timeout)
+		const struct __kernel_timespec __user *, u_abs_timeout)
 {
 	struct fd f;
 	struct inode *inode;
@@ -962,7 +962,7 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr,
 	struct msg_msg *msg_ptr;
 	struct mqueue_inode_info *info;
 	ktime_t expires, *timeout = NULL;
-	struct timespec ts;
+	struct timespec64 ts;
 	struct posix_msg_tree_node *new_leaf = NULL;
 	int ret = 0;
 
@@ -1073,7 +1073,7 @@ out:
 
 SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr,
 		size_t, msg_len, unsigned int __user *, u_msg_prio,
-		const struct timespec __user *, u_abs_timeout)
+		const struct __kernel_timespec __user *, u_abs_timeout)
 {
 	ssize_t ret;
 	struct msg_msg *msg_ptr;
@@ -1082,7 +1082,7 @@ SYSCALL_DEFINE5(mq_timedreceive, mqd_t, mqdes, char __user *, u_msg_ptr,
 	struct mqueue_inode_info *info;
 	struct ext_wait_queue wait;
 	ktime_t expires, *timeout = NULL;
-	struct timespec ts;
+	struct timespec64 ts;
 	struct posix_msg_tree_node *new_leaf = NULL;
 
 	if (u_abs_timeout) {
diff --git a/kernel/audit.h b/kernel/audit.h
index d641f9bb3ed0..b83e7aaca647 100644
--- a/kernel/audit.h
+++ b/kernel/audit.h
@@ -179,7 +179,7 @@ struct audit_context {
 			mqd_t			mqdes;
 			size_t			msg_len;
 			unsigned int		msg_prio;
-			struct timespec		abs_timeout;
+			struct timespec64	abs_timeout;
 		} mq_sendrecv;
 		struct {
 			int			oflag;
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 9fb9d1cb83ce..6af873dcad55 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1230,12 +1230,12 @@ static void show_special(struct audit_context *context, int *call_panic)
 	case AUDIT_MQ_SENDRECV: {
 		audit_log_format(ab,
 			"mqdes=%d msg_len=%zd msg_prio=%u "
-			"abs_timeout_sec=%ld abs_timeout_nsec=%ld",
+			"abs_timeout_sec=%lld abs_timeout_nsec=%lld",
 			context->mq_sendrecv.mqdes,
 			context->mq_sendrecv.msg_len,
 			context->mq_sendrecv.msg_prio,
-			context->mq_sendrecv.abs_timeout.tv_sec,
-			context->mq_sendrecv.abs_timeout.tv_nsec);
+			(s64)context->mq_sendrecv.abs_timeout.tv_sec,
+			(s64)context->mq_sendrecv.abs_timeout.tv_nsec);
 		break; }
 	case AUDIT_MQ_NOTIFY: {
 		audit_log_format(ab, "mqdes=%d sigev_signo=%d",
@@ -2062,15 +2062,15 @@ void __audit_mq_open(int oflag, umode_t mode, struct mq_attr *attr)
  *
  */
 void __audit_mq_sendrecv(mqd_t mqdes, size_t msg_len, unsigned int msg_prio,
-			const struct timespec *abs_timeout)
+			const struct timespec64 *abs_timeout)
 {
 	struct audit_context *context = current->audit_context;
-	struct timespec *p = &context->mq_sendrecv.abs_timeout;
+	struct timespec64 *p = &context->mq_sendrecv.abs_timeout;
 
 	if (abs_timeout)
-		memcpy(p, abs_timeout, sizeof(struct timespec));
+		memcpy(p, abs_timeout, sizeof(struct timespec64));
 	else
-		memset(p, 0, sizeof(struct timespec));
+		memset(p, 0, sizeof(struct timespec64));
 
 	context->mq_sendrecv.mqdes = mqdes;
 	context->mq_sendrecv.msg_len = msg_len;
-- 
2.1.0.rc2

  parent reply	other threads:[~2015-05-06 16:30 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 16:30 [PATCH 00/19] converting system calls to 64-bit time_t, part 1 Arnd Bergmann
2015-05-06 16:30 ` [PATCH 01/19] compat: remove compat_printk Arnd Bergmann
2015-05-06 16:30 ` [PATCH 02/19] initramfs: use vfs_stat/lstat directly Arnd Bergmann
2015-05-06 16:30 ` [PATCH 03/19] y2038: introduce linux/compat_time.h header Arnd Bergmann
2015-05-06 16:30 ` [PATCH 04/19] y2038: introduce CONFIG_COMPAT_TIME Arnd Bergmann
2015-05-06 16:30 ` [PATCH 05/19] y2038: make linux/compat_time.h usable on 32-bit Arnd Bergmann
2015-05-06 16:30 ` [PATCH 07/19] y2038: add compat_sys_rt_sigtimedwait variants Arnd Bergmann
2015-05-06 16:30 ` [PATCH 08/19] y2038: introduce struct __kernel_timespec Arnd Bergmann
     [not found] ` <1430929826-318934-1-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>
2015-05-06 16:30   ` [PATCH 06/19] y2038: compile compat time code even when CONFIG_COMPAT is not set Arnd Bergmann
2015-05-06 16:30   ` [PATCH 09/19] y2038: introduce struct __kernel_stat Arnd Bergmann
2015-05-06 16:30   ` [PATCH 11/19] y2038: introduce and use struct __kernel_rusage Arnd Bergmann
2015-05-07  7:27   ` [PATCH 00/19] converting system calls to 64-bit time_t, part 1 Paul Bolle
2015-05-07  7:39     ` Paul Bolle
2015-05-07  8:52       ` Arnd Bergmann
2015-05-07  9:24         ` Paul Bolle
2015-05-06 16:30 ` [PATCH 10/19] y2038: use __kernel_stat for sys_newstat syscalls Arnd Bergmann
2015-05-06 16:30 ` [PATCH 12/19] y2038: add compat_{get,put}_timespec64 Arnd Bergmann
2015-05-06 16:30 ` [PATCH 13/19] y2038: add compat handling for sys_semtimedop Arnd Bergmann
     [not found]   ` <1430929826-318934-14-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>
2015-05-15 22:46     ` Thomas Gleixner
2015-05-16  7:28       ` Arnd Bergmann
2015-05-16 19:54       ` Arnd Bergmann
2015-05-19  9:19         ` Thomas Gleixner
2015-05-06 16:30 ` Arnd Bergmann [this message]
2015-05-06 16:30 ` [PATCH 15/19] y2038: introduce timespec64_to_jiffies Arnd Bergmann
2015-05-19  9:28   ` Thomas Gleixner
2015-05-06 16:30 ` [PATCH 16/19] y2038: use __kernel_timespec in sys_rt_sigtimedwait Arnd Bergmann
2015-05-19  9:28   ` Thomas Gleixner
2015-05-06 16:30 ` [PATCH 17/19] y2038: use __kernel_timespec in sys_futex Arnd Bergmann
2015-05-15 22:53   ` Thomas Gleixner
2015-05-16  7:21     ` Thomas Gleixner
     [not found]   ` <1430929826-318934-18-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>
2015-05-19  9:24     ` Thomas Gleixner
2015-05-06 16:30 ` [PATCH 18/19] y2038: introduce jiffies_to_timespec64 Arnd Bergmann
     [not found]   ` <1430929826-318934-19-git-send-email-arnd-r2nGTMty4D4@public.gmane.org>
2015-05-19  9:25     ` Thomas Gleixner
2015-05-06 16:30 ` [PATCH 19/19] y2038: use __kernel_timespec in sys_sched_rr_get_interval Arnd Bergmann
2015-05-19  9:27   ` Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430929826-318934-15-git-send-email-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=albert.aribaud@3adev.fr \
    --cc=bamvor.zhangjian@linaro.org \
    --cc=baolin.wang@linaro.org \
    --cc=john.stultz@linaro.org \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ruchandani.tina@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).