Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932915AbcLPVHK (ORCPT ); Fri, 16 Dec 2016 16:07:10 -0500 Received: from mail-pf0-f180.google.com ([209.85.192.180]:35205 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753897AbcLPVHB (ORCPT ); Fri, 16 Dec 2016 16:07:01 -0500 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 Subject: [PATCH] latent_entropy: fix ARM build error on earlier gcc Message-ID: <20161216210659.GA85702@beast> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1308 Lines: 43 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; } -- 2.7.4 -- Kees Cook Nexus Security