From patchwork Sat Feb 11 01:37:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jess Frazelle X-Patchwork-Id: 9567701 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 F19FB60573 for ; Sat, 11 Feb 2017 01:38:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFD4E285C1 for ; Sat, 11 Feb 2017 01:38:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4821285DA; Sat, 11 Feb 2017 01:38:46 +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 1B1C7285C1 for ; Sat, 11 Feb 2017 01:38:45 +0000 (UTC) Received: (qmail 24515 invoked by uid 550); 11 Feb 2017 01:38: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 24453 invoked from network); 11 Feb 2017 01:38:39 -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=VC/ipp9XfUusCqMwP/ZwPPp92lSH45P49lKq2fRYAaU=; b=GHi0XoPraT3vZb0cRoQVxrVV/vhoKkeqk+sthF+yPAKsdHyXyzvFbnRducmbENoaHH sydppQMAhDoXL5ef92aqR61Z51D6qmy+u7hxljoD8Y/G09oQ6ho+OVoOw2yZV3ElAskp KSkkKgfyAoadqJ04UVj9aTJ3lVecU29R8EJho= 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=VC/ipp9XfUusCqMwP/ZwPPp92lSH45P49lKq2fRYAaU=; b=gxaEZsM5E3LGjxhVweVEnebtjyGLVwqPEqythKOE9DFgLY+HMtmm/f87kscJ/GberH PXcuG9em/kOepZgwByzS3xSM5FUDVy0ryX0ZGJWC3/Vi0TZsp67+sH0X6kjaTACftZX3 nnZQtheIwLiBaH/DdTiWQdwZHX0rY9o/tv5B0mCiAxgYJ/NO7bg1PrXaghWnrkBVQ6oi xqg4fbO6cIKHqZjjmYcuEHnmPYrf1n0759JIn3+pKpq6z8jgq40Wxk3F91QiGDaA/kQL W/jqSY3pMpj76CjejRXIpbhQ2e0q4+mVAAJiFlsIlKoMye2uizCJjZgOT3oAGlzc5QD1 pruA== X-Gm-Message-State: AMke39lPnG/CL2iS1V+fDyPEDxX6IiBXpG3zvI52ZFz8VsEwkupWqQ7lBhsjscaVb4T3tsHc X-Received: by 10.84.217.153 with SMTP id p25mr12293905pli.164.1486777107989; Fri, 10 Feb 2017 17:38:27 -0800 (PST) From: Jess Frazelle To: "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Bjorn Helgaas , Keith Busch , devel@linuxdriverproject.org (open list:Hyper-V CORE AND DRIVERS), linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Cc: kernel-hardening@lists.openwall.com, Jess Frazelle Date: Fri, 10 Feb 2017 17:37:56 -0800 Message-Id: <20170211013758.3288-3-me@jessfraz.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170211013758.3288-1-me@jessfraz.com> References: <20170211013758.3288-1-me@jessfraz.com> Subject: [kernel-hardening] [PATCH v2 3/5] pci: set msi_domain_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. This protects the data structure from accidental corruption. Suggested-by: Kees Cook Signed-off-by: Jess Frazelle Acked-by: K. Y. Srinivasan Acked-by: Keith Busch --- drivers/pci/host/pci-hyperv.c | 2 +- drivers/pci/host/vmd.c | 2 +- drivers/pci/msi.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) -- 2.11.0 diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c index 3efcc7bdc5fb..f05b93689d8f 100644 --- a/drivers/pci/host/pci-hyperv.c +++ b/drivers/pci/host/pci-hyperv.c @@ -958,7 +958,7 @@ static irq_hw_number_t hv_msi_domain_ops_get_hwirq(struct msi_domain_info *info, return arg->msi_hwirq; } -static struct msi_domain_ops hv_msi_ops = { +static struct msi_domain_ops hv_msi_ops __ro_after_init = { .get_hwirq = hv_msi_domain_ops_get_hwirq, .msi_prepare = pci_msi_prepare, .set_desc = pci_msi_set_desc, diff --git a/drivers/pci/host/vmd.c b/drivers/pci/host/vmd.c index 18ef1a93c10a..152c461538e4 100644 --- a/drivers/pci/host/vmd.c +++ b/drivers/pci/host/vmd.c @@ -253,7 +253,7 @@ static void vmd_set_desc(msi_alloc_info_t *arg, struct msi_desc *desc) arg->desc = desc; } -static struct msi_domain_ops vmd_msi_domain_ops = { +static struct msi_domain_ops vmd_msi_domain_ops __ro_after_init = { .get_hwirq = vmd_get_hwirq, .msi_init = vmd_msi_init, .msi_free = vmd_msi_free, diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index 50c5003295ca..93141d5e2d1c 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c @@ -1413,7 +1413,7 @@ static void pci_msi_domain_set_desc(msi_alloc_info_t *arg, #define pci_msi_domain_set_desc NULL #endif -static struct msi_domain_ops pci_msi_domain_ops_default = { +static struct msi_domain_ops pci_msi_domain_ops_default __ro_after_init = { .set_desc = pci_msi_domain_set_desc, .msi_check = pci_msi_domain_check_cap, .handle_error = pci_msi_domain_handle_error,