From patchwork Fri Feb 10 10:08:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jess Frazelle X-Patchwork-Id: 9566401 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 6E1B1601C3 for ; Fri, 10 Feb 2017 10:09:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AD3828540 for ; Fri, 10 Feb 2017 10:09:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D55928556; Fri, 10 Feb 2017 10:09:40 +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 61CC228545 for ; Fri, 10 Feb 2017 10:09:39 +0000 (UTC) Received: (qmail 23945 invoked by uid 550); 10 Feb 2017 10:09:37 -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 23913 invoked from network); 10 Feb 2017 10:09:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jessfraz.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RufrqK0k5ha7Kb5o65sq0CJGU1E4gG0En/O3rPlJ5HQ=; b=BQEt24yMywLsuXigkdduMZ/m/1MEO3aagk5QlydRTHDIqRsE5aUc2Vpde4ib9L94xp GGVINLiMbDD/0AL/Jubaz9Ex6Bd1VA6YZlqnPqoB43zBeNjSjxeMJQxK/QVxVK130L+0 5MgAS1cD5YRdsUaxHqF4LziGzEZnAymb9xZY4= 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=RufrqK0k5ha7Kb5o65sq0CJGU1E4gG0En/O3rPlJ5HQ=; b=FguN9hQbNy5GcmIRaOVn7598Qfnhc28Ym8TaY3YgFufJF7ikP3kIXxauIY3SqmhwGA RI/5kcQjhpbHyhdvjKv2Y6a6vKs/AEfqgkbSILHyFEqOOv5EYoX2bopVFlF8L3uROn3y XdVjTGdwCEzUNawhCy1s2YXFPui+WLnGshGC0+Lnzjo3gyUUsQFLxlSKmdEwEWdTXTg4 x4UQ9IcQ/OOHBSHZJeEcVwXXPJLI+6KfsqtAbXgdxTNcs2p0RCjOgJDBEIjQwtZUl58q HVgKeip3CshMgUUJnqpLG+jLHInc0e+k+Tcw9pcbGvwNJDjWhl6oL0sxHzjuNwKBYF96 23Sg== X-Gm-Message-State: AMke39mplZWX57n0c0HzzF/lMK7cX8r4h81UDOiwIf12+fVY1Hk6Gda4F/Ad4au15d5dGJLS X-Received: by 10.99.39.71 with SMTP id n68mr9523303pgn.85.1486721363622; Fri, 10 Feb 2017 02:09:23 -0800 (PST) From: Jess Frazelle To: kernel-hardening@lists.openwall.com Cc: Jess Frazelle Date: Fri, 10 Feb 2017 02:08:59 -0800 Message-Id: <20170210100902.11765-2-me@jessfraz.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170210100902.11765-1-me@jessfraz.com> References: <20170210100902.11765-1-me@jessfraz.com> Subject: [kernel-hardening] [PATCH 1/4] 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. This protects the data structure from accidental corruption. Suggested-by: Kees Cook Signed-off-by: Jess Frazelle --- drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 2 +- kernel/irq/generic-chip.c | 2 +- kernel/irq/msi.c | 2 +- kernel/irq/pm.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) -- 2.11.0 diff --git a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c index 6b1cd574644f..0e2c1b5e13b7 100644 --- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c +++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c @@ -51,7 +51,7 @@ static int its_fsl_mc_msi_prepare(struct irq_domain *msi_domain, return msi_info->ops->msi_prepare(msi_domain->parent, dev, nvec, info); } -static struct msi_domain_ops its_fsl_mc_msi_ops = { +static struct msi_domain_ops its_fsl_mc_msi_ops __ro_after_init = { .msi_prepare = its_fsl_mc_msi_prepare, }; 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, };