From patchwork Thu Feb 4 18:48:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin LaHaise X-Patchwork-Id: 8226801 Return-Path: X-Original-To: patchwork-linux-arm@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 1D190BEEE5 for ; Thu, 4 Feb 2016 18:50:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D3112039C for ; Thu, 4 Feb 2016 18:50:25 +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 77B5B20398 for ; Thu, 4 Feb 2016 18:50:24 +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 1aROxV-0001VR-H4; Thu, 04 Feb 2016 18:48:49 +0000 Received: from kanga.kvack.org ([205.233.56.17]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aROxS-0001RQ-Pj for linux-arm-kernel@lists.infradead.org; Thu, 04 Feb 2016 18:48:47 +0000 Received: by kanga.kvack.org (Postfix, from userid 63042) id 77A874403D8; Thu, 4 Feb 2016 13:48:25 -0500 (EST) Date: Thu, 4 Feb 2016 13:48:25 -0500 From: Benjamin LaHaise To: Russell King - ARM Linux Subject: Re: linux-next: build failure after merge of the aio tree Message-ID: <20160204184825.GG16315@kvack.org> References: <20160204131959.6695c7bf@canb.auug.org.au> <20160204134142.GA16315@kvack.org> <20160204135056.GE10826@n2100.arm.linux.org.uk> <20160204140822.GB16315@kvack.org> <20160204141253.GF10826@n2100.arm.linux.org.uk> <20160204143204.GC16315@kvack.org> <20160204143907.GG10826@n2100.arm.linux.org.uk> <20160204160101.GD16315@kvack.org> <20160204161741.GH10826@n2100.arm.linux.org.uk> Mime-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160204161741.GH10826@n2100.arm.linux.org.uk> User-Agent: Mutt/1.4.2.2i X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160204_104846_917851_F404D130 X-CRM114-Status: GOOD ( 11.86 ) X-Spam-Score: -2.4 (--) 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: Stephen Rothwell , Linux-Next , Geert Uytterhoeven , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" 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.7 required=5.0 tests=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 On Thu, Feb 04, 2016 at 04:17:42PM +0000, Russell King - ARM Linux wrote: > __gu_val will be 32-bit, even when you're wanting a 64-bit quantity. > That's where the fun and games start... Okay, I figured out how to do it: instead of using a 64 bit unsigned long long for __gu_val, use an array of 2 unsigned longs. See the patch below which I verified boots, passes your tests and doesn't truncate 64 bit values. Comments? A simple test module to verify things is located at http://www.kvack.org/~bcrl/test_module2.c . -ben diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 09b1b0a..53244ae 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -326,7 +326,22 @@ do { \ } while (0) #ifdef CONFIG_X86_32 -#define __get_user_asm_u64(x, ptr, retval, errret) (x) = __get_user_bad() +#define __get_user_asm_u64(x, addr, err, errret) \ + asm volatile(ASM_STAC "\n" \ + "1: movl %2,%%eax\n" \ + "2: movl %3,%%edx\n" \ + "3: " ASM_CLAC "\n" \ + ".section .fixup,\"ax\"\n" \ + "4: mov %4,%0\n" \ + " xorl %%eax,%%eax\n" \ + " xorl %%edx,%%edx\n" \ + " jmp 3b\n" \ + ".previous\n" \ + _ASM_EXTABLE(1b, 4b) \ + _ASM_EXTABLE(2b, 4b) \ + : "=r" (err), "=A"(x) \ + : "m" (__m(addr)), "m" __m(((u32 *)addr) + 1), "i" (errret), "0" (err)) + #define __get_user_asm_ex_u64(x, ptr) (x) = __get_user_bad() #else #define __get_user_asm_u64(x, ptr, retval, errret) \ @@ -407,9 +422,16 @@ do { \ #define __get_user_nocheck(x, ptr, size) \ ({ \ int __gu_err; \ - unsigned long __gu_val; \ - __get_user_size(__gu_val, (ptr), (size), __gu_err, -EFAULT); \ - (x) = (__force __typeof__(*(ptr)))__gu_val; \ + if (size == 8) { \ + unsigned long __gu_val[2]; \ + __gu_err = 0; \ + __get_user_asm_u64(__gu_val, ptr, __gu_err, -EFAULT); \ + (x) = *(__force __typeof__((ptr)))__gu_val; \ + } else { \ + unsigned long __gu_val; \ + __get_user_size(__gu_val, (ptr), (size), __gu_err, -EFAULT); \ + (x) = (__force __typeof__(*(ptr)))__gu_val; \ + } \ __builtin_expect(__gu_err, 0); \ })