Received: by 10.192.165.156 with SMTP id m28csp1146067imm; Wed, 11 Apr 2018 13:17:50 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/qJ1nVLAan2d5CXM4Wb0Vid3QUowcwHmvOCLuu5SOhV60ueFlcX7+HPD236xEt1z1ue2OW X-Received: by 10.98.144.205 with SMTP id q74mr5204338pfk.55.1523477870821; Wed, 11 Apr 2018 13:17:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523477870; cv=none; d=google.com; s=arc-20160816; b=cNsw/9xBGNPmEjKG5xD1AIEQ770MKMHA37N+ocq6a8NevKoZO3ca0E4h3QmcqdsF+J gQa/Ylupcn+CK2+AR3GHuWfGLqGTzjBTH9TXXzNYD1wk242+gBQ6qf09RvT+oz1OlL0Q w7Jva9AGnhEl5Crkl0eLktxFXSyPcS9wLJcARdX+gihcw1zFpyITeodhcypCUj/ZyQ7+ 7y7Tzs38anzn295qgP66JMtdB7IQWxKp4Jqqay2bRZdnzuOLb6fYIKlPz5WhkwMTUoMx o1LGs03zWVeYINeaIviPuv83gbcyUOjBFMrT+BM0QIWo97AwBBKkN27U5Yngbb6QsKSi VfjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=3Hky99KNdbsVPR//NjoLLMC/8BqkS4aaTGU5Jo52SSk=; b=U0Aj/vFooddOiN20jlaYqqY5ghS5BES/1AGXDr7X49ob1gfFedi5zQTNhbhrIaXi/0 kAsdKVQ7eyUYqUUvfdY266e7rNZheDkj5jk4AlbsDuTnNmSnteMwULRLAAP3YMxJ7pxp KNJFQ3zcVZEMyC8ZxZUZ2ZG1DzzliQGIJeeiM+1dI7BEtdMVrAnxOn7vRimwiRGwl4oT 2VXFlTSfxPoZMgqy+ARL8eWplet66h2O7Mor+ydURcKDBt7bb68LHe5VI/3+IVL+f+tF M29y51zx+XsD9UF61F8BsFrLVjRuWcysmV/Pw78YDppopN+Halkn2d0Mu3+LsuXyLxmM H3qQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3-v6si1591552plp.682.2018.04.11.13.17.13; Wed, 11 Apr 2018 13:17:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933395AbeDKSxy (ORCPT + 99 others); Wed, 11 Apr 2018 14:53:54 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33996 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933372AbeDKSxw (ORCPT ); Wed, 11 Apr 2018 14:53:52 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 40595EB9; Wed, 11 Apr 2018 18:53:51 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias Kaehlcke , Grant Grundler , Greg Hackmann , Kees Cook , Linus Torvalds , Michael Davidson , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Sasha Levin Subject: [PATCH 4.9 006/310] x86/mm/kaslr: Use the _ASM_MUL macro for multiplication to work around Clang incompatibility Date: Wed, 11 Apr 2018 20:32:25 +0200 Message-Id: <20180411183622.563621237@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Matthias Kaehlcke [ Upstream commit 121843eb02a6e2fa30aefab64bfe183c97230c75 ] The constraint "rm" allows the compiler to put mix_const into memory. When the input operand is a memory location then MUL needs an operand size suffix, since Clang can't infer the multiplication width from the operand. Add and use the _ASM_MUL macro which determines the operand size and resolves to the NUL instruction with the corresponding suffix. This fixes the following error when building with clang: CC arch/x86/lib/kaslr.o /tmp/kaslr-dfe1ad.s: Assembler messages: /tmp/kaslr-dfe1ad.s:182: Error: no instruction mnemonic suffix given and no register operands; can't size instruction Signed-off-by: Matthias Kaehlcke Cc: Grant Grundler Cc: Greg Hackmann Cc: Kees Cook Cc: Linus Torvalds Cc: Michael Davidson Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20170501224741.133938-1-mka@chromium.org Signed-off-by: Ingo Molnar Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/asm.h | 1 + arch/x86/lib/kaslr.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h @@ -34,6 +34,7 @@ #define _ASM_ADD __ASM_SIZE(add) #define _ASM_SUB __ASM_SIZE(sub) #define _ASM_XADD __ASM_SIZE(xadd) +#define _ASM_MUL __ASM_SIZE(mul) #define _ASM_AX __ASM_REG(ax) #define _ASM_BX __ASM_REG(bx) --- a/arch/x86/lib/kaslr.c +++ b/arch/x86/lib/kaslr.c @@ -5,6 +5,7 @@ * kernel starts. This file is included in the compressed kernel and * normally linked in the regular. */ +#include #include #include #include @@ -79,7 +80,7 @@ unsigned long kaslr_get_random_long(cons } /* Circular multiply for better bit diffusion */ - asm("mul %3" + asm(_ASM_MUL "%3" : "=a" (random), "=d" (raw) : "a" (random), "rm" (mix_const)); random += raw;