From patchwork Fri Dec 16 21:06:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9478511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9FD6C60828 for ; Fri, 16 Dec 2016 21:07:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D989286D0 for ; Fri, 16 Dec 2016 21:07:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 818AE28772; Fri, 16 Dec 2016 21:07:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 2C09C286D0 for ; Fri, 16 Dec 2016 21:07:16 +0000 (UTC) Received: (qmail 28193 invoked by uid 550); 16 Dec 2016 21:07:14 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: kernel-hardening@lists.openwall.com Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 28116 invoked from network); 16 Dec 2016 21:07:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=hPAP3z0Vfm/ejUopi1c60N2n3VkntDP9jLcoY3skvz0=; b=fudIFkdmvA2xH/pE55nSjXqOGiuH8LALVi+UzdT1yDpo5HVn23CzFuwTqXiHQR/Nun 3CtMVUoTmEuONwrZdlYK9KBbQTm373AHNgFltQBy0LSWzORPLcFyVbdBxTurmJKSl8un 4cx5E94Cw8J7MInOL2CbhSvAbrDHXNE3rLJqk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=hPAP3z0Vfm/ejUopi1c60N2n3VkntDP9jLcoY3skvz0=; b=evX0p58R/RhiQMtrub5VtzfvwFqt0QYuduI88ZVTlMKP9hCIKgTA68QZmB+ao32rr8 gmovrsRpss3DbVLBSG5ztiKt5ujuJNKLYimJfy4X5jO7zSdVTvtrjyG1U/rj00L6BV51 scagxZO+5xowBb5iQPEriJCYlTMeOYczasExzQBfVdWiz2FVblcEfbyRh2TeJ6Dhi7yd 1zFHsH51X1RzyWkITyJWGvaRNz43azPMgfTXO53dc88DPplLPavj7V3ROUpZ442SLxOE cV06pUQhfoEiE6+oJCXrmGeojKqdpplkkTX6q6VlDNNOgfrYICv4JhnBoVM1URyrJuTZ +Iuw== X-Gm-Message-State: AKaTC02W+3muG+s05Q17Df1AUCfEyAAXNpmN6aefduPh8Uvxg4hNeK8d3cpCGUwXDnL2Qmmm X-Received: by 10.99.125.24 with SMTP id y24mr9122084pgc.27.1481922420717; Fri, 16 Dec 2016 13:07:00 -0800 (PST) Date: Fri, 16 Dec 2016 13:06:59 -0800 From: Kees Cook To: linux-kernel@vger.kernel.org Cc: Emese Revfy , kernel-hardening@lists.openwall.com, Arnd Bergmann , PaX Team , Brad Spengler Message-ID: <20161216210659.GA85702@beast> MIME-Version: 1.0 Content-Disposition: inline Subject: [kernel-hardening] [PATCH] latent_entropy: fix ARM build error on earlier gcc X-Virus-Scanned: ClamAV using ClamSMTP This fixes build errors seen on gcc-4.9.3 or gcc-5.3.1 for an ARM: arm-soc/init/initramfs.c: In function 'error': arm-soc/init/initramfs.c:50:1: error: unrecognizable insn: } ^ (insn 26 25 27 5 (set (reg:SI 111 [ local_entropy.243 ]) (rotatert:SI (reg:SI 116 [ local_entropy.243 ]) (const_int -30 [0xffffffffffffffe2]))) -1 (nil)) Patch from PaX Team Reported-by: Arnd Bergmann Reported-by: Brad Spengler Signed-off-by: Kees Cook --- scripts/gcc-plugins/latent_entropy_plugin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/gcc-plugins/latent_entropy_plugin.c b/scripts/gcc-plugins/latent_entropy_plugin.c index ff1939b804ae..eb1964084ccd 100644 --- a/scripts/gcc-plugins/latent_entropy_plugin.c +++ b/scripts/gcc-plugins/latent_entropy_plugin.c @@ -328,9 +328,9 @@ static enum tree_code get_op(tree *rhs) op = LROTATE_EXPR; /* * This code limits the value of random_const to - * the size of a wide int for the rotation + * the size of a long for the rotation */ - random_const &= HOST_BITS_PER_WIDE_INT - 1; + random_const %= TYPE_PRECISION(long_unsigned_type_node); break; }