Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933823AbcCISXO (ORCPT ); Wed, 9 Mar 2016 13:23:14 -0500 Received: from torg.zytor.com ([198.137.202.12]:47428 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751254AbcCISXJ (ORCPT ); Wed, 9 Mar 2016 13:23:09 -0500 Subject: Re: [PATCH] x86_32: add support for 64 bit __get_user() To: Benjamin LaHaise References: <20160309172225.GN12913@kvack.org> <20160309175016.GO12913@kvack.org> Cc: Ingo Molnar , Russell King , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org From: "H. Peter Anvin" X-Enigmail-Draft-Status: N1110 Message-ID: <56E069FA.7070700@zytor.com> Date: Wed, 9 Mar 2016 10:22:50 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160309175016.GO12913@kvack.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1609 Lines: 35 On 03/09/2016 09:50 AM, Benjamin LaHaise wrote: > On Wed, Mar 09, 2016 at 09:36:30AM -0800, H. Peter Anvin wrote: >> On March 9, 2016 9:22:25 AM PST, Benjamin LaHaise wrote: >>> The existing __get_user() implementation does not support fetching >>> 64 bit values on 32 bit x86. Implement this in a way that does not >>> generate any incorrect warnings as cautioned by Russell King. Test >>> code available at http://www.kvack.org/~bcrl/x86_32-get_user.tar . > ... >> Weird. I could swear we had already fixed this a few years ago. > > That surprised me as well, but Russell raised the fact that the approaches > previously tried on 32 bit architectures had caused various incorrect > compiler warnings for certain obscure cases -- see the code in test_module.c > in that URL that Russell provided to demonstrate the problem across all the > corner cases. Oh, I see... I implemented it for put but not get... weird. You may want to look at the __inttype() macro defined earlier in this file; it might be useful. I presume you have already seen: >> fs/select.c:710: Error: operand type mismatch for `movq' >> fs/select.c:714: Error: incorrect register `%cx' used with `q' suffix fs/select.c:711: Error: operand type mismatch for `movq' >> fs/select.c:715: Error: incorrect register `%si' used with `q' suffix -- fs/aio.c: Assembler messages: >> fs/aio.c:1606: Error: operand type mismatch for `movq' >> fs/aio.c:1610: Error: incorrect register `%si' used with `q' suffix ... which implies it used 16-bit registers for 64-bit operations when compiling for 64 bits. -hpa