Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6610274ybi; Wed, 31 Jul 2019 17:59:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7KoxXwCbLFeQbndzYdciESZ35iChHXJJyKi5YyJcukXXu5YgEYmau3vvxTC1K0cjLEMTY X-Received: by 2002:a65:6401:: with SMTP id a1mr116648898pgv.42.1564621163381; Wed, 31 Jul 2019 17:59:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564621163; cv=none; d=google.com; s=arc-20160816; b=0idD9CEV8m/MADYj3zUUf228kyXcgRQNq9keh5+kxw/NDNKuPrPwBg4wl43Ejy+hJl o/SWBpw6EzzLwblTtCHW+an5cY7lSn0tKYxeO2Gp5+oUV8uh19px/v6zsmxIRAUtVB6f lgoK0+B7bh/P9xSpHk7+1RfXMlaU/7xy/kWlyZJYA9DdNz0X4f+iFZKfGATNGrW5Vvwm KW93F/vM9Hr59Q70ruA/n1Z3YXNlzAZa0A7nKV0QGo2b+UrJ/AaGoGCmxg/AJ+cJmLck /yIq3Si2Op54PrV9icQV7w2g2uZaI6+t+LSxfxq6c8NNJoYgdazVkMb4dC7R65XMrmfG dL6Q== 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=dOeyqX5Vm+4fk9AaL6l0wlcSTHsgVNucd2gd6kzJXcV7tOIiaZpoUY/vTTq2dvcjbU hge0P53jWs1n3xZRZkq1dQ42mMzHVNCbWaS1+Mp+Q1BTnAZOYo0zMesGuQgXJwnRLioJ sRMFg+7P3NyVMyKgmFax+u7KbEfXih28gksiZW5tcgJjEzKkCDgfvP3c4f3G2N2GI+rk 4/mwgJ4FDrvWo37z1/RYyJr3GN7ffFK/l9Q6a0QZUUVJB5n0c23brbEw7Qc3PBKHTmRR nrHwm/m+v63zI7baY+TSCHix+tJXlmaTVJ+DDognMegGWGTcKbHFWiwThvQwO3KdeItJ x/dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=J+R9NUO+; 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 z26si34471840pfj.247.2019.07.31.17.59.04; Wed, 31 Jul 2019 17:59: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=J+R9NUO+; 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 S1731001AbfGaWTD (ORCPT + 99 others); Wed, 31 Jul 2019 18:19:03 -0400 Received: from mail-pf1-f202.google.com ([209.85.210.202]:42212 "EHLO mail-pf1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731320AbfGaWRK (ORCPT ); Wed, 31 Jul 2019 18:17:10 -0400 Received: by mail-pf1-f202.google.com with SMTP id 21so44179016pfu.9 for ; Wed, 31 Jul 2019 15:17:10 -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=J+R9NUO+EGzhsAS+m7c7T6iL5dyKw3ljJgj6BiTleClCqjtCkL+kDdezdvcfJsGDJ3 4cZ/Pja44HS7lRZcjKwU+essKoGJAGX49BZChnDX5eS3gUwv132EaOLiDNO5ingG5GjE Hltl6luJSw70OVN8qxNs+3AsY1u8GWtW5bBKTx6/LtlzUyenj1VnNDQo5j53whvNvE5S 3f/HX7+8T9WT81XFNhC83MGeSW2rLzVeUBBdJUwfOrA1GWSDXG+SZizQGxgdAofeB7+V 5mqdOiQZj3P1HA5clhctegxqzkvrJ15LJWEBdBUrocyOqFQzzQSuDIddJnpvNnIkBYoO sD2A== 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=AlnlPOX4K7/Rj2RoKMgMqg4GEuYJBoDzJQhBo4z0X3Iz6PkKpDkSrzr+Xx/c+OcoWG +jsEi8wgVxMYloi9wzaFhJrXWsobOGUeUenMuSHmMb/l8o7n1Y5BeCK0eksryJH5QgdB mON5GBKGmM4cVdMmX8xIpUO9CwDe7dcewdfr9lc+pY744kHkDQWlRVzUzrQhSuqrnHOV Y3wCeByk4Teh6T9At/4aQcI7YaBFme58OkySrdLf+gLGSPUziZK6Xa6sC9OcCQ1fqBbB oj1U42qznFQBwe1nJfAa7EKenyhM8SGleim1pqiXoBjdbufqzMTjQqyE4bpwr/b0VoZY 88RA== X-Gm-Message-State: APjAAAWTxVIjDO/7GDuqIo65NMteOy/MZn1f112Kc0et/Uu94TyHNxZF NXtyWMQC84agiirmnkPwq9Rd5eMVMcB4xOLK+ZqMvg== X-Received: by 2002:a63:6c46:: with SMTP id h67mr107976504pgc.248.1564611429249; Wed, 31 Jul 2019 15:17:09 -0700 (PDT) Date: Wed, 31 Jul 2019 15:16:05 -0700 In-Reply-To: <20190731221617.234725-1-matthewgarrett@google.com> Message-Id: <20190731221617.234725-18-matthewgarrett@google.com> Mime-Version: 1.0 References: <20190731221617.234725-1-matthewgarrett@google.com> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog Subject: [PATCH V37 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