From patchwork Tue Sep 29 22:14:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 7291121 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8F5639F1D5 for ; Tue, 29 Sep 2015 22:37:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 12899205E8 for ; Tue, 29 Sep 2015 22:37:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 89D75205E5 for ; Tue, 29 Sep 2015 22:37:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zh3VU-0006Ky-No; Tue, 29 Sep 2015 22:36:20 +0000 Received: from mail-by2on0098.outbound.protection.outlook.com ([207.46.100.98] helo=na01-by2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zh3F1-0004Y4-11 for linux-arm-kernel@lists.infradead.org; Tue, 29 Sep 2015 22:19:19 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (91.78.158.8) by DM2PR07MB623.namprd07.prod.outlook.com (10.141.177.148) with Microsoft SMTP Server (TLS) id 15.1.280.20; Tue, 29 Sep 2015 22:18:57 +0000 From: Yury Norov To: , , , , , Subject: [PATCH v5 22/23] aarch64: ilp32: msgrcv, msgsnd handlers Date: Wed, 30 Sep 2015 01:14:19 +0300 Message-ID: <1443564860-31208-23-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1443564860-31208-1-git-send-email-ynorov@caviumnetworks.com> References: <1443564860-31208-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [91.78.158.8] X-ClientProxiedBy: AM3PR07CA0011.eurprd07.prod.outlook.com (10.141.45.139) To DM2PR07MB623.namprd07.prod.outlook.com (10.141.177.148) X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB623; 2:v+dikuPbGkhW51KKs0/Q3NMVvmzUMyRyiKEO3SOxy9y0t/IkUBSEBEzAgaJg96RMGvLxetQ3FsBHzG1Rae6Abm1IK9dwf9WAHLrzH7t2g5QZsWj5TI0aPlQjS+nePqVinTw7zxVLOY5w0FJa97msGOZ+v2HsVv4b33LG3J8UMkA=; 3:fBoy77XAaKYEhGep0HwvB6JCGA8kjjxoyhP0Ktqp57actlYkzsEUoLG2cjqwUx47zFj+wY3yrxQGB5WHhOKo3N/IQLh9zfHFyfAfyhYcQGQ29UUS51mQU2H49gLjFKQ/p3OI0x1n+PKh6N+PouPTFw==; 25:flaIbKOiHeYMQ4QY3JcTOyIH3TnLzOHiURIkle/65f0g4gntfdbih4JfuFeYajUwFLZ22lzHfapXGlMA91DLB+xdKoQhsRsKvK3ubFWmRX5X1zKVx/9n/h+SNbP6BOfgXVo2c6gHsFaPl3TZGrR3MIkbtcoeb4T32LIOJ7mZV0MzNqrYqD7F78nuYfET8umzVNy93QG+fVsfCLxl8/ExMc9MFGovUUlJK3+gFn2a5/8HX0YXTqHPVANWJ0BfxIdbwE19hv9tJcNvIgHmS5WB4Q== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR07MB623; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB623; 20:J0APkaDxCTPY/PfYvTW+7ID1vldXPXZDpMF4ghJ58hf6SBBSbaqsCw7fiJJgTgAF+hPx4GHvDmULonOnaY0NbK762s3+1V96VfdEf7QtF49XRNA/QyXc+2GRtZFWw6SFxAc0jBzFh5g+DLR3K80lXmuKtYMZ3ku1JfU3vPVM2nRirdkFJer9HvAx7+McxRxhe1K6l88G5s/1mB6HL2jJLkxSWVBRnyuzEl5PjKGmCkiRkDP24yiI8DWMM31QEO50esiH+yGLlwOvl8KjYBod5fNiXjGf/hdzfsdecTebCDQCMI1BpuBaNVdUkXrrcSAv8Y7WgU+p3jetgfIqwEZw5xSGNMpIGw02sdNf/YkO8O2hTmpry2pwhsiDSEHTmADBDWAoQJ6sXp6z52zc4WHaxW82apvs9tJ7vN4lnrMif3gG6AFi4/IEWs4/EnpyH6CEVJYMFzTwAilmKtnm8E6nKPjE7PDI4/jK8MBg8waVjkd/cVaqRB2IQGBBbmOQJx6+ueQmGSRs8Q0iBig3oWYg27czmyFT2I7aw5LEihrxtnfTmReplM2D1LGlQhLKXmxv4oV++USuGM3yLqbmzIH7EbNda7cw7S86FVATf3n26HU= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001); SRVR:DM2PR07MB623; BCL:0; PCL:0; RULEID:; SRVR:DM2PR07MB623; X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB623; 4:0SjNLBX403U0mHvRIqBO095o5AICdIsLnC/aTGzrtc9yYXDZac46yhNzNPHJRmm8KFQb5MZwITwKkJVrZ6LUm8SirnCG55VuGNLX43ROQc1/9okSWo7UoohfNy0kNbnCeYfkPfa5yQzHYx1t6oPCLsINjQjyVRf0k0UnoF8ZpgpLWDJbo5f7z77JBGFBgfUfCR5/07YNu1uKcgLnEm+XAVBIkZwVIV+v9detU9lxlxHC2zrX6yrK8752B+PQ0zeMKz00N8T8YYHqOKxagTCbfTghkuKRPnHKFyaZ7LUEBBvoLSb6gWXHcEGh6RVSVokuh6ChPX62bMn8ClsN7hJYss2icM/zo80qcCvY244Xkyw= X-Forefront-PRVS: 0714841678 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(189002)(199003)(48376002)(107886002)(2950100001)(19580405001)(64706001)(229853001)(97736004)(19580395003)(66066001)(106356001)(92566002)(77096005)(33646002)(47776003)(77156002)(76506005)(42186005)(87976001)(68736005)(62966003)(105586002)(50986999)(40100003)(46102003)(2201001)(101416001)(50466002)(4001540100001)(81156007)(76176999)(5003940100001)(5001830100001)(5001860100001)(5007970100001)(189998001)(5001960100002)(5004730100002)(5001770100001)(5001920100001)(36756003)(50226001)(5008740100001)(122386002)(40753002)(2101003)(4001430100001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR07MB623; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR07MB623; 23:Do4+mG8anVEIPT2t5+6FRhYra1eutxljZq/LCPqznC?= =?us-ascii?Q?HntZJj3b59w9yxds6fWJmHJA93N0V8cWUxDpyIT97eU6jt2WinJzMW/zKX6h?= =?us-ascii?Q?gol6+Dq01efMlhAs20o9NPMeurhA2sVciwS6JcoEra/P7hWePVTk68xKQICf?= =?us-ascii?Q?3IF1fJSSoAdzlTThYRoB+SLGAP3RTtAlfp0saQo3Hyv4UWJBq1Z9pQNdo1e/?= =?us-ascii?Q?fEoj+f3M4oikcJiIhNnbaF9NwR6DeWNiQmkt8VHgLoy25ejJS2jMAfRtkRdi?= =?us-ascii?Q?hFlBewLpOVtmhw22SA9Dfg8j64cNaHzOhGYJtk46GEPYQMfaRI9/OT6zquTG?= =?us-ascii?Q?bnWqB51ykQteAdketRaOh89Ni1FOay6pr7QwqiuCSyHzcRmF2ymH1iSNOu/+?= =?us-ascii?Q?G8vS5YSe5TiFjeh+ui5tJjUVZkY/6Df9tiIITFWlT3+mU5v/+OD2GeOQN60a?= =?us-ascii?Q?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jVEoPleaKf4knpVUkUWn?= =?us-ascii?Q?g5Nw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR07MB623; 5:+IQ5506NP2j8XNruuqbnCpFOmNbpjLCNxjZqW7oiyGb/ZnzDohjQExDdJPXhgm8ypDNRKXsCuqwenqfLLGXL1nmIKcTZOR71MbeCxplpn/0w5TrjCBIuzTa53A+bwMf+/3nonmC4FDc285ZdR/330w==; 24:YzgW+3Rq5fGlEai3ViFXtLrjead7ppb4rO7ILWWbIcY5zIQqs9Fz4rQhWs2511JRXxJZPlaoUNDXTkFWYo0Asr0mlbZ1eBRwUBZCYhBDURw=; 20:XTz7WG64uiIVpOX/T6qHFlKeg4OueOHz5r7JTXdOQpzTGR+AZrv2x5hWfraQ0QD4XR0WCEoe9kA9/XI7i2aTsQ== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Sep 2015 22:18:57.7077 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR07MB623 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150929_151919_291062_0A3C8F61 X-CRM114-Status: UNSURE ( 7.25 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yury.norov@gmail.com, klimov.linux@gmail.com, Yury Norov , apinski@cavium.com, philipp.tomsich@theobroma-systems.com, christoph.muellner@theobroma-systems.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 msgsnd and msgrcv syscall arguments are different in lp64 and ilp32 ABIs. In this patch, ilp32-specific handlers introduced to take it into account. Signed-off-by: Yury Norov diff --git a/arch/arm64/kernel/sys_ilp32.c b/arch/arm64/kernel/sys_ilp32.c index 623191a..09605be 100644 --- a/arch/arm64/kernel/sys_ilp32.c +++ b/arch/arm64/kernel/sys_ilp32.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -158,6 +159,50 @@ long ilp32_sys_sigaltstack(const stack_t __user *uss_ptr, for stack_t might not be non-zero. */ #define sys_sigaltstack ilp32_sys_sigaltstack +struct ilp32_msgbuf { + s32 mtype; /* type of message */ + char mtext[1]; /* message text */ +}; + +long ilp32_sys_msgsnd(s32 msqid, struct ilp32_msgbuf __user *msgp, s32 msgsz, s32 msgflg) +{ + long mtype; + + if (msgsz < 0) + return -EINVAL; + + if (get_user(mtype, &msgp->mtype)) + return -EFAULT; + return do_msgsnd(msqid, mtype, msgp->mtext, msgsz, msgflg); +} + +#define sys_msgsnd ilp32_sys_msgsnd + +extern int store_msg(void __user *dest, struct msg_msg *msg, size_t len); +static long ilp32_do_msg_fill(void __user *dest, struct msg_msg *msg, size_t bufsz) +{ + struct ilp32_msgbuf __user *msgp = dest; + size_t msgsz; + + if (put_user(msg->m_type, &msgp->mtype)) + return -EFAULT; + + msgsz = (bufsz > msg->m_ts) ? msg->m_ts : bufsz; + if (store_msg(msgp->mtext, msg, msgsz)) + return -EFAULT; + return msgsz; +} + +long ilp32_sys_msgrcv(s32 msqid, struct ilp32_msgbuf __user *msgp, s32 msgsz, + s32 msgtyp, s32 msgflg) +{ + if (msgsz < 0) + return -EINVAL; + + return do_msgrcv(msqid, msgp, msgsz, msgtyp, msgflg, ilp32_do_msg_fill); +} + +#define sys_msgrcv ilp32_sys_msgrcv #include