From patchwork Sat Feb 11 01:37:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jess Frazelle X-Patchwork-Id: 9567693 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 CBD2760573 for ; Sat, 11 Feb 2017 01:38:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA6E2285C1 for ; Sat, 11 Feb 2017 01:38:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF4A7285DA; Sat, 11 Feb 2017 01:38:25 +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 C26DA285C1 for ; Sat, 11 Feb 2017 01:38:24 +0000 (UTC) Received: (qmail 22398 invoked by uid 550); 11 Feb 2017 01:38:23 -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 22367 invoked from network); 11 Feb 2017 01:38:21 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jessfraz.com; s=google; h=from:to:cc:subject:date:message-id; bh=UPDOpmTcVl1iCqILEBHi9B5twUO9T6/2mDBgbhodQLc=; b=WmWb+wLVXeWkeFxFN+wjIU0sLyF0/Fiq0v4lYfv4Yf1ZTcp7th4Uvb4Rg4ihew9HNJ 5P7oE9v8mtuDeuMGh5zg+hAowRQEzL0jwYVzTfmjZt+dV/DhtRwfibGyHdAreqj6L3CH XRHzbtPWbt/8wWs+4G4+i2TcxrTbjejKYQxu4= 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; bh=UPDOpmTcVl1iCqILEBHi9B5twUO9T6/2mDBgbhodQLc=; b=IBI5z49+56H9E79WD6O4M30xsdUzsfr2nxsL2C1hl1JOEuE62zm5q91UV2JgQpGWBP 35YVZC8ltbu7Evryx1KoxMyHb0XKfKPBSFIqdZryjhlBcxDUAcTz9dU3w3awN4LR+lj+ oVoR1o1ynhsKH5HLVy/ij7nVmBJuVXLTqps5wygF1MvvC2C33RUVuMfIwXJV3DzTAd6V /3P4jcQ9skzxleegIhYf3w4/ImT3wnAPRcQ6bRTTRvnxZSt/w1lK/PqaRpForD/+A5eY f7d4g+bgW+LJxDH8W5ND+KlJvRJP6sD7LBTr07G8F5IRfygTwEnU/Q1TFCAKxV/YcmwO ReGA== X-Gm-Message-State: AMke39mYv397Q+TDhKuecRAGXQwGdCneWkwk+qeFoCLtGG1kQQsYkQRA42b1cK+S4e3EAIKk X-Received: by 10.98.9.206 with SMTP id 75mr13851787pfj.159.1486777090124; Fri, 10 Feb 2017 17:38:10 -0800 (PST) From: Jess Frazelle To: Thomas Gleixner , Marc Zyngier , linux-kernel@vger.kernel.org (open list:IRQ SUBSYSTEM) Cc: kernel-hardening@lists.openwall.com, Jess Frazelle Date: Fri, 10 Feb 2017 17:37:54 -0800 Message-Id: <20170211013758.3288-1-me@jessfraz.com> X-Mailer: git-send-email 2.11.0 Subject: [kernel-hardening] [PATCH v2 1/5] irq: set {msi_domain, syscore}_ops as __ro_after_init X-Virus-Scanned: ClamAV using ClamSMTP Marked msi_domain_ops structs as __ro_after_init when called only during init. Marked syscore_ops structs as __ro_after_init when register_syscore_ops was called only during init. Most of the caller functions were already annotated as __init. unregister_syscore_ops() was never called on these syscore_ops. This protects the data structure from accidental corruption. Suggested-by: Kees Cook Signed-off-by: Jess Frazelle --- kernel/irq/generic-chip.c | 2 +- kernel/irq/msi.c | 2 +- kernel/irq/pm.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) -- 2.11.0 diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c index ee32870079c9..cca63dbaabea 100644 --- a/kernel/irq/generic-chip.c +++ b/kernel/irq/generic-chip.c @@ -623,7 +623,7 @@ static void irq_gc_shutdown(void) } } -static struct syscore_ops irq_gc_syscore_ops = { +static struct syscore_ops irq_gc_syscore_ops __ro_after_init = { .suspend = irq_gc_suspend, .resume = irq_gc_resume, .shutdown = irq_gc_shutdown, diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c index ee230063f033..0e5b723f710f 100644 --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -217,7 +217,7 @@ static int msi_domain_ops_check(struct irq_domain *domain, return 0; } -static struct msi_domain_ops msi_domain_ops_default = { +static struct msi_domain_ops msi_domain_ops_default __ro_after_init = { .get_hwirq = msi_domain_ops_get_hwirq, .msi_init = msi_domain_ops_init, .msi_check = msi_domain_ops_check, diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c index cea1de0161f1..d6b889bed323 100644 --- a/kernel/irq/pm.c +++ b/kernel/irq/pm.c @@ -185,7 +185,7 @@ static void irq_pm_syscore_resume(void) resume_irqs(true); } -static struct syscore_ops irq_pm_syscore_ops = { +static struct syscore_ops irq_pm_syscore_ops __ro_after_init = { .resume = irq_pm_syscore_resume, };