Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5607737imu; Mon, 26 Nov 2018 02:56:34 -0800 (PST) X-Google-Smtp-Source: AFSGD/V4bEs3PouvTTJHJ2WQmY7oTkmdmmvqTpbtPQgVk7Qksyde/aPkRqpCVZWSLIgsx1fzOWdg X-Received: by 2002:a63:9712:: with SMTP id n18mr23960628pge.295.1543229794444; Mon, 26 Nov 2018 02:56:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543229794; cv=none; d=google.com; s=arc-20160816; b=Lxw0HhrG7+dj8yOKIXyH32UeMGGlcc0rvUPXv+Jb9m4PM+yMIrGlnUOV3Y9vMg8F7L jQnMcjOgLw6uVecT6hNlVW46Ikif8vHJspG+OvHZTT11t7oBzcltweBwlFZU0Z1x0x2S VNz+UAcYtz5tpplYvmiElBc5IV79aeNNTj6ldnl273JqU1u42KXox1MCMecoHKgSnw5S eWk1JP/J86D/r8IgGyKMgMkMzcK9ZBhBAApQeAZkJe07FiLugMAHuAbK4utJLe05VhRK OOW/0UfTHq1LMhlSVMfJ++Hf7jU41PUXoPpIkPZUDGqzIqXjSEnK/lDHVTHipzxXgU+m nIhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hlVJ1IaQD2ShnJdYkAKV5+6PPPsED1cj7vapCV2OM08=; b=Jn/K+tJ+WONoK4TsB4DxRFUtKHDt4/YmSuvvNjBD4dp5aqg5/Rp8glrKkp8qwev63u IM6fyTqWMFHh7lcrQTd0Alq1ycB9AK2HPGfUH1trLeTBpOoXlQl0YXuYE1lA49HTGeza hHD743U+Uu74pBU6JkJJXbGAVx7asnNKwtpsjivruJpp/65O8vMdSoq5IgDgvoW7nYAS yPJHnXeVQmt4v2isj2FxoN3um0D0qoBG1JlMTHF8ad40FbK+Pyo+NsXInzLr1xYpOyw3 2QzQcrQ2yQVD8ybQTTy0dlYapsOPTSL/Sob5y5ZhkL0nmWhGi97mWd8rmSvaaROxhtTP H3vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=USsVu3AP; 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 8si10940933plc.88.2018.11.26.02.56.18; Mon, 26 Nov 2018 02:56:34 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=USsVu3AP; 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 S1727581AbeKZVs0 (ORCPT + 99 others); Mon, 26 Nov 2018 16:48:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:56946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726475AbeKZVs0 (ORCPT ); Mon, 26 Nov 2018 16:48:26 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D47EC2146F; Mon, 26 Nov 2018 10:54:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543229681; bh=QCEqhBY+Ne66DET4jGKPDEeL7sb9GOlkcItyso8j6z0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=USsVu3APE6H4Lx/PZdLPwPfCVGRZnpjUbJixDg4wJPD8Kt1wo6gpDT67pu8IAih1N SiOcU1UXZqZT3Ig12EkZcFhXxUHqZqq8yWsV90TFg8xB7lmXjtj5L93wfD6LBHxdl8 5mkhk0pdf5xouiOyiFLRAVSnm8fbn7R46hIpjm6E= 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 , Nathan Chancellor Subject: [PATCH 4.4 31/70] x86/mm/kaslr: Use the _ASM_MUL macro for multiplication to work around Clang incompatibility Date: Mon, 26 Nov 2018 11:50:46 +0100 Message-Id: <20181126105049.785151902@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181126105046.722096341@linuxfoundation.org> References: <20181126105046.722096341@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Matthias Kaehlcke commit 121843eb02a6e2fa30aefab64bfe183c97230c75 upstream. 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 [nc: Apply to aslr.c in get_random_long as the kaslr shift didn't happen until 4.8 in commit d899a7d146a2] Signed-off-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- arch/x86/boot/compressed/aslr.c | 3 ++- arch/x86/include/asm/asm.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) --- a/arch/x86/boot/compressed/aslr.c +++ b/arch/x86/boot/compressed/aslr.c @@ -1,5 +1,6 @@ #include "misc.h" +#include #include #include #include @@ -94,7 +95,7 @@ static unsigned long get_random_long(voi } /* Circular multiply for better bit diffusion */ - asm("mul %3" + asm(_ASM_MUL "%3" : "=a" (random), "=d" (raw) : "a" (random), "rm" (mix_const)); random += raw; --- 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)