From patchwork Fri Feb 10 10:09:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jess Frazelle X-Patchwork-Id: 9566405 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 C2E0F601C3 for ; Fri, 10 Feb 2017 10:09:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF7EE28540 for ; Fri, 10 Feb 2017 10:09:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A465B28556; Fri, 10 Feb 2017 10:09:54 +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 B9C1728540 for ; Fri, 10 Feb 2017 10:09:53 +0000 (UTC) Received: (qmail 24498 invoked by uid 550); 10 Feb 2017 10:09:45 -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 24041 invoked from network); 10 Feb 2017 10:09:38 -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=ZutNKhEOqE3o/xWOc/RM2e3Zp6xis30R9jjz7dig1CzHxG+Bwtw1INZY0LCO1fRUrI CI9dE7+fYtfo8FkUHQriPC/cVd5dDhlTBQdIfBoFtZ8cGIKPaZvkvEsf6/PFFDPVRqHe KR4wNXNaSu3vLjeqfJz4XV4bZW12TSUN8EKH0= 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=dybBrIn8Jn/0Ho71CMx+sEqYVXKUyJvJ4SS/PLQ3DzWCnyGPqGX0VMjZx6qdHhqsV7 H0J0axHwODdypEpkli9hy0dE7UAhvdeRgStyLyvBW93dMYtb9c4TPHL3DwzytljytVJj Dxcp4iIki9EN9vRWYjC+85VwG9PmAR7qehTzM9MqfSB4RTrUUPnxUyyuyjuMiVOKUvQK dMww36MJ50yaqzz4Dm1CjeP1VTFZ3q+w4sOE7FFhOWzqFRHgC+jFoEPE3roSIWJPgn/R dcALGD3cwZPf3hgC2BRDCorKWuM20SXa3NoHERKLZSjm6tBbQryh9NgK/fVltfTnhbCe cVFA== X-Gm-Message-State: AMke39n9BVphU9hDA4d0vt/m42O/l8Z5MienTbG6gwMT3B2gM3oEyFBUxpGWoZc6MA6GHaE2 X-Received: by 10.98.149.93 with SMTP id p90mr9281987pfd.72.1486721367131; Fri, 10 Feb 2017 02:09:27 -0800 (PST) From: Jess Frazelle To: kernel-hardening@lists.openwall.com Cc: Jess Frazelle Date: Fri, 10 Feb 2017 02:09:00 -0800 Message-Id: <20170210100902.11765-3-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 2/4] 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 --- 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,