Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3353939ybl; Mon, 19 Aug 2019 17:20:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzb93FLcmGfztPdOiG8rDKIRYcGzVwTne9D8GzTLg4N58jIaPWUIhXE3zMzkG5GlFZeEj6y X-Received: by 2002:a62:cdc3:: with SMTP id o186mr27232928pfg.168.1566260427428; Mon, 19 Aug 2019 17:20:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566260427; cv=none; d=google.com; s=arc-20160816; b=vQECQ5lB2zCGD0b8NNTMCA4E/uxU3YFBEUbcyKkOvkea+LO1t8GB40nNp2GtQiMATg VTPWNjFwiMo1Yw31VMuTy3BsmBDOdB+whkrrY+lXNp3OITPFYM+gNvxgBWT7PCYr/uRl 0kmVm1RlXIXniCMu44cSGq9sMASpIpgxNV+Od2oAJaJqS/Is2IJjb7Goc2PapHYj794z uvpNvyxKkmHvcGSTzyNZe2CgiiOo4hJ5DCUJNSF5DY71c9mKiqWHgLvksNfkW6vMuJxx lMCA/crSnBcBw2fYN2OsVaNW28B0k+lm0jvqsBRW7sM6Gv5RfC120bo8cGrlLCnd+yIl Z72A== 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=35n/myhIkZARa/uZ5q4gPGoePbBU8ZNX2O/3CkYF71I=; b=SybIF8OP94lU0Ay8cf0ULqzmwXwUY/JWV1F7OhBAh3pUr2fM7pkbO6sGpXHiOzZA96 WCGtrjXXD1BilXlgRxJop9APWlgHiVQeW7NVKzGvFuEFlXyNtB6bIPcpF5EWF+t2SawD xDfdymiqmVeLH14N2tX8K2zzrj+p2FZiCoDMhDnLOgYyBd3f8AlxhZ+tRXm3jllfWt/g t53JpymjiFViAiP2lrPAsFpKq7dLYJAkwKWOXL7DTYC1q5py1qyCkrvZo9BQ33wbzz/8 kcN4qh6ipaeKBVf4H0D7tofsD44W5n0j7T6KNEBDWTqlTiCUVdwo74SOOQyvu8CWYCmW aNXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=JzYoJdIQ; 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 r3si11618620pfg.156.2019.08.19.17.20.12; Mon, 19 Aug 2019 17:20:27 -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=JzYoJdIQ; 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 S1729097AbfHTAS5 (ORCPT + 99 others); Mon, 19 Aug 2019 20:18:57 -0400 Received: from mail-qt1-f202.google.com ([209.85.160.202]:41379 "EHLO mail-qt1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729090AbfHTASz (ORCPT ); Mon, 19 Aug 2019 20:18:55 -0400 Received: by mail-qt1-f202.google.com with SMTP id c22so5493054qta.8 for ; Mon, 19 Aug 2019 17:18:55 -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=35n/myhIkZARa/uZ5q4gPGoePbBU8ZNX2O/3CkYF71I=; b=JzYoJdIQZVqEBD5V6Z09iglYOVrptulOchSxI38Va5W+5i7yu7JjEQ1tfyAcjGsfjk Ujys/43RkAwNlA3IBcLbJZL3Kteqr25AqiPpGRePZ/fHZyJWmUaF2Y6bgihwhUCEULS7 tFdTRxF0bBH9K623IwD11d+QXIP8+MWxTbMp4/QnSpnTF+APBAmnlNLnjRpeHs2yMZPU 4QSmDpNc1brfw2EYa68be4okFH9MC0rcFxw6yTNP3RX6zxoutvJg08xlkwgp3FnLvkQ8 JyjOy4+stN62QQ4hjASilJPpH0bVJ3aZhbGQmRxbfF5l5YQPXQALMqpaHWLVawVQ6A7Y Ds4Q== 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=35n/myhIkZARa/uZ5q4gPGoePbBU8ZNX2O/3CkYF71I=; b=AYE+/VRrMdNNRCKSs7l6CaZs+NXl8E+9DbtadevZJVuJ0nbjFESxJee5HUoaMBW/Qx KFRIn5TkD5S6+cLYAwvDJIpR8KPNQiVf6QnpdS50rdAgHJPWXYCOPj5yODf/Feci5LUa OGATLgaCcs6qJp7FwvM+wuMVh1J2t7UdSQ5YhfT8imyY8QfEb0q34DWyT/WlD0zCunqL J0CYbOzpsLW65lq11E0Sk/WpjYdFC85zNMLTaOAKUwOCGDMDvKQU9IJundBmSjoJEd76 8+pHNw+Hk6877N3fsz7bTQyRpRgKx5fHtgdNAZqF4vxEpED6aGy5+V3T8xPc4MdYO3Jr BAbg== X-Gm-Message-State: APjAAAVqD77nfhjQhKbzvE3YJNrLV0AsmO1C6P8j3DFgjwvE9xTuAnmE Q+/E0nqLoX2VCHtmrmlYARpb+ik8aIClqKu8GkjH/g== X-Received: by 2002:ae9:e916:: with SMTP id x22mr13987177qkf.296.1566260334505; Mon, 19 Aug 2019 17:18:54 -0700 (PDT) Date: Mon, 19 Aug 2019 17:17:53 -0700 In-Reply-To: <20190820001805.241928-1-matthewgarrett@google.com> Message-Id: <20190820001805.241928-18-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190820001805.241928-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog Subject: [PATCH V40 17/29] lockdown: 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 Signed-off-by: James Morris --- 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 390e39395112..683f0607e6f2 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 6d44db0ddffa..db3477585972 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.23.0.rc1.153.gdeed80330f-goog