Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6091406ybh; Wed, 7 Aug 2019 17:11:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwmGAjTq+oj3nyv4sRPt9+RVvycPemNPbK99kImdvjOj0pY65X1+JNCxJ+iWY8arNys+3k X-Received: by 2002:a17:90a:7788:: with SMTP id v8mr1072466pjk.132.1565223109328; Wed, 07 Aug 2019 17:11:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565223109; cv=none; d=google.com; s=arc-20160816; b=FL7NlraYq0f4HxRE9mN2cLtup5RrrzX7uZCSLit+Mwpz6QF3fTF+d2LVBn0u90IiMm rNHtNUCw7SERbwxc36iL3eeUOzuRSESyVfSbp2LN6YIEgUG5vdo6symPiTgYaFt394dj r3wwix0S8dhrwvRBrLihMapyVyMrjYPUrTmGnabbB/wqpCuBIIEKVF6i0yqq3CfMhaCn lF4MX5SFdSnFrEfI7kJEWpXViJH3pmKY7GmxSF1v8fT6mZwrxJSULK/p5n+cT8qWObVP HXc0/jQpSlxGfFmQgL40xVmsytMUL2sivTCtpHMUhMG2Vpnp91atAQ7hIjbDWAh08MHE 2pdw== 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=dLYiAr9hqix+w29Ej2S74ESH31+c2YOxCuX5zuQe/lQ=; b=Cb21lsmq+oz23NmtMyrpeqhz/E/SvO+9kctxjrhtzJuwXPW1jeWTMOMQh1k5kvIrXt lSH7O+PJVUH7gJJ9r9iirazvRa/Gms95049jux1Ewn981WfFDAXCQI8UoHkxkALnLYEo MlNriuSLzAYpJyPIRuZNo7AGgYID+47IiOKvAwrsBZKKgv9z4FJ3+iP9An3HG/nnyb+Q rGXCBdIF7mopKl57q75u99a49B63sEynruuJHwnjVLJeeErrS1gZBTLJo1bbc+/4gxVk GVuu5zjdk2EmEHDCqhAKKtOLJGnPkhwVuhmJRnKbu7pfF8rbkSi+UPIog8Yf1pJ/PIS9 FwcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uoIhUEuU; 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 cj14si48231802plb.141.2019.08.07.17.11.34; Wed, 07 Aug 2019 17:11:49 -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=uoIhUEuU; 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 S2389704AbfHHAJQ (ORCPT + 99 others); Wed, 7 Aug 2019 20:09:16 -0400 Received: from mail-pl1-f201.google.com ([209.85.214.201]:43005 "EHLO mail-pl1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389661AbfHHAII (ORCPT ); Wed, 7 Aug 2019 20:08:08 -0400 Received: by mail-pl1-f201.google.com with SMTP id x1so11876476plm.9 for ; Wed, 07 Aug 2019 17:08:08 -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=dLYiAr9hqix+w29Ej2S74ESH31+c2YOxCuX5zuQe/lQ=; b=uoIhUEuUfzQjSKJS+7uyEhLItO8fBOuPoBctqNF+mfgcDy7bzRQ/Ft8tv1RdYxWlG5 O9VtfxsYBr9KFdaoYsSLwqG3su5Ai7ft9709ro41wWX7OECg9+0mq1iCzMtAk2w3QzTd PES0/NZaoYskLxwaDyNKcSJSorIVrYW+92TbMjkbiQ5e/PzR8Zxe9gR2enjSQy93dh7x 5HehUUasr80bkgmESKnM35g6OsTHCyRtdHy2JweVD2RpPwMs0M5cwUS8+Tc1y6CYbvfQ 6Y9dbhAZ160BONDi0650a8BqYkdAauasMbBal2w8FlJccfSV5+ZhICF4CCQb1XAGqk6P xsxw== 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=dLYiAr9hqix+w29Ej2S74ESH31+c2YOxCuX5zuQe/lQ=; b=W4UaBkMOeanbFoW3Q0fMXqekJACPCN6COu72FtTzm+zisoay/wLbzwQnFHBwcfbbfv HexbtArYrq5g81yav7JNKx0cDx6veGllzpbpR6g8/DloPKD+qoTGXgXXeAP55ZuPqzzB SxTxPnuN44WFOjUeA+48HQnD5vqAdwV3SWVc+pH5KVWnfiyv6mFofli5qzU/XpcZYQmh HeuZ4zdLYZ+qXuGW5CibZKqWITfPogyidIqwDD0c0un3oJv2nwZpCArKrVN5HIL/t3F9 xD5zJXBSa7IA49OTxuPqHg0NI+XLigdV8GVb4wJOrbSi851SyHSxDwmArxTmbqUSj7Gt Km9w== X-Gm-Message-State: APjAAAXkSQmmGBkaGJlXJyQJIxpqer0YH4XR31+XHmvB7Y+bud2P+afr +w61goY8NcIKEIHY8vI53/wZNlCgXdwmhpWF4GkEIg== X-Received: by 2002:a65:51c1:: with SMTP id i1mr10127643pgq.417.1565222887874; Wed, 07 Aug 2019 17:08:07 -0700 (PDT) Date: Wed, 7 Aug 2019 17:07:09 -0700 In-Reply-To: <20190808000721.124691-1-matthewgarrett@google.com> Message-Id: <20190808000721.124691-18-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190808000721.124691-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog Subject: [PATCH V38 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 , Kees Cook 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 Reviewed-by: Kees Cook --- 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 abd029945cc8..629359fe3513 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -1575,6 +1576,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 1c32522b3c5a..3773ad09b831 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -111,6 +111,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 ecb51b1a5c03..22482e1b9a77 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] = "modifying ACPI tables", + [LOCKDOWN_PCMCIA_CIS] = "direct PCMCIA CIS storage", [LOCKDOWN_INTEGRITY_MAX] = "integrity", [LOCKDOWN_CONFIDENTIALITY_MAX] = "confidentiality", }; -- 2.22.0.770.g0f2c4a37fd-goog