From patchwork Sun Sep 3 12:07:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9936109 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 E4EDD6037D for ; Sun, 3 Sep 2017 12:08:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6561286A9 for ; Sun, 3 Sep 2017 12:08:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAF59286B1; Sun, 3 Sep 2017 12:08:42 +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 75384286A9 for ; Sun, 3 Sep 2017 12:08:41 +0000 (UTC) Received: (qmail 7495 invoked by uid 550); 3 Sep 2017 12:08:33 -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 7337 invoked from network); 3 Sep 2017 12:08:31 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WjHLE7zLeKXtANi5+giNZUhSgv+udHd254VSbdAIWO8=; b=Ml8mLfGM6BlJkrzQGFiX9CJyNkrEg19k61Ax/b/D0PFBrpLcaT7UyoPLSoQJsCc/EY ngoNIfP9cB89MQiBuTa13Cz5IfzufruQu/JjcNAbX+fbKh8K+R5w936XWXWd6lS1VOIk tTG0az58JQ5G1z9KLowrOOFk4HIU7uEcrXO0c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WjHLE7zLeKXtANi5+giNZUhSgv+udHd254VSbdAIWO8=; b=L0NSWioqvD7LfWK04XCucEGLIXWSH2kjs/1WBDLySAhQj7yeBcYF96KtZdaIKMKLRy HU/QqijbsvOMcz11gwSijy6r5UYK1zruSZ7sAUUUbJCRPQFYmO5LNyDvIrQNLgYK4lSO H/ZI4ibllToUaCAFpanQLnHJ4DpnWy822g1c87wkN5aPeWzN7u0ZBKYM1qQA+aWLnMqI pMOUR186usrheI//VIpqMRSVSM+Dqw2PQTKhMZwCj8O//iC1/z66mDl7jKlHKdco+YQA lxMw7lLXpiJ5kChENud4SvCAaZ0ZncokSMoV5TMXrUfxNOpaGfDfKkEj8mVRMjLep4Uh 1Eyg== X-Gm-Message-State: AHPjjUj+zAg0yAEqlgG9DkqpKC0wOdk29JvII2xDdmmxoXZEXEYYCh5z KhBcLN5lgxf2n2yP X-Google-Smtp-Source: ADKCNb6nrFudOt7EUrFf+C7G3X6i7GLIzjO8vxSv4gH4LSbvTr5AEM1Wg/Lx6qbDkZhw9DvI1ice/Q== X-Received: by 10.223.177.193 with SMTP id r1mr4291443wra.50.1504440499796; Sun, 03 Sep 2017 05:08:19 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, kernel-hardening@lists.openwall.com Cc: Ard Biesheuvel , Arnd Bergmann , Nicolas Pitre , Russell King , Kees Cook , Thomas Garnier , Marc Zyngier , Mark Rutland , Tony Lindgren , Matt Fleming , Dave Martin , "David S. Miller" Date: Sun, 3 Sep 2017 13:07:29 +0100 Message-Id: <20170903120757.14968-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170903120757.14968-1-ard.biesheuvel@linaro.org> References: <20170903120757.14968-1-ard.biesheuvel@linaro.org> Subject: [kernel-hardening] [PATCH v2 01/29] net/core: work around section mismatch warning for ptp_classifier X-Virus-Scanned: ClamAV using ClamSMTP The routine ptp_classifier_init() uses an initializer for an automatic struct type variable which refers to an __initdata symbol. This is perfectly legal, but may trigger a section mismatch warning when running the compiler in -fpic mode, due to the fact that the initializer may be emitted into an anonymous .data section thats lack the __init annotation. So work around it by using assignments instead. Cc: "David S. Miller" Signed-off-by: Ard Biesheuvel --- net/core/ptp_classifier.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/core/ptp_classifier.c b/net/core/ptp_classifier.c index 703cf76aa7c2..7109c168b5e0 100644 --- a/net/core/ptp_classifier.c +++ b/net/core/ptp_classifier.c @@ -185,9 +185,10 @@ void __init ptp_classifier_init(void) { 0x16, 0, 0, 0x00000000 }, { 0x06, 0, 0, 0x00000000 }, }; - struct sock_fprog_kern ptp_prog = { - .len = ARRAY_SIZE(ptp_filter), .filter = ptp_filter, - }; + struct sock_fprog_kern ptp_prog; + + ptp_prog.len = ARRAY_SIZE(ptp_filter); + ptp_prog.filter = ptp_filter; BUG_ON(bpf_prog_create(&ptp_insns, &ptp_prog)); }