Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754403AbdDZV3Z (ORCPT ); Wed, 26 Apr 2017 17:29:25 -0400 Received: from mail-pf0-f180.google.com ([209.85.192.180]:36352 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754367AbdDZV3Q (ORCPT ); Wed, 26 Apr 2017 17:29:16 -0400 Subject: Re: [PATCH v2] x86/mm/kaslr: Use _ASM_MUL macro for multiplication To: hpa@zytor.com, Kees Cook References: <20170426205504.133693-1-mka@chromium.org> <02F6E6C7-5AC0-431A-9008-DBDB4EFC1A6D@zytor.com> <3FE94529-1D0B-4B23-8D3A-0543E08B12F2@zytor.com> Cc: Matthias Kaehlcke , Thomas Gleixner , Ingo Molnar , "x86@kernel.org" , LKML , Grant Grundler , Michael Davidson From: Greg Hackmann Message-ID: Date: Wed, 26 Apr 2017 14:29:13 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <3FE94529-1D0B-4B23-8D3A-0543E08B12F2@zytor.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 803 Lines: 19 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".