Received: by 10.192.165.156 with SMTP id m28csp1005763imm; Wed, 11 Apr 2018 10:40:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+NhBjSwxHoMmKuS/FmX2lbN+bIpFKUlSfJbdFAIi9O0f0hDI9oDQ7R7XsNxcqIdDhlyAL2 X-Received: by 10.99.116.76 with SMTP id e12mr4067575pgn.270.1523468457773; Wed, 11 Apr 2018 10:40:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523468457; cv=none; d=google.com; s=arc-20160816; b=HTOEKe7lT5kF7LExtCTsIGg2iPcNzARf8qFdHBAzSSoUwDdvlxnn1omhFsIQAGMech /fY9Ud7BWwWCjw395WT6nuaaZUy/FUiy3XCamGR4+9Fgc7yBPR920g4uXlA77UEurcG9 xWqn/6QMr654z3wuI/M45cRKdi65LPIcDMxgV6SUAwf0T3w40KCwi2IyGlAJ3E96L6i3 AnR/JJrkzXm1Wz0IDTAcha2JSbqq6IvdiKjACZg4nX7M5rMygduVYQ/stPVUO6h/4cr6 TZoGpcb+gXyFDwkYvg2JVrdq3n8P2JZxgKuKNOxL1vc7Cu+WBl73RvIiB198XcqJMGZ6 5s+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=wOz97gVhqNM5/FEW+TKkBDwzyqoscP9262N7QZdU2XQ=; b=hxyvTmqxXoW108DFA6TmHXJbNjnqDFmdfvxzzf/qUd8WL4GRa3u043FsBtnoqNK1Kc /JWtnn8sFniUJm8r0P77ZPKudVcYIE60n+zB/p1iy7EvT5/ZX3+UNqcK+f2PZwaBr6zn 5JkL/p49/IEndeurN5RUGgJYLSy2Z/FzaiJj0COloqwHMuPiWG1OPQvZ0WT3LkmqKKyb l8xuOhrJC5xIvqz8QMLBOxK9W3XECltzYwHgw9gTcXC+S+PQHq1RcjhlQ6Xhvs9SGnlw 4PTpflZ2HY20yYybu5Yd4xxpt0o/g8ckFoRYVshTbfWOKnUR3TAy7IOhWvOFTD+vFMzr ur+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Dq0TwPwI; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o33-v6si1504572plb.429.2018.04.11.10.40.20; Wed, 11 Apr 2018 10:40: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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Dq0TwPwI; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752588AbeDKRhk (ORCPT + 99 others); Wed, 11 Apr 2018 13:37:40 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:36422 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750734AbeDKRhj (ORCPT ); Wed, 11 Apr 2018 13:37:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=wOz97gVhqNM5/FEW+TKkBDwzyqoscP9262N7QZdU2XQ=; b=Dq0TwPwI9kOX2xXcDX34STGtB kQi2nTdnz3ABQ8OWOmyg0W19OkhHZh/O/EVZyvese4str/XdfkRPefNcxEpWOdW4nfRF/rwzbZuPj PT0woqYJLdhiAdZyCz8iwOruYY82gBJS76JqT4oERuSOSx8UNR8mWzHjcoQ5jKmNb4HTE3YrT7PJE orr+VhKmVzhDGQlVfIGeWQkMZ27X1dafpxMUbsbJRR/3/fE0QcsIQnwLrr/qy2OyYdk9DQ+ENWc3h IE7jBWoNfXTc5VbpFfQ8r9DMGisvwDU+ZPQ0KabZzvE/snVgOsVbJWPfHFhX1RzamfQn6FH4XU0Zy 4cMpH0V/A==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1f6Jgg-0002E5-Ne; Wed, 11 Apr 2018 17:37:38 +0000 Subject: Re: [PATCH 01/24] Add the ability to lock down access to the running kernel image To: David Howells , torvalds@linux-foundation.org Cc: linux-man@vger.kernel.org, linux-api@vger.kernel.org, jmorris@namei.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org References: <152346387861.4030.4408662483445703127.stgit@warthog.procyon.org.uk> <152346388583.4030.15146667041427303547.stgit@warthog.procyon.org.uk> From: Randy Dunlap Message-ID: <6a37b428-d9fb-12d5-8d36-8a032984af8c@infradead.org> Date: Wed, 11 Apr 2018 10:37:38 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <152346388583.4030.15146667041427303547.stgit@warthog.procyon.org.uk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/11/2018 09:24 AM, David Howells wrote: > --- > > arch/x86/kernel/setup.c | 2 + > include/linux/kernel.h | 32 +++++++++++++++++++++++ > security/Kconfig | 23 ++++++++++++++++- > security/Makefile | 3 ++ > security/lock_down.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++ > 5 files changed, 124 insertions(+), 1 deletion(-) > create mode 100644 security/lock_down.c > diff --git a/security/Kconfig b/security/Kconfig > index c4302067a3ad..a68e5bdebad5 100644 > --- a/security/Kconfig > +++ b/security/Kconfig > @@ -231,6 +231,28 @@ config STATIC_USERMODEHELPER_PATH > If you wish for all usermode helper programs to be disabled, > specify an empty string here (i.e. ""). > > +config LOCK_DOWN_KERNEL > + bool "Allow the kernel to be 'locked down'" > + help > + Allow the kernel to be locked down. Locking down the kernel turns > + off various features that might otherwise allow access to the kernel s/turns off/disables/ > + image (eg. setting MSR registers). e.g. > + > + Note, however, that locking down your kernel will prevent some the kernel a kernel > + drivers from functioning because allowing manual configuration of > + hardware parameters is forbidden, lest a device be used to access the > + kernel by DMA. This mostly applies to ISA devices. Is DMA from non-ISA devices OK, or did I miss seeing that patch? > + The kernel lockdown can be triggered by adding lockdown=1 to the > + kernel command line. > diff --git a/security/lock_down.c b/security/lock_down.c > new file mode 100644 > index 000000000000..f35ffdd096ad > --- /dev/null > +++ b/security/lock_down.c > @@ -0,0 +1,65 @@ > +/* Lock down the kernel > + * > + * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved. > + * Written by David Howells (dhowells@redhat.com) > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public Licence > + * as published by the Free Software Foundation; either version > + * 2 of the Licence, or (at your option) any later version. fsf.org spells that Licence word as License. :) > + */ -- ~Randy