From patchwork Wed May 6 16:30:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 469030 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8DEAE14030A for ; Thu, 7 May 2015 02:32:50 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sourceware.org header.i=@sourceware.org header.b=m0utoAyJ; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=AoYITZsPFQ+0Ykg+7A6o2spZkVivNO/ CngCSAc88+DX25/qbkgzZgx1P25SZTUl6tCODaRvyKxnxXB3C2dR/UeucS/tsVY0 Ro4QDkgSK25ghb20Z16Gh711SJbcIKVX/B1VtSNgL8Q8Pf2Mr/5YE4pOTkf4DU9i nwj7PJ6dkEXw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=pTawkUy9ruc8jliyeHFN1Dn4Vgk=; b=m0uto AyJx+fElI/ZVwJ2D4BvzVNdwWJ/WLjFPAp05dSgciOsTMmfMMYPyiMxgQRDQ2qqd s29veeJUNlZ0tvz75OXbUwGESHrt6GsgjcUAYlpwhcqEEg4+nIxdzcCcAdrrklCH k6gObVR79Zgsq+Xg8iSIMSalkw3BOEZQtgK4Qc= Received: (qmail 71557 invoked by alias); 6 May 2015 16:30:50 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 71472 invoked by uid 89); 6 May 2015 16:30:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 X-HELO: mout.kundenserver.de From: Arnd Bergmann 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 Subject: [PATCH 14/19] y2038: use __kernel_timespec for sys_mq_timed{send, receive} Date: Wed, 6 May 2015 18:30:21 +0200 Message-Id: <1430929826-318934-15-git-send-email-arnd@arndb.de> In-Reply-To: <1430929826-318934-1-git-send-email-arnd@arndb.de> References: <1430929826-318934-1-git-send-email-arnd@arndb.de> X-UI-Out-Filterresults: notjunk:1; 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 --- 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;