From patchwork Tue Nov 17 21:16:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 7642391 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 E4F969F2EC for ; Tue, 17 Nov 2015 21:26:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E138F2041A for ; Tue, 17 Nov 2015 21:25:59 +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 08F2220412 for ; Tue, 17 Nov 2015 21:25:59 +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 1ZynjV-0003c8-El; Tue, 17 Nov 2015 21:24:09 +0000 Received: from mail-bl2on0067.outbound.protection.outlook.com ([65.55.169.67] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zynhk-0001yv-7P for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2015 21:22:24 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.120) by CO2PR07MB619.namprd07.prod.outlook.com (10.141.228.151) with Microsoft SMTP Server (TLS) id 15.1.325.17; Tue, 17 Nov 2015 21:21:56 +0000 From: Yury Norov To: , , , Subject: [PATCH v6 16/19] aarch64: ilp32: use generic stat64 structure Date: Wed, 18 Nov 2015 00:16:56 +0300 Message-ID: <1447795019-30176-17-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447795019-30176-1-git-send-email-ynorov@caviumnetworks.com> References: <1447795019-30176-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.120] X-ClientProxiedBy: AM3PR01CA046.eurprd01.prod.exchangelabs.com (10.141.191.36) To CO2PR07MB619.namprd07.prod.outlook.com (10.141.228.151) X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB619; 2:YOH9DMjiKHI5f4fdsUcgC8EIMt7G/mRK8imERkUP1yHMN2HkU4QQyEghRjV29nfqbA09eLs0WTXUtoJM07wd6a3D2Qq6O/g365t3a1C8wASa3p+BW3TelIPmw+3SoKQ5kNeoEHO+Bdj5ZlnUkRMMaX7yrCy++hyWOElv1XZyEeE=; 3:LfhhnQ7kAGgW//fM5VU+uWzRJo1EPbCgLf7f+NspHwOeKO/SlI2enqGwiIM4cQGXo2/rFIWIPB4JbU1Tjeq3X4ZER3G6WMxCmAXP/U75M7ywrzElELq0Xqm+s8Qx3C4ARyJurIBeevzWPir4aVeGwA==; 25:AkQP7+IPhW7dTaVjIhzBNx4CmmQQkXWla9OM/sgv0Jd5Zf/NeKEAvj48OxhDDLQAWGeq5mMYNcCtrH39vYhXoVIRVGlJ2+k9yRyrluQFpU4C+0dmfC/OHRBKbXhpbqhr2sEibO2+lAlwPSWcJ7bihNbb8qq4dsULZAY4KnEMJPBJh4gFbXEXVg3g9yCWyvKGqxB1eEH/rLV1bEJj5IZ8PTidh+uWSMe/stC6kk9WkGnCrGdcTddu3XA9ROw9HLynysDbes1qJIRY2y6Q9WZXtA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CO2PR07MB619; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB619; 20:FHP4mSw8E0nBA5DDNxNPS+gR+nZFK1QGrhoWVN6SwbNYJRczdb1qmyQFLVYzIKdtXY3XXtBNfrgK9zq9DpsdsGwDUdb8tq77LxBWCBsLa3fpwbRygOtMjY6V2kucwo57JLdkqbJL/wZJBHX82J1GjYzIBsc+Fr6+Y3CQMEHre/UKcs0wL/c8IkLgLNJpoAQ3OiO1+AjVXO4tsjUv3HTyxucR5UZafHu5HLPz+Pmv5nFMPDQWzxolJosc4yCktsu8x32fumDDJ1Va1A+4gNAIFpl5ftRTWvOAxAnw/IEncu3qgnwsOCm8HkmkYy77V1jMc83e/bFCBQuarWxY9u2M733AzZxgZfqg5poAhJyoqnsGWaNBpezU3Yr/C50zVKALv6gdE5iY9Z/Eb5yEq9ElKkyV9zwoaNPguJelRgfm+Ubb8LtlPEu9NPWHQ9ODmi7eX5pdWMsa0ZZQ4knSWBJ9KNC5WXgePZPD5n/o1nZemXhKs/YrNlwOASX5+KRXJI2xATzDh4PfbF29IPqaKTTX/L4Sbv0rtKBNRztnJPAsXpiii1eY0bGPz4XmjvmvQNIdSkI29HZTIve2Q1P2jr294bGZOhY1GU0yuIn2dS0T1hM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(10201501046)(3002001); SRVR:CO2PR07MB619; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB619; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB619; 4:UU5cMHmnn+PdDvsEnHbxgUoTtw/zwS1h99txM9yBP63JPs5iuezJnAcAU38wzNZNv0jU9Tk5yei2+LBWHjgvfDQYqU896AxP9F8FeQwNMbp30jOTrlKAVjtUNU51oPiB76jS0z2vGA1TJCq7/fnpvbE4oZIVkTPyrV7jSfkRoMFSXpLmhBExJHe71kNnfTh64aUI3zWIgaF45IA3nFLW5osJVxy0Xtd+NL/97iSUSsYmjVr6bNeK+hb1oqwD1Sd2K/z28i9ek/gvhIei98mUurc/7pnBw4giTzJbjllSerYDW07HB2SW4FEDkP5JeZb4xu6t/aoJo95pVRxE++UPzqKQHarFD3IPbj+fS2hZh1ipl+d2YCKJbUuVQaVL65fO X-Forefront-PRVS: 07630F72AD X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(199003)(189002)(2201001)(50986999)(586003)(105586002)(106356001)(50226001)(2950100001)(48376002)(122386002)(33646002)(76506005)(107886002)(229853001)(76176999)(101416001)(77096005)(5001770100001)(5001960100002)(97736004)(81156007)(5007970100001)(92566002)(19580405001)(42186005)(40100003)(189998001)(5004730100002)(50466002)(36756003)(87976001)(47776003)(5001920100001)(66066001)(4001430100002)(5008740100001)(5003940100001)(19580395003)(41533002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR07MB619; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; CO2PR07MB619; 23:wa8RXG8mgnzxge+qlosc5O7HL3bX49CcxnyiLssj+U?= =?us-ascii?Q?f4L6XnJQbLMK+eDmITUWGLFvLGFbK+pNS2sFxPs8cil6RNw2IU12cq2Zc7iy?= =?us-ascii?Q?7z3+BADPsQZp/mYuCp7zkyAwTi/SvdLTaPq9118n/CvnesuKYs3aJuVxhSfW?= =?us-ascii?Q?qvixAk2VOk7MF2mY7z+vM0dXAxL57cM3rDwzW+0kJb1oSIjCGRg4V+oJlRpm?= =?us-ascii?Q?wN5lDxp2gX80H5xpINpdGoP6SNQ7FPZ1ns+qI4kUGORgFCTw6IpV8+JDO9hg?= =?us-ascii?Q?y8aiXkMQ3ap1vAhKfl7Ycxdh59YwpI6N/jVIJAUIFrynHC/lZG9k+25UUQFT?= =?us-ascii?Q?L6YRD82u2a9/9RX6h8YsVXm+ji8xrVLtN0PzvNy2PkHCpxSFjWOkDKXnOW/Z?= =?us-ascii?Q?L1gRkBblS72/VeJcWrYLSMndykrJG42KxgQFyqhQ+XZtzgHprh4THIdE2k3w?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24:V+WFYMnRZCocSh+6p73YTzed8ywOyMLWVGAmvhDKiQCu7nsfCgdFsmzbxT4NMhEqNCGHZgcYhY9fYnEUt+7M8v/B23MZ0qIfNsjyvqx9NSE=; 20:IOK+Mx1LRdVSfSsdUBtN2cwMGKBqAbE+klyAna0Kh9oRlwMyJNLrU/0FNLOKeOsVrpni8u54zhBBg0NKpx/ejA== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2015 21:21:56.9989 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB619 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151117_132220_952797_BB4BC413 X-CRM114-Status: UNSURE ( 8.75 ) 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: pinskia@gmail.com, Prasun.Kapoor@caviumnetworks.com, schwab@suse.de, Nathan_Lynch@mentor.com, agraf@suse.de, klimov.linux@gmail.com, broonie@kernel.org, jan.dakinevich@gmail.com, Yury Norov , ddaney.cavm@gmail.com, bamvor.zhangjian@huawei.com, philipp.tomsich@theobroma-systems.com, andrey.konovalov@linaro.org, joseph@codesourcery.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.8 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, 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 Generic 32-bit and AARCH32 stat64 structures has same names. ILP32 needs generic stat64. So we can either make ILP32 mutual exclusive with AARCH32, or duplicate generic cp_new_stat64 code and struct stat64 to sys_ilp32.c. We choose second because it's more flexible to have independend support for ABIs. Reviewed-by: David Daney Signed-off-by: Yury Norov --- arch/arm64/kernel/sys_ilp32.c | 86 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/arch/arm64/kernel/sys_ilp32.c b/arch/arm64/kernel/sys_ilp32.c index a2596f4..c5bc712 100644 --- a/arch/arm64/kernel/sys_ilp32.c +++ b/arch/arm64/kernel/sys_ilp32.c @@ -117,6 +117,92 @@ asmlinkage long ilp32_sys_semctl(int first, int second, int third, int arg) } #define compat_sys_semctl ilp32_sys_semctl +struct ilp32_stat { + unsigned long st_dev; + + unsigned long st_ino; + + unsigned int st_mode; + unsigned int st_nlink; + + unsigned int st_uid; + unsigned int st_gid; + + unsigned long st_rdev; + unsigned long __st_rdev_pad; + + long st_size; + + unsigned int st_blksize; + unsigned int __st_blksize_pad; + + unsigned long st_blocks; + + unsigned int st_atime; + unsigned int st_atime_nsec; + + unsigned int st_mtime; + unsigned int st_mtime_nsec; + + unsigned int st_ctime; + unsigned int st_ctime_nsec; + + unsigned int __unused[2]; +}; + +static long ilp32_cp_stat(struct kstat *stat, + struct ilp32_stat __user *statbuf) +{ + struct ilp32_stat tmp = { + .st_dev = huge_encode_dev(stat->dev), + .st_ino = stat->ino, + .st_mode = stat->mode, + .st_nlink = stat->nlink, + .st_uid = from_kuid_munged(current_user_ns(), stat->uid), + .st_gid = from_kgid_munged(current_user_ns(), stat->gid), + .st_rdev = huge_encode_dev(stat->rdev), + .__st_rdev_pad = 0, + .st_size = stat->size, + .st_blksize = stat->blksize, + .__st_blksize_pad = 0, + .st_blocks = stat->blocks, + .st_atime = stat->atime.tv_sec, + .st_atime_nsec = stat->atime.tv_nsec, + .st_mtime = stat->mtime.tv_sec, + .st_mtime_nsec = stat->mtime.tv_nsec, + .st_ctime = stat->ctime.tv_sec, + .st_ctime_nsec = stat->ctime.tv_nsec, + .__unused = { 0, 0 } + }; + + return copy_to_user(statbuf, &tmp, sizeof(tmp)) ? -EFAULT : 0; +} + +asmlinkage long ilp32_sys_fstat64(unsigned int fd, + struct ilp32_stat __user *statbuf) +{ + struct kstat stat; + int error = vfs_fstat(fd, &stat); + + if (!error) + error = ilp32_cp_stat(&stat, statbuf); + return error; +} +#define sys_fstat64 ilp32_sys_fstat64 + +asmlinkage long ilp32_sys_fstatat64(unsigned int dfd, + const char __user *filename, + struct ilp32_stat __user *statbuf, int flag) +{ + struct kstat stat; + int error = vfs_fstatat(dfd, filename, &stat, flag); + + if (!error) + error = ilp32_cp_stat(&stat, statbuf); + return error; +} +#define sys_fstatat64 ilp32_sys_fstatat64 + #include #undef __SYSCALL