Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1239883ybi; Fri, 21 Jun 2019 17:08:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyVNX/lFGP/zCwyiELMX3hHpmkHMKYiLCujoOdguq28NXA5FtmnrVB5bMNYemVOfDtc7/6o X-Received: by 2002:a63:a46:: with SMTP id z6mr21091333pgk.76.1561162103817; Fri, 21 Jun 2019 17:08:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561162103; cv=none; d=google.com; s=arc-20160816; b=PxflRu0zg4djPrGNlfySBXo2Yuy3/9BP33ScRHI7VUEXmvK0hS9n/IctwkKd3eM/TM RFItmiytUrtiHDZ9+mbbZEWg8B6L1ClFKuE+Zt8VFMdvrfQ63AvoK1jw60l6IsMIoF5S OmMkBc8ZAQ7IDNFYWHkuyDPjWZ2zEMqtkzEAiTlDTpGaQMFboQJtMEBt/XPm51k7EWo1 IUwvalLnTZ/n9riDb7AhPDv/9l8xmxNvXnS5M26PPRBn4eKo+ilW2w0OMIpNdVrMw3zu KcFJ5foz5X42xAN2apOuTTa+r3G62nWJJjCmNNsYqaM12zdCKeZuspX6b84HIRo/BvY5 0T9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=D0cR1P9fRxl7I0Frc/NTBEIf+XZBbF2jRPFJwWOLz+E=; b=pOv9DqeJuWIBFaB0YUYCOA6i0eYINUP9eXvc5F26CcAyXXscb7E1tJ3DxseAJwi5sU rp+3FFlOmRKIl5b/LtXaXuDWnD2DjBM3XSetfV/MMh7XPhbE9kvMQ945JDVvhQZV0p5F mpFpbdBrikg7Pi4q0cTqOCGZ8SZiLK1++Txb75QrNNyFS2kYQFqUOoQ2lm0B6FdFYsWn iTfNvypee7/bAT5/xQww9m84OgZunI+cGnwR4Z+BB7ea0+359EcqWwvbx/Xlg9q9lYl8 Uhiq8l0PNV5BmX3Tj3imfNwqSBv0X2e0cd8fdjNLoqE0rSiJIcZ+3lPq/aIgAH9G8U91 N8Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FN6rV7g1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v25si3908727pff.274.2019.06.21.17.08.08; Fri, 21 Jun 2019 17:08:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FN6rV7g1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726858AbfFVAEs (ORCPT + 99 others); Fri, 21 Jun 2019 20:04:48 -0400 Received: from mail-vk1-f201.google.com ([209.85.221.201]:44797 "EHLO mail-vk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726799AbfFVAEq (ORCPT ); Fri, 21 Jun 2019 20:04:46 -0400 Received: by mail-vk1-f201.google.com with SMTP id m1so3033829vkl.11 for ; Fri, 21 Jun 2019 17:04:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=D0cR1P9fRxl7I0Frc/NTBEIf+XZBbF2jRPFJwWOLz+E=; b=FN6rV7g1wI/cQULj1NeHY25dTFSqkhZVIJO87pMC8h34LSqiJQhwzDrpYiiyO8S5jK 5WuO9AZdivmx/IHth4tUCWQsu6aK1fXCa5IPsW5FyAyGqhS8o7SCfRLNWeyr907mEW59 BAJPQagNPHWoiAygcQ0WsleyxggB3QLnTgAO+0Zr4NToG2qapy/zD98DVHT5+cl8/EFi akZMCzlatqaUHLdwExao4rabh18Lcd6oOW0GtIjJk38zWfTVsXKKAKOuzq3RsSad3pYx ZB4xF7cn+5hEak/ocAoFV8txF3GMIWM+p7k63J35lWdSBGYy+9L8ZWheJ2dRmhfe0fOx k6Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=D0cR1P9fRxl7I0Frc/NTBEIf+XZBbF2jRPFJwWOLz+E=; b=eZ+wVwZYXNeIMQZlMpJPRhcy27q1v0S/Y8XUEJANo1zkk6ELE4fJnKpKAPDNeuh7h4 v1H/OF067pobCKQsftUnnj4ST7nn7TWoYaKmO2CGaRpfxokCibITGMRsIN3tD8r7ak4r N60prHq2cQ+FzKjqL7l+IE7NYmNJovkxSUQoTCMBP0qW3gxiHWrq8rg0u9WxdPiAnAPZ yGBJXwR1gf+RYpn9sZnVbcknh8VCI+3kcqPtv9X7R89mc4/NwFjc4WO4Y9v0j4FKiill hwjCv8aa9wHsI+w7ZwIio4jQ79HdpArefBNSjdQU0CdlV2rMzXrcu7xpG531b3zgIZ9H a3iA== X-Gm-Message-State: APjAAAUd+0GPsSUMCjGY/W7HxdkozT/goTRmdZIvPGcIMRIkRP6siPDz DYfhVvrNTrZouq5kGLuWjtpLUYrAFSlBzllbnLhKGg== X-Received: by 2002:ab0:7618:: with SMTP id o24mr14156916uap.39.1561161885166; Fri, 21 Jun 2019 17:04:45 -0700 (PDT) Date: Fri, 21 Jun 2019 17:03:46 -0700 In-Reply-To: <20190622000358.19895-1-matthewgarrett@google.com> Message-Id: <20190622000358.19895-18-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190622000358.19895-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog Subject: [PATCH V34 17/29] Prohibit PCMCIA CIS storage when the kernel is locked down From: Matthew Garrett To: jmorris@namei.org Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, David Howells , Dominik Brodowski , Matthew Garrett Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Howells Prohibit replacement of the PCMCIA Card Information Structure when the kernel is locked down. Suggested-by: Dominik Brodowski Signed-off-by: David Howells Signed-off-by: Matthew Garrett --- drivers/pcmcia/cistpl.c | 5 +++++ include/linux/security.h | 1 + security/lockdown/lockdown.c | 1 + 3 files changed, 7 insertions(+) diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index ac0672b8dfca..379c53610102 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -1578,6 +1579,10 @@ static ssize_t pccard_store_cis(struct file *filp, struct kobject *kobj, struct pcmcia_socket *s; int error; + error = security_locked_down(LOCKDOWN_PCMCIA_CIS); + if (error) + return error; + s = to_socket(container_of(kobj, struct device, kobj)); if (off) diff --git a/include/linux/security.h b/include/linux/security.h index cc2b5ee4cadd..03c125b277ca 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -90,6 +90,7 @@ enum lockdown_reason { LOCKDOWN_IOPORT, LOCKDOWN_MSR, LOCKDOWN_ACPI_TABLES, + LOCKDOWN_PCMCIA_CIS, LOCKDOWN_INTEGRITY_MAX, LOCKDOWN_CONFIDENTIALITY_MAX, }; diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c index 1725224f0024..7be3e8fb5847 100644 --- a/security/lockdown/lockdown.c +++ b/security/lockdown/lockdown.c @@ -26,6 +26,7 @@ static char *lockdown_reasons[LOCKDOWN_CONFIDENTIALITY_MAX+1] = { [LOCKDOWN_IOPORT] = "raw io port access", [LOCKDOWN_MSR] = "raw MSR access", [LOCKDOWN_ACPI_TABLES] = "modified ACPI tables", + [LOCKDOWN_PCMCIA_CIS] = "direct PCMCIA CIS storage", [LOCKDOWN_INTEGRITY_MAX] = "integrity", [LOCKDOWN_CONFIDENTIALITY_MAX] = "confidentiality", }; -- 2.22.0.410.gd8fdbe21b5-goog