Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1036507AbdD2Vax (ORCPT ); Sat, 29 Apr 2017 17:30:53 -0400 Received: from terminus.zytor.com ([65.50.211.136]:52161 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1036488AbdD2VaT (ORCPT ); Sat, 29 Apr 2017 17:30:19 -0400 Subject: Re: [PATCH v2] x86/mm/kaslr: Use _ASM_MUL macro for multiplication To: Greg Hackmann , Kees Cook Cc: Matthias Kaehlcke , Thomas Gleixner , Ingo Molnar , "x86@kernel.org" , LKML , Grant Grundler , Michael Davidson References: <20170426205504.133693-1-mka@chromium.org> <02F6E6C7-5AC0-431A-9008-DBDB4EFC1A6D@zytor.com> <3FE94529-1D0B-4B23-8D3A-0543E08B12F2@zytor.com> From: "H. Peter Anvin" Message-ID: <6b9fcaae-044d-5f71-6064-f0df88d5f8b4@zytor.com> Date: Sat, 29 Apr 2017 14:23:22 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 974 Lines: 26 On 04/26/17 14:29, Greg Hackmann wrote: > On 04/26/2017 02:24 PM, hpa@zytor.com wrote: >>>> This really feels like a "fix your compiler" issue. >>> >>> We already use the other forms, what's so bad about adding mul too? >>> And if this lets us build under clang, all the better. >>> >>> -Kees >> >> It's not bad per se, but if this doesn't eventually gets fixed in >> clang we'll have no end of this crap. >> > > AIUI the "problem" is that clang is spilling mix_const into memory > rather than assigning it to a register. This is perfectly legal since > mix_const has a constraint of "rm". But mul needs a suffix when the > input is a memory location, since it can't infer the multiplication > width from the input operand anymore. > > You get the same error message with gcc if you force it to use a memory > location, by narrowing the constraint from "rm" to "m". OK, that's a genuine bug. Please explain that in the comment; it has nothing to do with clang. -hpa