From patchwork Sun Mar 15 20:00:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helge Deller X-Patchwork-Id: 6013751 Return-Path: X-Original-To: patchwork-linux-parisc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E8BACBF90F for ; Sun, 15 Mar 2015 20:01:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D65C3202E6 for ; Sun, 15 Mar 2015 20:01:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CE4B1201F4 for ; Sun, 15 Mar 2015 20:01:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751638AbbCOUBC (ORCPT ); Sun, 15 Mar 2015 16:01:02 -0400 Received: from mout.gmx.net ([212.227.15.18]:58349 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751296AbbCOUBB (ORCPT ); Sun, 15 Mar 2015 16:01:01 -0400 Received: from ls3530.box ([92.203.2.169]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0M1F72-1ZQ2Bp2PQe-00tDp0; Sun, 15 Mar 2015 21:00:46 +0100 Date: Sun, 15 Mar 2015 21:00:41 +0100 From: Helge Deller To: linux-parisc@vger.kernel.org, James Bottomley , John David Anglin Cc: Catalin Marinas , Bamvor Jian Zhang Subject: [PATCH] parisc: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian Message-ID: <20150315200041.GA10927@ls3530.box> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-Provags-ID: V03:K0:bdTUrYy7eKK1Brx+6Kegmd8Kc2EfrqmV5MEBz4LnpOcXggruzNo Ro7an4Np5UHDgbcTn2qP2UpisbfWkRUi1q6jri2+VciOqXF7ur3foY5X2obeDyJf+h+0WId Npw1jjzOqCd30jmsIiU+DZi5+4FV5jH/uA3abyf91J8oTBufBTfLKgFoM6XIf2+XOUz6f66 AMq7TcR6PGmYuXTh7JWVw== X-UI-Out-Filterresults: notjunk:1; Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch is basically the same as commit 9d42d48 from Catalin Marinas but adopted to the parisc architecture. The native (64-bit) sigval_t union contains sival_int (32-bit) and sival_ptr (64-bit). When a compat application invokes a syscall that takes a sigval_t value (as part of a larger structure, e.g. compat_sys_mq_notify, compat_sys_timer_create), the compat_sigval_t union is converted to the native sigval_t with sival_int overlapping with either the least or the most significant half of sival_ptr, depending on endianness. When the corresponding signal is delivered to a compat application, on big endian the current (compat_uptr_t)sival_ptr cast always returns 0 since sival_int corresponds to the top part of sival_ptr. This patch fixes copy_siginfo_to_user32() so that sival_int is copied to the compat_siginfo_t structure. Cc: Reported-by: Bamvor Jian Zhang Signed-off-by: Helge Deller --- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/parisc/kernel/signal32.c b/arch/parisc/kernel/signal32.c index 984abbe..d1f1fcd 100644 --- a/arch/parisc/kernel/signal32.c +++ b/arch/parisc/kernel/signal32.c @@ -322,7 +322,6 @@ int copy_siginfo_to_user32 (compat_siginfo_t __user *to, const siginfo_t *from) { compat_uptr_t addr; - compat_int_t val; int err; if (!access_ok(VERIFY_WRITE, to, sizeof(compat_siginfo_t))) @@ -361,15 +360,13 @@ copy_siginfo_to_user32 (compat_siginfo_t __user *to, const siginfo_t *from) case __SI_TIMER >> 16: err |= __put_user(from->si_tid, &to->si_tid); err |= __put_user(from->si_overrun, &to->si_overrun); - val = (compat_int_t)from->si_int; - err |= __put_user(val, &to->si_int); + err |= __put_user(from->si_int, &to->si_int); break; case __SI_RT >> 16: /* Not generated by the kernel as of now. */ case __SI_MESGQ >> 16: err |= __put_user(from->si_uid, &to->si_uid); err |= __put_user(from->si_pid, &to->si_pid); - val = (compat_int_t)from->si_int; - err |= __put_user(val, &to->si_int); + err |= __put_user(from->si_int, &to->si_int); break; } }