From patchwork Tue Feb 6 01:07:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 10202133 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 F193860247 for ; Tue, 6 Feb 2018 01:07:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDFC22857F for ; Tue, 6 Feb 2018 01:07:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2605285B0; Tue, 6 Feb 2018 01:07:47 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED 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 D0F862857F for ; Tue, 6 Feb 2018 01:07:46 +0000 (UTC) Received: (qmail 23558 invoked by uid 550); 6 Feb 2018 01:07:44 -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: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 22499 invoked from network); 6 Feb 2018 01:07:44 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=NtXtDVxfsNX8AVrBws/1xBpUVYPXf6QVwKBrQ7hCIec=; b=Jmo6kIv4KfsgOQqMcVfETcZHNxU5Sh8CD3EEc6QWrjSJQvcodprDPgKLtqcDJ7NU3l fg1ysblNGw46N+YBsMNTEP5duzillvA+QC4+6gTBkA9z0Jbd/do+8mXGWxtLOhN8ieWi UFbSE4uSHU4VyY7wOfHn8YzuclcDbIxHZ4rRPC2QwcRh4sZLopvsyF+J+r4onzde9ccc DmQ8bJS2YU0HpfidSFWU8EMiP2G1Y1SStIdETsvqsxp98ga0gkvWq1bF9OgwNyyBQA7p k0mmtmX1mSgtLQ5+d7cakyTr8KgPe1E8APhhMw5og4wZ82z59VFErrgSrRxqk/vt6kUe o/RA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=NtXtDVxfsNX8AVrBws/1xBpUVYPXf6QVwKBrQ7hCIec=; b=jZexWGjlFL58BJmrUNPFpm0ixxWL9ragxsFgfohDVXOeq9NbtzBbPuzDyK1VOF19mn lXlFy+7MUZ1Pf7F3wfKD4EbUz6XJJ0A/yalnaqFjy+HxWuyAhEGPYJ/3dblwh1f3wK9i bh/VfpGCFgEdLLzJiWWljTacW4XEvNF9SxuB0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=NtXtDVxfsNX8AVrBws/1xBpUVYPXf6QVwKBrQ7hCIec=; b=JwObOiMnZzrhXE38PNWxTqPz/DeHVgmWpsY+OdsObFwvmSd3EcZzXSASmppV7U6sXA kaXP/u0z31ItLvxi3bBLerMcKNLhiDEoSvNiFH0oaoUm0Y304t8gXtg2Goj91t0q7r6c 8Q4rSOocqAivJl31rkxZt9BkjoFIXV/s/nl88K4QA6v353fvzB3vcxezKC9s1+n55K89 bQtdYVTuG/09Ek9id7uV/7zV9lCCBJ49Q1O18u3yqZpstmslnOMqF1NUpsDWSU0Nsblv 2TySLwpAl49Emx4wjOUxB7Im29tsTNo7tGq1XPCrANQXLixqYa0NxjRBZczcBaoZNYOc 7Tig== X-Gm-Message-State: APf1xPB5OfpSOX4b/s9RG5A9Kp/cUc8IPtLU/gRKulS3tBKt+d174hCj HUAKwEA/0GctF6YCJ0w0bOQYRIDKsdc6IbLXtDVh0849+78= X-Google-Smtp-Source: AH8x2271ybwsS2ugEerJOtHzSNITy2pANbYyKucMXb9r2ypchkJVshrl7HoXJi3juoiIm7HkjaoVMvW3BrHditY/2gU= X-Received: by 10.31.201.133 with SMTP id z127mr726488vkf.129.1517879252219; Mon, 05 Feb 2018 17:07:32 -0800 (PST) MIME-Version: 1.0 Sender: keescook@google.com In-Reply-To: <123377.1517765678@turing-police.cc.vt.edu> References: <123377.1517765678@turing-police.cc.vt.edu> From: Kees Cook Date: Tue, 6 Feb 2018 12:07:31 +1100 X-Google-Sender-Auth: uXzJmOkelSc8tgbmPjXG8gyUBmo Message-ID: Subject: Re: [PATCH 2/2] GCC release 8 support for gcc-plugins To: Valdis Kletnieks Cc: kernel-hardening@lists.openwall.com, LKML X-Virus-Scanned: ClamAV using ClamSMTP On Mon, Feb 5, 2018 at 4:34 AM, wrote: > For reasons totally beyond my understanding, gcc 8 changed the > order of two structure member, which leads to an error: > > HOSTCXX -fPIC scripts/gcc-plugins/latent_entropy_plugin.o > scripts/gcc-plugins/latent_entropy_plugin.c:269:1: error: designator order for field 'attribute_spec::affects_type_identity' does not match declaration order in 'attribute_spec' > }; > ^ FWIW, my gcc 8 snapshot reports: scripts/gcc-plugins/latent_entropy_plugin.c:269:1: sorry, unimplemented: non-trivial designated initializers not supported }; ^ But yeah, it seems that initializer _order_ matters here. Uuuugh. I think instead of static initializers, we can just move this into the register function, then order won't matter again. e.g.: (pardon whitespace damage...) -Kees diff --git a/scripts/gcc-plugins/latent_entropy_plugin.c b/scripts/gcc-plugins/latent_entropy_plugin.c index 65264960910d..6836b8cd9fc4 100644 --- a/scripts/gcc-plugins/latent_entropy_plugin.c +++ b/scripts/gcc-plugins/latent_entropy_plugin.c @@ -255,21 +255,21 @@ static tree handle_latent_entropy_attribute(tree *node, tree name, return NULL_TREE; } -static struct attribute_spec latent_entropy_attr = { - .name = "latent_entropy", - .min_length = 0, - .max_length = 0, - .decl_required = true, - .type_required = false, - .function_type_required = false, - .handler = handle_latent_entropy_attribute, -#if BUILDING_GCC_VERSION >= 4007 - .affects_type_identity = false -#endif -}; +static struct attribute_spec latent_entropy_attr; static void register_attributes(void *event_data __unused, void *data __unused) { + latent_entropy_attr.name = "latent_entropy"; + latent_entropy_attr.min_length = 0; + latent_entropy_attr.max_length = 0; + latent_entropy_attr.decl_required = true; + latent_entropy_attr.type_required = false; + latent_entropy_attr.function_type_required = false; + latent_entropy_attr.handler = handle_latent_entropy_attribute; +#if BUILDING_GCC_VERSION >= 4007 + latent_entropy_attr.affects_type_identity = false; +#endif + register_attribute(&latent_entropy_attr); }