Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3934381yba; Tue, 7 May 2019 09:18:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxys5/3eGtFZnXQBZzC8wICBPCYonkuHSu8aC0s//Tnv8if0/1UHnHatgITCWQ0aUTfx8BL X-Received: by 2002:a17:902:9a83:: with SMTP id w3mr41321189plp.241.1557245931254; Tue, 07 May 2019 09:18:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557245931; cv=none; d=google.com; s=arc-20160816; b=mEQB1GkXqN+rS0iScSfi/4ZwGfeeRi+w+Zk8DRNROWHtPzsqNfgLWCqA5ic+zg7zkK e78QC3ScZ6tk8einAM2ZCtaTGNKavtA2+sISBwlPfjbmJq1GvvKeUafCwjMkg3DC2Doq KLoFoMiQOb4IXU38rPaNqPPtNk4DlJ9Q7EvYbxU4ZPrujV1v7kIGcR1LdSNKbH9phrP0 YN37filAmueoosX/3hEBEUPhHWNzOB5dSs7++7AnyAKyBfQV3M3Iu9w3HS58ZrE86nOe 4c5t6OsAOiTI1/10WSeP/mokwqvB1qnes1ODvlErGvNfWBP6vasv6DYZxANsl7HHgOTC nh+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=BZ56jxTp4EW67gv6YIojXI+z7TA5vPU5IjeQkHzF6zc=; b=bTGP7xF29xrhQKE5mMaxJBKberEZHEB/W4/kTOHNYtJ0is14RbLRXKLTUpc86UtGJF WxsfAS8NmVpZono6VykbCQ0a5stl00SrAX9qC0yqkmifazlNhxBG0e8e6nw5IFUTb0xN pa9D9UHJMtijdQPM0s3srYkn2G5vAvOT3JQr0o0CfV56BaFwpeA7zPsiXql6eEdKm8Sw FH4zpH6WTLleaDFNCDwiq//DIzMQYrLuBLbkGPJQ3+YVPRmvgX/UKZvZaVkvCG4LM16k fuyV8lOkYTAKd+XOJDF/nSGGGRwt1LX4r1R/F8oi8AU5PCQ/Sp74JdzQWltl23qgq9Sj vUcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=H1UbWvjk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a3si20517573plc.415.2019.05.07.09.18.36; Tue, 07 May 2019 09:18:51 -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; dkim=pass header.i=@chromium.org header.s=google header.b=H1UbWvjk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726791AbfEGQQo (ORCPT + 99 others); Tue, 7 May 2019 12:16:44 -0400 Received: from mail-vk1-f194.google.com ([209.85.221.194]:43695 "EHLO mail-vk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726197AbfEGQQn (ORCPT ); Tue, 7 May 2019 12:16:43 -0400 Received: by mail-vk1-f194.google.com with SMTP id f2so3350050vkl.10 for ; Tue, 07 May 2019 09:16:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BZ56jxTp4EW67gv6YIojXI+z7TA5vPU5IjeQkHzF6zc=; b=H1UbWvjkFc7SD+itPi5SkNDEnjCt6RjyqpFSq/K9DGtHT4lPWfeDrxBtnro1vfeorE Gelnk3rEiZuv/AqCkjtg7iitLGDLWRLIK5RLRwvcRxvgLDD+/dbpalp76DydywP3wPSQ xgV1V4wOPSI3aokpFpEhp2c+r8+qK+YBhLhbk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BZ56jxTp4EW67gv6YIojXI+z7TA5vPU5IjeQkHzF6zc=; b=NJ+1z2Hq/hh22lTdJN+c2AkS3mGCJG+U//UnIEWocf6Dzwzmt1UuSVSlEi5no2T4yd j4p0aAkMEqJo9v7CciINPD//pgAUkSva+usdczE/lJiZTcB0gHbmetU+rNIkPKB34K+e ixcEenUjTrQ+GEulYSG3zWxJICFjlKat4DntN8IMYghtNJ5I77IZvn4d3qEbF0NNgC2h iz0O/2Ac3wZHbHVmEtTfggJ1hIN18iXsC8X/K+TYryIuwUpUsXx+atkIhZmgjbjhXdIJ oP8GodPt110y8x2dZ6NU7Z6Px+dtwgf4Fa3dh4Jp8Wee48fd/+0HAlE/ECUybY56At1S fi3Q== X-Gm-Message-State: APjAAAW19Nq72Tad9+RNCmR2GnGIE9bRqjnmNj6jr+sSrRk7aELobzmu d3SXdhnJo2v47jkN8gYTVgABU0ddc/Y= X-Received: by 2002:a1f:4a44:: with SMTP id x65mr7844436vka.58.1557245802324; Tue, 07 May 2019 09:16:42 -0700 (PDT) Received: from mail-vs1-f41.google.com (mail-vs1-f41.google.com. [209.85.217.41]) by smtp.gmail.com with ESMTPSA id w69sm8879047vsc.8.2019.05.07.09.16.41 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Tue, 07 May 2019 09:16:41 -0700 (PDT) Received: by mail-vs1-f41.google.com with SMTP id e2so10735847vsc.13 for ; Tue, 07 May 2019 09:16:41 -0700 (PDT) X-Received: by 2002:a67:eecb:: with SMTP id o11mr15461455vsp.66.1557245800691; Tue, 07 May 2019 09:16:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Kees Cook Date: Tue, 7 May 2019 09:16:29 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] latent_entropy: avoid build error when plugin cflags are not set To: Vasily Gorbik Cc: Andrew Morton , Emese Revfy , Heiko Carstens , Martin Schwidefsky , LKML 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 On Tue, May 7, 2019 at 7:28 AM Vasily Gorbik wrote: > Some architectures set up CFLAGS for linux decompressor phase from > scratch and do not include GCC_PLUGINS_CFLAGS. Since "latent_entropy" > variable declaration is generated by the plugin code itself including > linux/random.h in decompressor code then would cause a build > error. E.g. on s390: > > In file included from ./include/linux/net.h:22, > from ./include/linux/skbuff.h:29, > from ./include/linux/if_ether.h:23, > from ./arch/s390/include/asm/diag.h:12, > from arch/s390/boot/startup.c:8: > ./include/linux/random.h: In function 'add_latent_entropy': > ./include/linux/random.h:26:39: error: 'latent_entropy' undeclared > (first use in this function); did you mean 'add_latent_entropy'? > 26 | add_device_randomness((const void *)&latent_entropy, > | ^~~~~~~~~~~~~~ > | add_latent_entropy > ./include/linux/random.h:26:39: note: each undeclared identifier is > reported only once for each function it appears in > > The build error is triggered by commit a80313ff91ab ("s390/kernel: > introduce .dma sections") which made it into 5.2 merge window. > > To address that avoid using CONFIG_GCC_PLUGIN_LATENT_ENTROPY in > favour of LATENT_ENTROPY_PLUGIN definition which is defined as a > part of gcc plugins cflags and hence reflect more accurately when gcc > plugin is active. Besides that it is also used for similar purpose in > linux/compiler-gcc.h for latent_entropy attribute definition. > > Signed-off-by: Vasily Gorbik Thanks for fixing this! Do you want to take it via the s390 tree? Acked-by: Kees Cook -Kees > --- > include/linux/random.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/random.h b/include/linux/random.h > index 445a0ea4ff49..d4eb9b3789ad 100644 > --- a/include/linux/random.h > +++ b/include/linux/random.h > @@ -20,7 +20,7 @@ struct random_ready_callback { > > extern void add_device_randomness(const void *, unsigned int); > > -#if defined(CONFIG_GCC_PLUGIN_LATENT_ENTROPY) && !defined(__CHECKER__) > +#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__) > static inline void add_latent_entropy(void) > { > add_device_randomness((const void *)&latent_entropy, > -- > 2.18.0.13.gd42ae10 > -- Kees Cook