Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp847757ybd; Sat, 22 Jun 2019 17:02:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYefxXxq55gdHSSsjWW3Tp8Oo7Os0A7LxtykDpN10CL/1Tns6hsd70tRdi1ArotIHDHMie X-Received: by 2002:a63:601:: with SMTP id 1mr12473860pgg.380.1561248177203; Sat, 22 Jun 2019 17:02:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561248177; cv=none; d=google.com; s=arc-20160816; b=o1+6ltvaEuCOzPuinOMZCA33xhPaRS+cXUyXse6Kd02zWVjvY4UIT05skPToDk8TlJ 4GC6uq+EkAthq/BupRN9ep76AazF1V6E6akyixqcgshWGV5kDfmGX8Zi7uvajF6IdCRS RMZDoSMCdzzWDWC3UoitBE39DvILpPd48mlaG65uzN0ipVVel3H/B0dE+IUuZlg6/u43 N/qmSTc/SKndyTIG/v6GECCBV0J3q+CBnXfomwXG6gJ0gKJUUnOvv+Y78QZLKfd1hoyj 2lXPQhxbaR9cPX2Zf9ZG1cBrGBnmjQovV4gRF1GPbuNry6WMgNVShINsbg6sziJ3sMQ3 SXPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ZMNIOFseSQcYxEjUupK03sQ66VU8PHhoSnEBiSbAi/U=; b=lSHSdVoq6VvdYp+TwmP609dYLi5iTV4zcHwLsYuZ8bX+HHVScYReNfcBhNrTrH/kA6 E/ABzqwl573HfhniNzfjS6IEKYbv+1WuvCSNFlMDV/ljKG2cUQPuAH/TSGpYc1OrSwhH aeoO3iv8cE6Y84fmV+a8KaqyiDgs/eBmjahmqnCjqfmW+rI9o3N30LdO9laCtYaRaKbU CcGpRhGo43s6BUghrpBp6ThNydm1UZT79/6+P2VFwP9oOHThTUsPMON5pIvEaz3oSvuJ DoLHeskbNWJVGsgLi3mv/dIdwPYNvF7A4WL0q4JuNFWqEIIQyUwqXpv5GCf8QcXHti+6 Ad1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="L9KrA/BX"; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w21si6222574plq.91.2019.06.22.17.02.39; Sat, 22 Jun 2019 17:02:57 -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=@chromium.org header.s=google header.b="L9KrA/BX"; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726606AbfFWAAb (ORCPT + 99 others); Sat, 22 Jun 2019 20:00:31 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:43904 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726455AbfFWAAb (ORCPT ); Sat, 22 Jun 2019 20:00:31 -0400 Received: by mail-pl1-f195.google.com with SMTP id cl9so4779676plb.10 for ; Sat, 22 Jun 2019 17:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ZMNIOFseSQcYxEjUupK03sQ66VU8PHhoSnEBiSbAi/U=; b=L9KrA/BXNHjmkaxVKByrkDNtPrPxcRka74HGOxpTB9HdyCU0HX6rGTdR1kesAuwNE6 bEqA6NQtCugbqlji1SSJWR2rkIbnz/qGV2/w8Ca+uQhOf1vKSPBK2oVMvV+nGeN/xHTA zmwsG0H1akysKNNV2CZuBg47LFUQNbYSuCbRI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZMNIOFseSQcYxEjUupK03sQ66VU8PHhoSnEBiSbAi/U=; b=WkR8ji/GNHgZDX8x1byJ0Aok9dhJbeYuu+iOsTXTrDOWCF1EiEH0ydaNrPrALDvW0/ MIqM0pUGXxNvrSMEiv/ZMiPO7pfettJXrbGDvNUyvunHqZhDd/MX9ZZpckpSK8t4ZbAt OpAh1IINaHJOGRgp774p81QBZ6YxCBj3wzcfbxDdDQc+Qcb9RrR5NHaButAKH8b7V+L9 1vaZbN9BfIZ/qC+QWifqCSYTKG75gmUKnmzRFbnJPmFAN1IYn+eBJI6Zigb/BMKd3i53 gz363ZaSzH0chFZP5z5p/tKpBFc+retCd1xG0hEPUnYBqmHiUOMZ+IVJKll/RSFOV4y0 HVQA== X-Gm-Message-State: APjAAAX5GPeRcl7FtnEIlVd25CuUiBFVclotkEzNlUgNauamUY9YXs5x pymR6U6NJ5/FU7PjSYuzjJIi2w== X-Received: by 2002:a17:902:8eca:: with SMTP id x10mr25804900plo.266.1561248030089; Sat, 22 Jun 2019 17:00:30 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id 85sm6689598pgb.52.2019.06.22.17.00.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 22 Jun 2019 17:00:29 -0700 (PDT) Date: Sat, 22 Jun 2019 17:00:28 -0700 From: Kees Cook To: Matthew Garrett Cc: jmorris@namei.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, David Howells , Dominik Brodowski , Matthew Garrett Subject: Re: [PATCH V34 17/29] Prohibit PCMCIA CIS storage when the kernel is locked down Message-ID: <201906221700.51ABA736@keescook> References: <20190622000358.19895-1-matthewgarrett@google.com> <20190622000358.19895-18-matthewgarrett@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190622000358.19895-18-matthewgarrett@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 21, 2019 at 05:03:46PM -0700, Matthew Garrett wrote: > 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 Reviewed-by: Kees Cook -Kees > 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 > -- Kees Cook